From: Wei Wang Subject: [PATCH 3/9] x86/cpu_hotplug: add the unregister_cpu_notifier function to support CPU hotplug Date: Thu, 23 Apr 2015 13:59:57 +0000 (UTC) Message-ID: <1461419854-5968-1-git-send-email-wei.w.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Date: Sat, 23 Apr 2016 21:57:34 +0800 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: jbeulich@suse.com, andrew.cooper3@citrix.com, ian.campbell@citrix.com, kevin.tian@intel.com, eddie.dong@intel.com, xen-devel@lists.xen.org Cc: yang.z.zhang@intel.com, Wei Wang List-Id: xen-devel@lists.xenproject.org The unregister notifier function is needed to support cpu hotplug. Signed-off-by: Wei Wang --- xen/common/cpu.c | 7 +++++++ xen/include/xen/cpu.h | 1 + 2 files changed, 8 insertions(+) diff --git a/xen/common/cpu.c b/xen/common/cpu.c index 47e8b5b..508cee5 100644 --- a/xen/common/cpu.c +++ b/xen/common/cpu.c @@ -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(); diff --git a/xen/include/xen/cpu.h b/xen/include/xen/cpu.h index ffefc09..17a3503 100644 --- a/xen/include/xen/cpu.h +++ b/xen/include/xen/cpu.h @@ -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: -- 1.9.1