From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753430AbcGSHZs (ORCPT ); Tue, 19 Jul 2016 03:25:48 -0400 Received: from terminus.zytor.com ([198.137.202.10]:46216 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753412AbcGSHZl (ORCPT ); Tue, 19 Jul 2016 03:25:41 -0400 Date: Tue, 19 Jul 2016 00:23:52 -0700 From: tip-bot for Richard Cochran Message-ID: Cc: bigeasy@linutronix.de, peterz@infradead.org, linux-kernel@vger.kernel.org, stefano.stabellini@eu.citrix.com, mingo@kernel.org, torvalds@linux-foundation.org, rcochran@linutronix.de, sstabellini@kernel.org, anna-maria@linutronix.de, tglx@linutronix.de, hpa@zytor.com, linux@armlinux.org.uk Reply-To: bigeasy@linutronix.de, peterz@infradead.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, stefano.stabellini@eu.citrix.com, mingo@kernel.org, rcochran@linutronix.de, anna-maria@linutronix.de, sstabellini@kernel.org, tglx@linutronix.de, hpa@zytor.com, linux@armlinux.org.uk In-Reply-To: <20160713153336.971559670@linutronix.de> References: <20160713153336.971559670@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] arm/xen: Convert to hotplug state machine Git-Commit-ID: 4761adb6f49048cddd65553a71ea2354b2a838be X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 4761adb6f49048cddd65553a71ea2354b2a838be Gitweb: http://git.kernel.org/tip/4761adb6f49048cddd65553a71ea2354b2a838be Author: Richard Cochran AuthorDate: Wed, 13 Jul 2016 17:16:52 +0000 Committer: Ingo Molnar CommitDate: Fri, 15 Jul 2016 10:40:28 +0200 arm/xen: Convert to hotplug state machine Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs. The get_cpu() in xen_starting_cpu() boils down to preempt_disable() since we already know the CPU we run on. Disabling preemption shouldn't be required here from what I see since it we don't switch CPUs while invoking the function. Signed-off-by: Richard Cochran Signed-off-by: Anna-Maria Gleixner Reviewed-by: Sebastian Andrzej Siewior Reviewed-by: Stefano Stabellini Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Russell King Cc: Stefano Stabellini Cc: Thomas Gleixner Cc: linux-arm-kernel@lists.infradead.org Cc: rt@linutronix.de Cc: xen-devel@lists.xenproject.org Link: http://lkml.kernel.org/r/20160713153336.971559670@linutronix.de Signed-off-by: Ingo Molnar --- arch/arm/xen/enlighten.c | 41 +++++++++++------------------------------ include/linux/cpuhotplug.h | 1 + 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 75cd734..d822e23 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -161,12 +161,11 @@ static struct notifier_block xen_pvclock_gtod_notifier = { .notifier_call = xen_pvclock_gtod_notify, }; -static void xen_percpu_init(void) +static int xen_starting_cpu(unsigned int cpu) { struct vcpu_register_vcpu_info info; struct vcpu_info *vcpup; int err; - int cpu = get_cpu(); /* * VCPUOP_register_vcpu_info cannot be called twice for the same @@ -190,7 +189,13 @@ static void xen_percpu_init(void) after_register_vcpu_info: enable_percpu_irq(xen_events_irq, 0); - put_cpu(); + return 0; +} + +static int xen_dying_cpu(unsigned int cpu) +{ + disable_percpu_irq(xen_events_irq); + return 0; } static void xen_restart(enum reboot_mode reboot_mode, const char *cmd) @@ -209,28 +214,6 @@ static void xen_power_off(void) BUG_ON(rc); } -static int xen_cpu_notification(struct notifier_block *self, - unsigned long action, - void *hcpu) -{ - switch (action) { - case CPU_STARTING: - xen_percpu_init(); - break; - case CPU_DYING: - disable_percpu_irq(xen_events_irq); - break; - default: - break; - } - - return NOTIFY_OK; -} - -static struct notifier_block xen_cpu_notifier = { - .notifier_call = xen_cpu_notification, -}; - static irqreturn_t xen_arm_callback(int irq, void *arg) { xen_hvm_evtchn_do_upcall(); @@ -351,16 +334,14 @@ static int __init xen_guest_init(void) return -EINVAL; } - xen_percpu_init(); - - register_cpu_notifier(&xen_cpu_notifier); - pv_time_ops.steal_clock = xen_stolen_accounting; static_key_slow_inc(¶virt_steal_enabled); if (xen_initial_domain()) pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier); - return 0; + return cpuhp_setup_state(CPUHP_AP_ARM_XEN_STARTING, + "AP_ARM_XEN_STARTING", xen_starting_cpu, + xen_dying_cpu); } early_initcall(xen_guest_init); diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index ad48881..4c02b52 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -47,6 +47,7 @@ enum cpuhp_state { CPUHP_AP_KVM_STARTING, CPUHP_AP_KVM_ARM_VGIC_STARTING, CPUHP_AP_KVM_ARM_TIMER_STARTING, + CPUHP_AP_ARM_XEN_STARTING, CPUHP_AP_LEDTRIG_STARTING, CPUHP_AP_NOTIFY_STARTING, CPUHP_AP_ONLINE,