commit | 8f254105da5ca54d48bc3ed6e42e3925654f973e | [log] [tgz] |
---|---|---|
author | Venkatesh Srinivas <venkateshs@google.com> | Wed Oct 28 00:30:12 2020 +0000 |
committer | CQ Bot <commit-bot@chromium.org> | Wed Oct 28 00:30:12 2020 +0000 |
tree | e041962b80416addc899df106b2b7c3eba6a7c09 | |
parent | f3a2aae397f3abe9fb0ec898e82ac7058ddfe5cc [diff] |
[kernel][x86] Convert halt_interlock from legacy int -> ktl::atomic |halt_interlock| is a per-CPU flag used in the HLT-version of the x86 idle loop; it is used in the adaptive spin before HLT, so that remote wakeups can avoid an IPI while a target CPU is spinning. Specifically: . When a CPU is idle, it executes the idle thread; the thread executes the HLT instruction in a loop until there is something else to do. . HLT may have a long entry / exit latency . Before we HLT, we spin a bit, checking for work; while we're spinning remote cores can wake us with a pure store. After we enter halt, we need to use an IPI to wake a sleeping core. 1. A core that's about to sleep sets a per-cpu variable, 'halt_interlock', to 1. 2. It then spins a bit, checking that halt_interlock is still == 1 3. It then uses CMPXCHG to switch halt_interlock -> 2. 4. Then it halts A wakeup does: 1. CMPXCHG switches halt_interlock from 1->0 2. If it fails, we use an IPI to do a heavyweight wake Convert the flag from a volatile int to a ktl::atomic<>. Bug: 47117 Use only ktl::atomic in the kernel Change-Id: I63a6b57e5d906e7d22e8b19919c4d176b8d372c2 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/441925 Commit-Queue: Venkatesh Srinivas <venkateshs@google.com> Reviewed-by: Nick Maniscalco <maniscalco@google.com> Testability-Review: Nick Maniscalco <maniscalco@google.com>
Pink + Purple == Fuchsia (a new operating system)
Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.
Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.
Read more about Fuchsia's principles.
See Getting Started.
See fuchsia.dev.