Skip to content
Snippets Groups Projects
Commit 84046f23 authored by Avi Kivity's avatar Avi Kivity
Browse files

sched: fix preempt_enable() when interrupts are disabled

If interrupts are disabled, we must not call schedule() even if
the preemption counter says we need to, as the context is not preemption
safe.

This manifested itself in a wake() within a timer causing a schedule(),
which re-enabled interrupts, which caused further manipulation of the timer
list to occur concurrently with the next interrupt, resulting in corruption.

Fixes timer stress test failure.
parent 858f7666
No related branches found
No related tags found
No related merge requests found
...@@ -482,7 +482,7 @@ void preempt_disable() ...@@ -482,7 +482,7 @@ void preempt_disable()
void preempt_enable() void preempt_enable()
{ {
--preempt_counter; --preempt_counter;
if (!preempt_counter && need_reschedule) { if (!preempt_counter && need_reschedule && arch::irq_enabled()) {
schedule(); schedule();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment