x86/delay: Avoid preemptible context checks in delay_mwaitx()
authorBorislav Petkov <[email protected]>
Wed, 9 Mar 2016 20:56:22 +0000 (21:56 +0100)
committerIngo Molnar <[email protected]>
Thu, 10 Mar 2016 10:27:12 +0000 (11:27 +0100)
commit84477336ec03f8061ffd6908da341e063e5d6d1f
treec5b17f64a9fd0f611810039705d0cbe5741ca6de
parenta65050c6f17e52442716138d48d0a47301a8344b
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 <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Huang Rui <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/lib/delay.c