manuelselva Posted March 16, 2016 Report Posted March 16, 2016 Hi all, In the context of a SystemC simulation with many SC_THREAD processes (> 32000), I am facing the following error on an Intel X86 platform running Ubuntu 15.04: sc_cor_qt.cpp:114: virtual void sc_core::sc_cor_qt::stack_protect(bool) Assertion `ret == 0' failed I looked into the implementation of the kernel, and here is my current understanding. The default implementation of the SystemC kernel uses user-level threads (also called coroutines) to implement the SystemC processes. The static processes (SC_THREAD and SC_CTHREAD) are initialized in the sc_simcontext.cpp line 759 thread_p->prepare_for_simulation() This function will create the user-level thread object and then enable stack protection. The stack of the user-level thread is allocated in the heap of the SystemC simulation process by the following line cor->m_stack = new char[cor->m_stack_size] The issue I am facing happens in the stack protection function after the creation, that uses an mprotect system call to make the page just after the stack of the user-level thread (again, being in the heap of the Linux process) non accessible at all (PROT_NONE). The error (ENOMEM) I have from mprotect says that this page we want to protect has never been mapped into the process or that the kernel was not able allocate some internal structures while running the mprotect call. Unfortunately I am not able to know which of these two errors happens and how to fix it. Moreover, I can't see where this extra page is allocated in the heap of the Linux process before the mprotect call is made. Does anyone know what is going and/or what can I do know to further debug this issue ? Thank you very much for any help you cna provide on this issue ? ---- Manu Quote
manuelselva Posted March 16, 2016 Author Report Posted March 16, 2016 The answer was already on this forum, but I didn't found it this morning: http://forums.accellera.org/topic/1864-sc-cor-qtstack-protect/ I needed to increase the maximum number of memory mappings allowed by my Linux kernel sudo bash -c 'echo 131060 > /proc/sys/vm/max_map_count' Thank you (by transitivity) Philipp Quote
Philipp A Hartmann Posted March 17, 2016 Report Posted March 17, 2016 You're welcome! I just wanted to do the search myself, as I vaguely remembered this discussion. Greetings from Duisburg, Philipp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.