Commit 393ece85 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/process: exit_thread handlers should reschedule as needed

An exit_handler wants to be called from the root domain, with
preemption enabled and hard irqs on in order to keep all options open,
such as using regular sleeping locks.

If such a handler updates the Cobalt scheduler state, it has to
trigger the rescheduling procedure (xnsched_run()) internally as well,
grouping the changes and the rescheduling call into the same
interrupt-free section, in order to guard against CPU migration.

Relying on the core to kick such procedure in order to commit pending
changes later on is unreliable.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <>
parent 34e226a2
......@@ -1144,10 +1144,11 @@ static void __handle_taskexit_event(struct task_struct *p)
if (xnthread_test_state(thread, XNSSTEP))
xnlock_put_irqrestore(&nklock, s);
xnthread_run_handler_stack(thread, exit_thread);
if (xnthread_test_state(thread, XNUSER)) {
cobalt_umm_free(&cobalt_kernel_ppd.umm, thread->u_window);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment