Kernel: Make m_halt_requested an atomic variable
We need to make sure the change to this variable is visible to all processors instantly.
This commit is contained in:
parent
a14884dd33
commit
e26e0445b5
Notes:
sideshowbarker
2024-07-19 01:27:01 +09:00
Author: https://github.com/tomuta Commit: https://github.com/SerenityOS/serenity/commit/e26e0445b5b Pull-request: https://github.com/SerenityOS/serenity/pull/4042
2 changed files with 5 additions and 5 deletions
|
@ -1819,11 +1819,11 @@ bool Processor::smp_process_pending_messages()
|
|||
}
|
||||
}
|
||||
|
||||
if (m_halt_requested)
|
||||
if (m_halt_requested.load(AK::MemoryOrder::memory_order_relaxed))
|
||||
halt_this();
|
||||
}
|
||||
did_process = true;
|
||||
} else if (m_halt_requested) {
|
||||
} else if (m_halt_requested.load(AK::MemoryOrder::memory_order_relaxed)) {
|
||||
halt_this();
|
||||
}
|
||||
|
||||
|
@ -1876,7 +1876,7 @@ void Processor::smp_broadcast_message(ProcessorMessage& msg, bool async)
|
|||
// We need to check here if another processor may have requested
|
||||
// us to halt before this message could be delivered. Otherwise
|
||||
// we're just spinning the CPU because msg.refs will never drop to 0.
|
||||
if (cur_proc.m_halt_requested)
|
||||
if (cur_proc.m_halt_requested.load(AK::MemoryOrder::memory_order_relaxed))
|
||||
halt_this();
|
||||
}
|
||||
|
||||
|
@ -1918,7 +1918,7 @@ void Processor::smp_broadcast_halt()
|
|||
// by being out of memory and we might not be able to get a message
|
||||
for_each(
|
||||
[&](Processor& proc) -> IterationDecision {
|
||||
proc.m_halt_requested = true;
|
||||
proc.m_halt_requested.store(true, AK::MemoryOrder::memory_order_release);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
|
|
|
@ -724,7 +724,7 @@ class Processor {
|
|||
|
||||
bool m_invoke_scheduler_async;
|
||||
bool m_scheduler_initialized;
|
||||
bool m_halt_requested;
|
||||
Atomic<bool> m_halt_requested;
|
||||
|
||||
DeferredCallEntry* m_pending_deferred_calls; // in reverse order
|
||||
DeferredCallEntry* m_free_deferred_call_pool_entry;
|
||||
|
|
Loading…
Add table
Reference in a new issue