From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752870AbcHQIe1 (ORCPT ); Wed, 17 Aug 2016 04:34:27 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:40276 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751139AbcHQIeQ (ORCPT ); Wed, 17 Aug 2016 04:34:16 -0400 Date: Wed, 17 Aug 2016 10:33:09 +0200 From: Sebastian Andrzej Siewior To: Boris Ostrovsky Cc: david.vrabel@citrix.com, jgross@suse.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] xen/x86: Convert to hotplug state machine Message-ID: <20160817083309.fmkksdchqexaxncz@linutronix.de> References: <1471272407-4292-1-git-send-email-boris.ostrovsky@oracle.com> <1471272407-4292-2-git-send-email-boris.ostrovsky@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1471272407-4292-2-git-send-email-boris.ostrovsky@oracle.com> 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-15 10:46:46 [-0400], Boris Ostrovsky wrote: > Switch to new CPU hotplug infrastructure. > > Signed-off-by: Boris Ostrovsky > Suggested-by: Sebastian Andrzej Siewior > --- > arch/x86/xen/enlighten.c | 115 +++++++++++++++++++++++++------------------- > include/linux/cpuhotplug.h | 2 + > 2 files changed, 67 insertions(+), 50 deletions(-) > > diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c > index c7f6b1f..2283976 100644 > --- a/arch/x86/xen/enlighten.c > +++ b/arch/x86/xen/enlighten.c > @@ -1541,6 +1543,24 @@ static void __init xen_dom0_set_legacy_features(void) > x86_platform.legacy.rtc = 1; > } > > +static int xen_cpuhp_setup(void) > +{ > + int rc; > + > + rc = cpuhp_setup_state_nocalls(CPUHP_XEN_PREPARE, > + "XEN_HVM_GUEST_PREPARE", > + xen_cpu_up_prepare, xen_cpu_up_cancel); The old states UP_CANCEL is different from UP_PREPARE. The latter was invoked only in the error case while your new callback is always invoked. From looking at the code you free memory in xen_cpu_up_cancel() which was allocated in xen_cpu_up_prepare() and therefore I would name it xen_cpu_dead(). If you do find the time, you might manage to rework the code to avoid using the _nocalls() function. If see this right, you use xen_setup_vcpu_info_placement() for the init in the first place. This uses for_each_possible_cpu macro. The cpuhp_setup_state() function would perform the init for all CPUs before they come up. > + if (!rc) { > + rc = cpuhp_setup_state_nocalls(CPUHP_AP_XEN_ONLINE, If there is no need to run this after KVM's CLK callback please use CPUHP_AP_ONLINE_DYN. If there is such a need then please document it. > + "XEN_HVM_GUEST_PREPARE", > + xen_cpu_up_online, NULL); > + if (rc) > + cpuhp_remove_state_nocalls(CPUHP_XEN_PREPARE); > + } > + > + return rc; > +} > + > /* First C function to be called on Xen boot */ > asmlinkage __visible void __init xen_start_kernel(void) > { Sebastian