On 2016-08-11 11:06:29 [-0400], Boris Ostrovsky wrote:
> I was actually looking for arch/x86/xen/enlighten.c patch but if you
> don't have it I can do it myself.

I'm sorry. I had it but it got removed by accident during the refresh.
This is an older version so you have an idea :)

From: Sebastian Andrzej Siewior <[email protected]>
Date: Wed, 4 Nov 2015 21:06:01 +0100
Subject: [PATCH] x86: xen: Convert to hotplug state machine

Install the callbacks via the state machine.

Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Boris Ostrovsky <[email protected]>
Cc: David Vrabel <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
---
 arch/x86/xen/enlighten.c   |   28 +++++++++-------------------
 include/linux/cpuhotplug.h |    1 +
 2 files changed, 10 insertions(+), 19 deletions(-)

--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1802,28 +1802,16 @@ static void __init init_hvm_pv_info(void
        xen_domain_type = XEN_HVM_DOMAIN;
 }
 
-static int xen_hvm_cpu_notify(struct notifier_block *self, unsigned long 
action,
-                             void *hcpu)
+static int xen_hvm_cpu_up_prepare(unsigned int cpu)
 {
-       int cpu = (long)hcpu;
-       switch (action) {
-       case CPU_UP_PREPARE:
-               xen_vcpu_setup(cpu);
-               if (xen_have_vector_callback) {
-                       if (xen_feature(XENFEAT_hvm_safe_pvclock))
-                               xen_setup_timer(cpu);
-               }
-               break;
-       default:
-               break;
+       xen_vcpu_setup(cpu);
+       if (xen_have_vector_callback) {
+               if (xen_feature(XENFEAT_hvm_safe_pvclock))
+                       xen_setup_timer(cpu);
        }
-       return NOTIFY_OK;
+       return 0;
 }
 
-static struct notifier_block xen_hvm_cpu_notifier = {
-       .notifier_call  = xen_hvm_cpu_notify,
-};
-
 #ifdef CONFIG_KEXEC_CORE
 static void xen_hvm_shutdown(void)
 {
@@ -1853,7 +1841,9 @@ static void __init xen_hvm_guest_init(vo
        if (xen_feature(XENFEAT_hvm_callback_vector))
                xen_have_vector_callback = 1;
        xen_hvm_smp_init();
-       register_cpu_notifier(&xen_hvm_cpu_notifier);
+       cpuhp_setup_state_nocalls(CPUHP_XEN_HVM_GUEST_PREPARE,
+                                 "XEN_HVM_GUEST_PREPARE",
+                                 xen_hvm_cpu_up_prepare, NULL);
        xen_unplug_emulated_devices();
        x86_init.irqs.intr_init = xen_init_IRQ;
        xen_hvm_init_time_ops();
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -24,6 +24,7 @@ enum cpuhp_state {
        CPUHP_RELAY_PREPARE,
        CPUHP_SLAB_PREPARE,
        CPUHP_XEN_EV_PREPEARE,
+       CPUHP_XEN_HVM_GUEST_PREPARE,
        CPUHP_MD_RAID5_PREPARE,
        CPUHP_CPUIDLE_COUPLED_PREPARE,
        CPUHP_TIMERS_DEAD,

Sebastian

Reply via email to