x86/smpboot: Remove wait for cpu_online()
authorThomas Gleixner <tglx@linutronix.de>
Fri, 12 May 2023 21:07:22 +0000 (23:07 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 15 May 2023 11:44:54 +0000 (13:44 +0200)
Now that the core code drops sparse_irq_lock after the idle thread
synchronized, it's pointless to wait for the AP to mark itself online.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Michael Kelley <mikelley@microsoft.com>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Tested-by: Helge Deller <deller@gmx.de> # parisc
Tested-by: Guilherme G. Piccoli <gpiccoli@igalia.com> # Steam Deck
Link: https://lore.kernel.org/r/20230512205256.316417181@linutronix.de
arch/x86/kernel/smpboot.c

index 3f731beb4d3fc8a9c19c727e21f0cb9421e7a29f..4349e8ab2566ce9baca5650b5da5bc4b0bd92c21 100644 (file)
@@ -275,7 +275,6 @@ static void notrace start_secondary(void *unused)
         * half valid vector space.
         */
        lock_vector_lock();
-       /* Sync point with do_wait_cpu_online() */
        set_cpu_online(smp_processor_id(), true);
        lapic_online();
        unlock_vector_lock();
@@ -1104,20 +1103,6 @@ static int wait_cpu_initialized(unsigned int cpu)
        return 0;
 }
 
-/*
- * Bringup step three: Wait for the target AP to reach set_cpu_online() in
- * start_secondary().
- */
-static void wait_cpu_online(unsigned int cpu)
-{
-       /*
-        * Wait for the AP to mark itself online, so the core caller
-        * can drop sparse_irq_lock.
-        */
-       while (!cpu_online(cpu))
-               schedule();
-}
-
 static int native_kick_ap(unsigned int cpu, struct task_struct *tidle)
 {
        int apicid = apic->cpu_present_to_apicid(cpu);
@@ -1164,16 +1149,9 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
        int ret;
 
        ret = native_kick_ap(cpu, tidle);
-       if (ret)
-               goto out;
-
-       ret = wait_cpu_initialized(cpu);
-       if (ret)
-               goto out;
-
-       wait_cpu_online(cpu);
+       if (!ret)
+               ret = wait_cpu_initialized(cpu);
 
-out:
        /* Cleanup possible dangling ends... */
        if (x86_platform.legacy.warm_reset)
                smpboot_restore_warm_reset_vector();