]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
x86/smpboot: Remove cpu_callin_mask
authorThomas Gleixner <tglx@linutronix.de>
Mon, 27 Mar 2023 15:37:39 +0000 (17:37 +0200)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 30 Mar 2023 12:27:05 +0000 (14:27 +0200)
Now that TSC synchronization is SMP function call based there is no reason
to wait for the AP to be set in smp_callin_mask. The control CPU waits for
the AP to set itself in the online mask anyway.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/smpboot.c

index 5b80a53a4161794435ea92369ef0c906a7ae087a..925ca71fe19dfb1e62204dbd1cc082b2463045fa 100644 (file)
@@ -104,7 +104,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_info);
 /* All of these masks are initialized in setup_cpu_local_masks() */
 static cpumask_var_t cpu_initialized_mask;
 static cpumask_var_t cpu_callout_mask;
-static cpumask_var_t cpu_callin_mask;
 /* Representing CPUs for which sibling maps can be computed */
 static cpumask_var_t cpu_sibling_setup_mask;
 
@@ -167,21 +166,16 @@ static inline void smpboot_restore_warm_reset_vector(void)
  */
 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();
 
@@ -195,7 +189,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();
 
@@ -216,11 +210,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 wait_for_master_cpu(int cpu)
@@ -264,11 +253,6 @@ static void notrace start_secondary(void *unused)
        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() */
@@ -1101,7 +1085,7 @@ static int wait_cpu_cpumask(unsigned int cpu, const struct cpumask *mask)
  * and thus wait_for_master_cpu(), then set cpu_callout_mask to allow it
  * to proceed.  The AP will then proceed past setting its 'callin' bit
  * and end up waiting in check_tsc_sync_target() until we reach
- * do_wait_cpu_online() to tend to it.
+ * wait_cpu_online() to tend to it.
  */
 static int wait_cpu_initialized(unsigned int cpu)
 {
@@ -1116,20 +1100,7 @@ static int wait_cpu_initialized(unsigned int cpu)
 }
 
 /*
- * Bringup step three: Wait for the target AP to reach smp_callin().
- * The AP is not waiting for us here so we don't need to parallelise
- * this step. Not entirely clear why we care about this, since we just
- * proceed directly to TSC synchronization which is the next sync
- * point with the AP anyway.
- */
-static void wait_cpu_callin(unsigned int cpu)
-{
-       while (!cpumask_test_cpu(cpu, cpu_callin_mask))
-               schedule();
-}
-
-/*
- * Bringup step four: Wait for the target AP to reach set_cpu_online() in
+ * Bringup step three: Wait for the target AP to reach set_cpu_online() in
  * start_secondary().
  */
 static void wait_cpu_online(unsigned int cpu)
@@ -1158,14 +1129,6 @@ static int native_kick_ap(unsigned int cpu, struct task_struct *tidle)
                return -EINVAL;
        }
 
-       /*
-        * Already booted CPU?
-        */
-       if (cpumask_test_cpu(cpu, cpu_callin_mask)) {
-               pr_debug("do_boot_cpu %d Already started\n", cpu);
-               return -ENOSYS;
-       }
-
        /*
         * Save current MTRR state in case it was changed since early boot
         * (e.g. by the ACPI SMI) to initialize new CPUs with MTRRs in sync:
@@ -1203,7 +1166,6 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
        if (ret)
                goto out;
 
-       wait_cpu_callin(cpu);
        wait_cpu_online(cpu);
 
 out:
@@ -1319,7 +1281,6 @@ void __init smp_prepare_cpus_common(void)
         * Setup boot CPU information
         */
        smp_store_boot_cpu_info(); /* Final full version of the data */
-       cpumask_copy(cpu_callin_mask, cpumask_of(0));
        mb();
 
        for_each_possible_cpu(i) {
@@ -1534,7 +1495,6 @@ __init void prefill_possible_map(void)
 void __init setup_cpu_local_masks(void)
 {
        alloc_bootmem_cpumask_var(&cpu_initialized_mask);
-       alloc_bootmem_cpumask_var(&cpu_callin_mask);
        alloc_bootmem_cpumask_var(&cpu_callout_mask);
        alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask);
 }
@@ -1598,7 +1558,6 @@ static void remove_cpu_from_maps(int cpu)
 {
        set_cpu_online(cpu, false);
        cpumask_clear_cpu(cpu, cpu_callout_mask);
-       cpumask_clear_cpu(cpu, cpu_callin_mask);
        /* was set by cpu_init() */
        cpumask_clear_cpu(cpu, cpu_initialized_mask);
        numa_remove_cpu(cpu);