hw: always panic on removal of scheduler head

Because of helping, it is possible that a core thread that wants to
destroy another thread at the kernel is using the scheduling context of
the thread that shall be destroyed at this point in time. When building
without GENODE_RELEASE defined, this always triggers an assertion in the
kernel. But when building with GENODE_RELEASE defined, this might silently
lead to kernel-memory corruption. This commit eliminates the latter case.
Should be reverted as soon as the scheduler is able to remove its head.

Ref #1537
This commit is contained in:
Martin Stein 2015-05-21 13:01:33 +02:00 committed by Christian Helmuth
parent 28804e2bfb
commit 8a99c08ae4
1 changed files with 12 additions and 1 deletions

View File

@ -180,7 +180,18 @@ void Cpu_scheduler::yield() { _head_yields = 1; }
void Cpu_scheduler::remove(Share * const s)
{
assert(s != _idle && s != _head);
assert(s != _idle);
/*
* FIXME
* Thanks to helping, this can happen and shall not be treated as bad
* behavior. But by now, we have no stable solution for it.
*
*/
if (s == _head) {
PERR("Removing the head of the CPU scheduler isn't supported by now.");
while (1) ;
}
if (s->_ready) { _fills.remove(s); }
if (!s->_quota) { return; }
if (s->_ready) { _rcl[s->_prio].remove(s); }