x86/vdso: Convert to hotplug state machine
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 13 Jul 2016 17:16:03 +0000 (17:16 +0000)
committerIngo Molnar <mingo@kernel.org>
Thu, 14 Jul 2016 07:34:27 +0000 (09:34 +0200)
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Acked-by: Andy Lutomirski <luto@amacapital.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153332.987560239@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/entry/vdso/vma.c
include/linux/cpuhotplug.h

index ab220ac9b3b98f8eaeae4e9672d3e92a473b03f1..25b0368de7f6752e4758f664417d8c7b8e52259e 100644 (file)
@@ -294,15 +294,9 @@ static void vgetcpu_cpu_init(void *arg)
        write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S);
 }
 
-static int
-vgetcpu_cpu_notifier(struct notifier_block *n, unsigned long action, void *arg)
+static int vgetcpu_online(unsigned int cpu)
 {
-       long cpu = (long)arg;
-
-       if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN)
-               smp_call_function_single(cpu, vgetcpu_cpu_init, NULL, 1);
-
-       return NOTIFY_DONE;
+       return smp_call_function_single(cpu, vgetcpu_cpu_init, NULL, 1);
 }
 
 static int __init init_vdso(void)
@@ -313,15 +307,9 @@ static int __init init_vdso(void)
        init_vdso_image(&vdso_image_x32);
 #endif
 
-       cpu_notifier_register_begin();
-
-       on_each_cpu(vgetcpu_cpu_init, NULL, 1);
        /* notifier priority > KVM */
-       __hotcpu_notifier(vgetcpu_cpu_notifier, 30);
-
-       cpu_notifier_register_done();
-
-       return 0;
+       return cpuhp_setup_state(CPUHP_AP_X86_VDSO_VMA_ONLINE,
+                                "AP_X86_VDSO_VMA_ONLINE", vgetcpu_online, NULL);
 }
 subsys_initcall(init_vdso);
 #endif /* CONFIG_X86_64 */
index 386374d19987449727ceb06f5d1cd138884d702c..fe056408335eb66e013327c0a1c755fe7b8c836e 100644 (file)
@@ -14,6 +14,7 @@ enum cpuhp_state {
        CPUHP_TEARDOWN_CPU,
        CPUHP_AP_ONLINE_IDLE,
        CPUHP_AP_SMPBOOT_THREADS,
+       CPUHP_AP_X86_VDSO_VMA_ONLINE,
        CPUHP_AP_NOTIFY_ONLINE,
        CPUHP_AP_ONLINE_DYN,
        CPUHP_AP_ONLINE_DYN_END         = CPUHP_AP_ONLINE_DYN + 30,