Re: [tip:sched/urgent] Revert "sched/core: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn()"

From: Thomas Gleixner
Date: Tue Oct 04 2016 - 04:25:20 EST


On Tue, 4 Oct 2016, tip-bot for Ingo Molnar wrote:
> The original change widens a preempt-off section, to avoid a seemingly unsafe
> smp_processor_id() use.
>
> During review I overlooked two facts:
>
> - The code to calls a non-trivial function callback:
>
> ht->park(td->cpu);
>
> ... which might (and does occasionally) sleep, triggering the warning.
>
> - More importantly, as pointed out by Peter Zijlstra, using
> smp_processor_id() in that context is safe, if it's done from
> a kernel thread that is pinned to a single CPU - which is the
> case here.
>
> So revert to the original code that enables preemption sooner.
>
> Reported-by: kernel test robot <xiaolong.ye@xxxxxxxxx>
> Acked-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>

Acked-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>