Re: [PATCH RFC 3/3] arm64: Add HOTPLUG_PARALLEL support for secondary CPUs
From: Jinjie Ruan
Date: Mon Jun 22 2026 - 04:17:46 EST
On 6/18/2026 11:49 PM, Thomas Gleixner wrote:
> On Thu, Jun 11 2026 at 21:38, Jinjie Ruan wrote:
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -113,6 +113,7 @@ config ARM64
>> select CPUMASK_OFFSTACK if NR_CPUS > 256
>> select DCACHE_WORD_ACCESS
>> select HAVE_EXTRA_IPI_TRACEPOINTS
>> + select HOTPLUG_PARALLEL if SMP && HOTPLUG_CPU
>
> Why do you tie that to HOTPLUG_CPU? HOTPLUG_CPU lets you unplug/plug
> CPUs at runtime, but if its disabled then a SMP system still has to
> bring up the APs. So why should that fall back to the existing variant?
That's a very good point. Parallel bringup of APs during early boot
should indeed benefit SMP systems even if runtime CPU hotplug
(HOTPLUG_CPU) is disabled. I will decouple this optimization from
HOTPLUG_CPU and tie it strictly to SMP. Thanks for catching this!
>
>> +#ifdef CONFIG_HOTPLUG_PARALLEL
>> +extern struct secondary_data cpu_boot_data[NR_CPUS];
>> +#endif
>> +
>> extern struct secondary_data secondary_data;
>> extern long __early_cpu_boot_status;
>> extern void secondary_entry(void);
>> @@ -124,7 +128,11 @@ static inline void __noreturn cpu_park_loop(void)
>>
>> static inline void update_cpu_boot_status(unsigned int cpu, int val)
>> {
>> +#ifdef CONFIG_HOTPLUG_PARALLEL
>> + WRITE_ONCE(cpu_boot_data[cpu].status, val);
>> +#else
>> WRITE_ONCE(secondary_data.status, val);
>> +#endif
>
> You're really a great fan of #ifdefs, right?
>
> Just convert it over to the parallel mode unconditionally and get rid of
> the existing cruft.
Converting this unconditionally to use cpu_boot_data makes the code so
much cleaner. Thanks for the guidance!
>
>> /*
>> * TTBR0 is only used for the identity mapping at this stage. Make it
>> * point to zero page to avoid speculatively fetching new entries.
>> @@ -254,7 +276,9 @@ asmlinkage notrace void secondary_start_kernel(void)
>> read_cpuid_id());
>> update_cpu_boot_status(cpu, CPU_BOOT_SUCCESS);
>> set_cpu_online(cpu, true);
>> +#ifndef CONFIG_HOTPLUG_PARALLEL
>> complete(&cpu_running);
>> +#endif
>
> Just for the record. You can get rid of this completion w/o PARALLEL
> hotplug by selecting HOTPLUG_SPLIT_STARTUP and implementing the
> kick/sync parts.
I will look into selecting HOTPLUG_SPLIT_STARTUP and cleaning up this
completion mechanism either as a prerequisite cleanup patch. For now, I
will make sure to eliminate the ugly #ifndef as suggested earlier.
>
> Thanks,
>
> tglx
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-riscv