History log of /fuchsia/zircon/kernel/arch/x86/bp_percpu.c
Revision Date Author Comments
# 35a1ba79 27-Feb-2018 David Stevens <stevensd@google.com>

[kernel][sched][x86] Use monitor/mwait when idle

When rescheduling idle cpus, use monitor/mwait instead of relying on
IPIs. This change adds some reschedule-specific arch hooks, instead of
relying on the arch IPI hooks.

The x86 percpu state includes a variable that tracks whether the cpu is
running the idle thread. The idle thread monitors and mwaits on that
variable. Then other threads can reschedule the idle cpu by clearing
the monitored variable.

ZX-1713
ZX-1293 #done

Change-Id: I5f7bf073e3e5b6e1e5fa4febc412f52f40773e2d


# 911dc99c 03-Jun-2017 Roland McGrath <mcgrathr@google.com>

[kernel][arch][x86] Revamp stack-protector/safe-stack early setup

This moves the setup of the boot CPU's x86_percpu in %gs.base
into assembly and the most basic initialization of its x86_percpu
into a compile-time static initializer. This makes it possible
for all the C code on the startup path to use safe-stack and/or
stack-protector (which gets harder and harder to avoid with LTO).

Now the only C function that runs at all is x86_secondary_entry.
The work it does to discover its CPU number (and thus the right
address for its own x86_percpu) is too complex to do in assembly.
Instead, x86_secondary_entry is split so that the first C
function run on secondary CPUs is a simple one that manages to
avoid stack-protector/safe-stack code, and it sets up %gs.base
and enough of x86_percpu that it can then call the second C
function and that function can safely use safe-stack and/or
stack-protector code.

Change-Id: If8f0860a05a0bd98285a15d0f2f97699bf16d9d7