Re: [PATCH 11/19] arm64: smp: Use generic HOTPLUG_SPLIT_STARTUP machinery for CPU onlining

From: Will Deacon

Date: Fri Sep 11 2026 - 09:00:33 EST


On Tue, Sep 08, 2026 at 07:35:46PM +0800, Jinjie Ruan wrote:
>
>
> 在 2026/9/8 0:40, Will Deacon 写道:
> > In preparation for enabling parallel bringup of secondary CPUs on arm64,
> > take the baby step of moving from HOTPLUG_CORE_SYNC_FULL to
> > HOTPLUG_SPLIT_STARTUP.
> >
> > Rework the cpu_die_early() path to use a private cpumask, otherwise
> > clearing the incoming CPU from the present mask in the 'kick' stage will
> > prevent the hotplug stage machine from progressing and
> > arch_cpuhp_cleanup_kick_cpu() will not be called.
> >
> > Signed-off-by: Will Deacon <will@xxxxxxxxxx>
> > ---
> > arch/arm64/Kconfig | 2 +-
> > arch/arm64/include/asm/smp.h | 1 +
> > arch/arm64/kernel/smp.c | 9 +++++----
> > 3 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > index 89d1f0f2269c..fd8cf792b7fd 100644
> > --- a/arch/arm64/Kconfig
> > +++ b/arch/arm64/Kconfig
> > @@ -230,7 +230,7 @@ config ARM64
> > select HAVE_SYSCALL_TRACEPOINTS
> > select HAVE_KPROBES
> > select HAVE_KRETPROBES
> > - select HOTPLUG_CORE_SYNC_FULL
> > + select HOTPLUG_SPLIT_STARTUP
> > select HOTPLUG_SMT if HOTPLUG_CPU
> > select IRQ_DOMAIN
> > select IRQ_FORCED_THREADING
> > diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
> > index fe343c30d620..7b986a6a765b 100644
> > --- a/arch/arm64/include/asm/smp.h
> > +++ b/arch/arm64/include/asm/smp.h
> > @@ -89,6 +89,7 @@ asmlinkage void secondary_start_kernel(void);
> > struct secondary_data {
> > struct task_struct *task;
> > long status;
> > + cpumask_t cpu_died_early_mask;
> > };
> >
> > extern struct secondary_data secondary_data;
> > diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> > index 00362ed6e1ab..c5e9d5d5e003 100644
> > --- a/arch/arm64/kernel/smp.c
> > +++ b/arch/arm64/kernel/smp.c
> > @@ -62,7 +62,7 @@
> > * so we need some other way of telling a new secondary core
> > * where to place its SVC stack
> > */
> > -struct secondary_data secondary_data;
> > +struct secondary_data secondary_data = {};
> > /* Number of CPUs which aren't online, but looping in kernel text. */
> > static int cpus_stuck_in_kernel;
> >
> > @@ -108,7 +108,7 @@ static int boot_secondary(unsigned int cpu, struct task_struct *idle)
> > return -EOPNOTSUPP;
> > }
> >
> > -int __cpu_up(unsigned int cpu, struct task_struct *idle)
> > +int arch_cpuhp_kick_ap_alive(unsigned int cpu, struct task_struct *idle)
> > {
> > int ret;
> >
> > @@ -146,6 +146,8 @@ void arch_cpuhp_cleanup_kick_cpu(unsigned int cpu, bool is_alive)
> > cpus_stuck_in_kernel++;
> > break;
> > case CPU_KILL_ME:
> > + if (cpumask_test_cpu(cpu, &secondary_data.cpu_died_early_mask))
> > + set_cpu_present(cpu, false);
>
> Should we set_cpu_present(cpu, false) in CPU_STUCK_IN_KERNEL case, as we
> do not update to CPU_KILL_ME but CPU_STUCK_IN_KERNEL if
> CONFIG_HOTPLUG_CPU is not enabled

That's where we get to at the end of the series, but I can hoist this
check on 'secondary_data.cpu_died_early_mask' above the switch here to
keep that behaviour for bisection.

Will