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

Peter Zijlstra
2025-11-03T14:10:14Z

On Mon, Nov 03, 2025 at 02:10:51PM +0100, Sebastian Andrzej Siewior wrote:
> On 2025-11-03 13:42:54 [+0100], Peter Zijlstra wrote:
> > How about:
> >
> > if (cpuhp_is_atomic_state(state)) {
> > guard(irqsave)();
> > ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL);
> > /*
> > * STARTING/DYING must not fail!
> > */
> > WARN_ON_ONCE(ret);
> > } else {
> > ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL);
> > }
> >
> > which is a little more like cpuhp_thread_fun()
>
> very nice indeed. What about WARN_ON_ONCE(ret && bringup) given the
> BUG_ON(ret && !bringup) below?

That would be confusing to read, the condition here is any failure. And
yes, this way you'll get a WARN and then a BUG, but meh :-)