Skip to contentSkip to conversation

x86/cpu_hotplug: add the unregister_cpu_notifier function to support CPU hotplug

PATCH In review Wei Wang 2 participants 4 messages May 13, 2015 – May 28, 2015

lore
Share & tools
lore

Wei Wang

author
#0 lore raw

PATCH v2 3/9 x86/cpu_hotplug: add the unregister_cpu_notifier function to support CPU hotplug

The unregister notifier function is needed to support cpu hotplug.

---
 xen/common/cpu.c      | 7 +++++++
 xen/include/xen/cpu.h | 1 +
 2 files changed, 8 insertions(+)
xen/common/cpu.c +7 -0
index 47e8b5b..508cee5 100644
@@ -68,6 +68,13 @@ void __init register_cpu_notifier(struct notifier_block *nb)
     spin_unlock(&cpu_add_remove_lock);
 }
 
+void __init unregister_cpu_notifier(struct notifier_block *nb) {
+    if ( !spin_trylock(&cpu_add_remove_lock) )
+        BUG();
+    notifier_chain_unregister(&cpu_chain, nb);
+    spin_unlock(&cpu_add_remove_lock);
+}
+
 static int take_cpu_down(void *unused)
 {
     void *hcpu = (void *)(long)smp_processor_id();
xen/include/xen/cpu.h +1 -0
index ffefc09..17a3503 100644
@@ -15,6 +15,7 @@ void cpu_hotplug_done(void);
 
 /* Receive notification of CPU hotplug events. */
 void register_cpu_notifier(struct notifier_block *nb);
+void unregister_cpu_notifier(struct notifier_block *nb);
 
 /*
  * Possible event sequences for a given CPU:
Signature · 1 line
1.9.1
#1 lore raw
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 13.05.16 at 09:50, <[email protected]> wrote:

The unregister notifier function is needed to support cpu hotplug.

Without loadable module support I have some difficulty seeing why this should be needed.

Jan

#2 lore raw

On 26/05/2015 20:51, Jan Beulich wrote

Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 13.05.16 at 09:50, <[email protected]> wrote:

The unregister notifier function is needed to support cpu hotplug.

Without loadable module support I have some difficulty seeing why this should be needed.

Ok. Then, should we remove the entire cpufreq_unregister_driver() function (the unregister notifier function is invoked inside)? Because there is also no chance to unregister the driver.

Best,
Wei

#3 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 28.05.15 at 11:26, <[email protected]> wrote:

On 26/05/2015 20:51, Jan Beulich wrote

Quoted 3 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 13.05.16 at 09:50, <[email protected]> wrote:

The unregister notifier function is needed to support cpu hotplug.

Quoted 7 lines
Quoted 3 lines

Without loadable module support I have some difficulty seeing why this should be needed.

Ok. Then, should we remove the entire cpufreq_unregister_driver() function (the unregister notifier function is invoked inside)? Because there is also no chance to unregister the driver.

Sure - it looks to be unused at present anyway.

Jan