From: Keir Fraser Date: Thu, 9 Dec 2010 16:17:33 +0000 (+0000) Subject: Add CPU_STARTING notifier during CPU bringup. X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a50b1b8ddb09d109eb7b990950298bd794ae1003;p=xen.git Add CPU_STARTING notifier during CPU bringup. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/ia64/linux-xen/smpboot.c b/xen/arch/ia64/linux-xen/smpboot.c index 57454d8e7f..ba35280944 100644 --- a/xen/arch/ia64/linux-xen/smpboot.c +++ b/xen/arch/ia64/linux-xen/smpboot.c @@ -387,6 +387,7 @@ smp_callin (void) fix_b0_for_bsp(); #ifdef XEN + notify_cpu_starting(cpuid); lock_ipi_calllock(&flags); #else lock_ipi_calllock(); diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 90b4bfb56c..7f5c63339c 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -357,7 +357,8 @@ void start_secondary(void *unused) /* This must be done before setting cpu_online_map */ spin_debug_enable(); - set_cpu_sibling_map(smp_processor_id()); + set_cpu_sibling_map(cpu); + notify_cpu_starting(cpu); wmb(); /* @@ -366,8 +367,8 @@ void start_secondary(void *unused) * this lock ensures we don't half assign or remove an irq from a cpu. */ lock_vector_lock(); - __setup_vector_irq(smp_processor_id()); - cpu_set(smp_processor_id(), cpu_online_map); + __setup_vector_irq(cpu); + cpu_set(cpu, cpu_online_map); unlock_vector_lock(); init_percpu_time(); diff --git a/xen/common/cpu.c b/xen/common/cpu.c index b7bf377e00..2a248275a2 100644 --- a/xen/common/cpu.c +++ b/xen/common/cpu.c @@ -155,6 +155,14 @@ int cpu_up(unsigned int cpu) return err; } +void notify_cpu_starting(unsigned int cpu) +{ + void *hcpu = (void *)(long)cpu; + int notifier_rc = notifier_call_chain( + &cpu_chain, CPU_STARTING, hcpu, NULL); + BUG_ON(notifier_rc != NOTIFY_DONE); +} + static cpumask_t frozen_cpus; int disable_nonboot_cpus(void) diff --git a/xen/include/xen/cpu.h b/xen/include/xen/cpu.h index 78aa7773ed..ffefc09f8e 100644 --- a/xen/include/xen/cpu.h +++ b/xen/include/xen/cpu.h @@ -18,10 +18,10 @@ void register_cpu_notifier(struct notifier_block *nb); /* * Possible event sequences for a given CPU: - * CPU_UP_PREPARE -> CPU_UP_CANCELLED -- failed CPU up - * CPU_UP_PREPARE -> CPU_ONLINE -- successful CPU up - * CPU_DOWN_PREPARE -> CPU_DOWN_FAILED -- failed CPU down - * CPU_DOWN_PREPARE -> CPU_DYING -> CPU_DEAD -- successful CPU down + * CPU_UP_PREPARE -> CPU_UP_CANCELLED -- failed CPU up + * CPU_UP_PREPARE -> CPU_STARTING -> CPU_ONLINE -- successful CPU up + * CPU_DOWN_PREPARE -> CPU_DOWN_FAILED -- failed CPU down + * CPU_DOWN_PREPARE -> CPU_DYING -> CPU_DEAD -- successful CPU down * * Hence note that only CPU_*_PREPARE handlers are allowed to fail. Also note * that once CPU_DYING is delivered, an offline action can no longer fail. @@ -31,10 +31,12 @@ void register_cpu_notifier(struct notifier_block *nb); * Notifiers are called lowest-priority-first when: * (a) A CPU is going down; or (b) CPU_UP_CANCELED */ -/* CPU_UP_PREPARE: CPU is coming up */ -#define CPU_UP_PREPARE (0x0002 | NOTIFY_FORWARD) -/* CPU_UP_CANCELED: CPU is no longer coming up. */ -#define CPU_UP_CANCELED (0x0003 | NOTIFY_REVERSE) +/* CPU_UP_PREPARE: Preparing to bring CPU online. */ +#define CPU_UP_PREPARE (0x0001 | NOTIFY_FORWARD) +/* CPU_UP_CANCELED: CPU is no longer being brought online. */ +#define CPU_UP_CANCELED (0x0002 | NOTIFY_REVERSE) +/* CPU_STARTING: CPU nearly online. Runs on new CPU, irqs still disabled. */ +#define CPU_STARTING (0x0003 | NOTIFY_FORWARD) /* CPU_ONLINE: CPU is up. */ #define CPU_ONLINE (0x0004 | NOTIFY_FORWARD) /* CPU_DOWN_PREPARE: CPU is going down. */ @@ -50,6 +52,9 @@ void register_cpu_notifier(struct notifier_block *nb); int cpu_down(unsigned int cpu); int cpu_up(unsigned int cpu); +/* From arch code, send CPU_STARTING notification. */ +void notify_cpu_starting(unsigned int cpu); + /* Power management. */ int disable_nonboot_cpus(void); void enable_nonboot_cpus(void);