Re: [PATCH] smp: Suppress false DEBUG_PREEMPT warning in smp_call_on_cpu()

From: Nam Cao

Date: Wed Nov 05 2025 - 03:42:44 EST


Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> writes:
>> This appears after commit 06ddd17521bf ("sched/smp: Always define
>> is_percpu_thread() and scheduler_ipi()"). Before this commit,
>> is_percpu_thread() always returns true on UP kernel and thus
>> debug_smp_processor_id() always sees a per-cpu thread and never warns. But
>> now is_percpu_thread() returns false for this case.
>>
>> Suppress this warning with a migrate_disable()+migrate_enable() pair.
>
> Right. This is one of the possibilities. The other one would be to also
> workqueue on UP and preserve the same semantic.
> I don't mind this.

Yeah it's a tradeoff. I'm not sure if someone will be bothered by the
overhead that workqueue introduces, so I use this cheap solution.

>> +
>> + /* suppress warnings from debug_smp_processor_id() */
>
> If you want to add a comment, what about something like
>
> /* Preserve not being migratable such as SMP variant does */

Wouldn't it be a bit misleading? It's true that technically SMP variant
is not migratable, but that's because it is a per-cpu thread, not
because of migrate_disable(). To me, the comment sounds like that there
is also a migrate_disable() in SMP variant.

Nam