[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Add CPU_STARTING notifier during CPU bringup.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1291911453 0
# Node ID 49d2aa5cee4ecc2411d8d638e4ee32c10e9b2761
# Parent  a04430925a8bc6595df7b8a304c0b4da3f47c7c2
Add CPU_STARTING notifier during CPU bringup.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/arch/ia64/linux-xen/smpboot.c |    1 +
 xen/arch/x86/smpboot.c            |    7 ++++---
 xen/common/cpu.c                  |    8 ++++++++
 xen/include/xen/cpu.h             |   21 +++++++++++++--------
 4 files changed, 26 insertions(+), 11 deletions(-)

diff -r a04430925a8b -r 49d2aa5cee4e xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c Thu Dec 09 16:15:10 2010 +0000
+++ b/xen/arch/ia64/linux-xen/smpboot.c Thu Dec 09 16:17:33 2010 +0000
@@ -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 -r a04430925a8b -r 49d2aa5cee4e xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Thu Dec 09 16:15:10 2010 +0000
+++ b/xen/arch/x86/smpboot.c    Thu Dec 09 16:17:33 2010 +0000
@@ -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 -r a04430925a8b -r 49d2aa5cee4e xen/common/cpu.c
--- a/xen/common/cpu.c  Thu Dec 09 16:15:10 2010 +0000
+++ b/xen/common/cpu.c  Thu Dec 09 16:17:33 2010 +0000
@@ -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 -r a04430925a8b -r 49d2aa5cee4e xen/include/xen/cpu.h
--- a/xen/include/xen/cpu.h     Thu Dec 09 16:15:10 2010 +0000
+++ b/xen/include/xen/cpu.h     Thu Dec 09 16:17:33 2010 +0000
@@ -18,10 +18,10 @@ void register_cpu_notifier(struct notifi
 
 /*
  * 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 notifi
  * 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 @@ int cpu_down(unsigned int cpu);
 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);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.