Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/x86/cpu_machdep.c
| Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
| #include "opt_cpu.h" | #include "opt_cpu.h" | ||||
| #include "opt_ddb.h" | #include "opt_ddb.h" | ||||
| #include "opt_inet.h" | #include "opt_inet.h" | ||||
| #include "opt_isa.h" | #include "opt_isa.h" | ||||
| #include "opt_kdb.h" | #include "opt_kdb.h" | ||||
| #include "opt_kstack_pages.h" | #include "opt_kstack_pages.h" | ||||
| #include "opt_maxmem.h" | #include "opt_maxmem.h" | ||||
| #include "opt_platform.h" | #include "opt_platform.h" | ||||
| #include "opt_sched.h" | |||||
| #ifdef __i386__ | #ifdef __i386__ | ||||
| #include "opt_apic.h" | #include "opt_apic.h" | ||||
| #endif | #endif | ||||
| #include <sys/param.h> | #include <sys/param.h> | ||||
| #include <sys/proc.h> | #include <sys/proc.h> | ||||
| #include <sys/systm.h> | #include <sys/systm.h> | ||||
| #include <sys/bus.h> | #include <sys/bus.h> | ||||
| ▲ Show 20 Lines • Show All 479 Lines • ▼ Show 20 Lines | cpu_idle_enter(int *statep, int newstate) | ||||
| * sched_runnable() with this store to the idle state word. Without it, | * sched_runnable() with this store to the idle state word. Without it, | ||||
| * cpu_idle_wakeup() can observe the state as STATE_RUNNING after having | * cpu_idle_wakeup() can observe the state as STATE_RUNNING after having | ||||
| * added load to the queue, and elide an IPI. Then, sched_runnable() | * added load to the queue, and elide an IPI. Then, sched_runnable() | ||||
| * can observe tdq_load == 0, so the CPU ends up idling with pending | * can observe tdq_load == 0, so the CPU ends up idling with pending | ||||
| * work. tdq_notify() similarly ensures that a prior update to tdq_load | * work. tdq_notify() similarly ensures that a prior update to tdq_load | ||||
| * is visible before calling cpu_idle_wakeup(). | * is visible before calling cpu_idle_wakeup(). | ||||
| */ | */ | ||||
| atomic_store_int(statep, newstate); | atomic_store_int(statep, newstate); | ||||
| #if defined(SCHED_ULE) && defined(SMP) | |||||
| atomic_thread_fence_seq_cst(); | atomic_thread_fence_seq_cst(); | ||||
| #endif | |||||
| /* | /* | ||||
| * Since we may be in a critical section from cpu_idle(), if | * Since we may be in a critical section from cpu_idle(), if | ||||
| * an interrupt fires during that critical section we may have | * an interrupt fires during that critical section we may have | ||||
| * a pending preemption. If the CPU halts, then that thread | * a pending preemption. If the CPU halts, then that thread | ||||
| * may not execute until a later interrupt awakens the CPU. | * may not execute until a later interrupt awakens the CPU. | ||||
| * To handle this race, check for a runnable thread after | * To handle this race, check for a runnable thread after | ||||
| * disabling interrupts and immediately return if one is | * disabling interrupts and immediately return if one is | ||||
| ▲ Show 20 Lines • Show All 1,197 Lines • Show Last 20 Lines | |||||