Re: [PATCH] cpu/hotplug: ensure the starting section runs fully regardless of target
From: Thomas Gleixner
Date: Sun Dec 08 2024 - 15:34:46 EST
On Sat, Dec 07 2024 at 23:47, Koichiro Den wrote:
> static int take_cpu_down(void *_param)
> {
> struct cpuhp_cpu_state *st = this_cpu_ptr(&cpuhp_state);
> - enum cpuhp_state target = max((int)st->target, CPUHP_AP_OFFLINE);
> int err, cpu = smp_processor_id();
>
> /* Ensure this CPU doesn't handle any more interrupts. */
> @@ -1285,8 +1284,9 @@ static int take_cpu_down(void *_param)
>
> /*
> * Invoke the former CPU_DYING callbacks. DYING must not fail!
> + * Regardless of st->target, it must run through to CPUHP_AP_OFFLINE.
> */
> - cpuhp_invoke_callback_range_nofail(false, cpu, st, target);
> + cpuhp_invoke_callback_range_nofail(false, cpu, st, CPUHP_AP_OFFLINE);
This is really the wrong place. This want's to be enforced at the sysfs
interface already and reject writes which are between AP_OFFLINE and
AP_ONLINE.
It's utterly confusing to write a particular target and then magically
end up at some other state.
Thanks,
tglx