diff options
authorBorislav Petkov <>2016-03-09 21:56:22 +0100
committerIngo Molnar <>2016-03-10 11:27:12 +0100
commit84477336ec03f8061ffd6908da341e063e5d6d1f (patch)
parenta65050c6f17e52442716138d48d0a47301a8344b (diff)
x86/delay: Avoid preemptible context checks in delay_mwaitx()
We do use this_cpu_ptr(&cpu_tss) as a cacheline-aligned, seldomly accessed per-cpu var as the MONITORX target in delay_mwaitx(). However, when called in preemptible context, this_cpu_ptr -> smp_processor_id() -> debug_smp_processor_id() fires: BUG: using smp_processor_id() in preemptible [00000000] code: udevd/312 caller is delay_mwaitx+0x40/0xa0 But we don't care about that check - we only need cpu_tss as a MONITORX target and it doesn't really matter which CPU's var we're touching as we're going idle anyway. Fix that. Suggested-by: Andy Lutomirski <> Signed-off-by: Borislav Petkov <> Cc: Andy Lutomirski <> Cc: Huang Rui <> Cc: Linus Torvalds <> Cc: Peter Zijlstra <> Cc: Peter Zijlstra <> Cc: Thomas Gleixner <> Cc: Link: Signed-off-by: Ingo Molnar <>
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/lib/delay.c b/arch/x86/lib/delay.c
index e912b2f6d36e..2f07c291dcc8 100644
--- a/arch/x86/lib/delay.c
+++ b/arch/x86/lib/delay.c
@@ -102,7 +102,7 @@ static void delay_mwaitx(unsigned long __loops)
* Use cpu_tss as a cacheline-aligned, seldomly
* accessed per-cpu variable as the monitor target.
- __monitorx(this_cpu_ptr(&cpu_tss), 0, 0);
+ __monitorx(raw_cpu_ptr(&cpu_tss), 0, 0);
* AMD, like Intel, supports the EAX hint and EAX=0xf