Re: [patch v3 13/36] x86/smpboot: Remove cpu_callin_mask

Peter Zijlstra
2023-05-09T10:50:30Z

On Mon, May 08, 2023 at 09:43:47PM +0200, Thomas Gleixner wrote:

> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c

> @@ -167,21 +166,16 @@ static inline void smpboot_restore_warm_
> */
> static void smp_callin(void)
> {
> - int cpuid;
> + int cpuid = smp_processor_id();
>
> /*
> * If waken up by an INIT in an 82489DX configuration
> - * cpu_callout_mask guarantees we don't get here before
> - * an INIT_deassert IPI reaches our local APIC, so it is
> - * now safe to touch our local APIC.
> - */
> - cpuid = smp_processor_id();
> -
> - /*
> - * the boot CPU has finished the init stage and is spinning
> - * on callin_map until we finish. We are free to set up this
> - * CPU, first the APIC. (this is probably redundant on most
> - * boards)
> + * cpu_callout_mask guarantees we don't get here before an
> + * INIT_deassert IPI reaches our local APIC, so it is now safe to
> + * touch our local APIC.
> + *
> + * Set up this CPU, first the APIC, which is probably redundant on
> + * most boards.
> */
> apic_ap_setup();
>
> @@ -192,7 +186,7 @@ static void smp_callin(void)
> * The topology information must be up to date before
> * calibrate_delay() and notify_cpu_starting().
> */
> - set_cpu_sibling_map(raw_smp_processor_id());
> + set_cpu_sibling_map(cpuid);
>
> ap_init_aperfmperf();
>
> @@ -205,11 +199,6 @@ static void smp_callin(void)
> * state (CPUHP_ONLINE in the case of serial bringup).
> */
> notify_cpu_starting(cpuid);
> -
> - /*
> - * Allow the master to continue.
> - */
> - cpumask_set_cpu(cpuid, cpu_callin_mask);
> }
>
> static void ap_calibrate_delay(void)
> @@ -268,11 +257,6 @@ static void notrace start_secondary(void
> rcu_cpu_starting(raw_smp_processor_id());
> x86_cpuinit.early_percpu_clock_init();
>
> - /*
> - * Sync point with wait_cpu_callin(). The AP doesn't wait here
> - * but just sets the bit to let the controlling CPU (BSP) know that
> - * it's got this far.
> - */
> smp_callin();
>
> /* Otherwise gcc will move up smp_processor_id() before cpu_init() */

Good riddance to that mask; however is smp_callin() still an appropriate
name for that function?

Would smp_starting() -- seeing how this kicks of CPU_STARTING not be a
better name?