Re: [PATCH v2] cpu: Make atomic callbacks run on UP with disabled interrupts

Sebastian Andrzej Siewior
2025-11-03T14:31:50Z

On 2025-11-03 15:10:58 [+0100], Peter Zijlstra wrote:
> On Mon, Nov 03, 2025 at 02:28:20PM +0100, Sebastian Andrzej Siewior wrote:
> > On SMP callbacks in the "starting" range are invoked while the CPU is
> > brought up and interrupts are still disabled. Callbacks which are added
> > later ar invoked via the hotplug-thread on the target CPU and interrupts
> > are explicitly disabled.
> > In the UP case callbacks which are added later are invoked "directly"
> > without the thread. This is okay since there is just one CPU but with
> > enabled interrupts debug code, such as smp_processor_id(), will issue
> > warnings.
> >
> > Disable interrupts before invoking the calback on UP if the state is
> > atomic and interrupts are expected to be disabled.
> > The "save" part is required because this is also invoked early in the
> > boot process while interrupts are disabled and must not be enabled. The
> > warnings aligns the function with cpuhp_thread_fun().
> >
> > Fixes: 06ddd17521bf1 ("sched/smp: Always define is_percpu_thread() and scheduler_ipi()")
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>
> Did we want me to merge this into sched/urgent or what was the
> hope/intention for this patch.

I did testing on ARM/UP and run into this. Therefore I would suggest
sched/urgent or the matching hotplug/urgent should one exist.

But since it is just a smp_processor_id() debug warning on UP and
nothing serious I don't mind to delay it until the next merge window.

Sebastian