From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752614AbcHKPMm (ORCPT ); Thu, 11 Aug 2016 11:12:42 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:54580 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752224AbcHKPMj (ORCPT ); Thu, 11 Aug 2016 11:12:39 -0400 Date: Thu, 11 Aug 2016 17:12:34 +0200 From: Sebastian Andrzej Siewior To: Boris Ostrovsky Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, jgross@suse.com, torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, anna-maria@linutronix.de Subject: Re: [tip:smp/hotplug] cpu/hotplug: Prevent alloc/free of irq descriptors during CPU up/down (again) Message-ID: <20160811151234.nbdzzfefnvamqc3m@linutronix.de> References: <1470244948-17674-3-git-send-email-boris.ostrovsky@oracle.com> <287b42da-0388-f43e-34f7-a90935c33fa9@oracle.com> <20160811132020.bkdneatkijy7qxal@linutronix.de> <20160811141736.ce6bjtvbg4riquo2@linutronix.de> <20160811144427.j4j3n42eufomtnid@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.2-neo (2016-07-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 Cc: Boris Ostrovsky Cc: David Vrabel Signed-off-by: Sebastian Andrzej Siewior --- 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