From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753097AbdJ3L3z (ORCPT ); Mon, 30 Oct 2017 07:29:55 -0400 Received: from terminus.zytor.com ([65.50.211.136]:46769 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752587AbdJ3L3w (ORCPT ); Mon, 30 Oct 2017 07:29:52 -0400 Date: Mon, 30 Oct 2017 04:25:15 -0700 From: tip-bot for Dou Liyang Message-ID: Cc: mingo@kernel.org, hpa@zytor.com, jgross@suse.com, torvalds@linux-foundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, douly.fnst@cn.fujitsu.com Reply-To: jgross@suse.com, torvalds@linux-foundation.org, tglx@linutronix.de, hpa@zytor.com, mingo@kernel.org, douly.fnst@cn.fujitsu.com, linux-kernel@vger.kernel.org, peterz@infradead.org In-Reply-To: <1509170804-3813-1-git-send-email-douly.fnst@cn.fujitsu.com> References: <1509170804-3813-1-git-send-email-douly.fnst@cn.fujitsu.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] x86/paravirt: Set up the virt_spin_lock_key after static keys get initialized Git-Commit-ID: ca5d376e17072c1b60c3fee66f3be58ef018952d 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: ca5d376e17072c1b60c3fee66f3be58ef018952d Gitweb: https://git.kernel.org/tip/ca5d376e17072c1b60c3fee66f3be58ef018952d Author: Dou Liyang AuthorDate: Sat, 28 Oct 2017 14:06:44 +0800 Committer: Ingo Molnar CommitDate: Mon, 30 Oct 2017 09:17:29 +0100 x86/paravirt: Set up the virt_spin_lock_key after static keys get initialized Commit: 9043442b43b1 ("locking/paravirt: Use new static key for controlling call of virt_spin_lock()") sets the static virt_spin_lock_key to a value before jump_label_init() has been called, which will result in a WARN(). Reorder the initialization sequence: - Move the native_pv_lock_init() into native_smp_prepare_cpus() - set the value in xen_init_lock_cpu() to avoid calling into the not yet initialized static keys subsystem. Suggested-by: Juergen Gross Reported-by: Juergen Gross Signed-off-by: Dou Liyang Reviewed-by: Juergen Gross Acked-by: Thomas Gleixner Cc: Linus Torvalds Cc: Peter Zijlstra Cc: boris.ostrovsky@oracle.com Cc: bp@suse.de Cc: luto@kernel.org Cc: vkuznets@redhat.com Cc: xen-devel@lists.xenproject.org Link: http://lkml.kernel.org/r/1509170804-3813-1-git-send-email-douly.fnst@cn.fujitsu.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/smpboot.c | 3 ++- arch/x86/xen/spinlock.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 361f916..198416d 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1358,6 +1358,8 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) pr_info("CPU0: "); print_cpu_info(&cpu_data(0)); + native_pv_lock_init(); + uv_system_init(); set_mtrr_aps_delayed_init(); @@ -1385,7 +1387,6 @@ void __init native_smp_prepare_boot_cpu(void) /* already set me in cpu_online_mask in boot_cpu_init() */ cpumask_set_cpu(me, cpu_callout_mask); cpu_set_state_online(me); - native_pv_lock_init(); } void __init native_smp_cpus_done(unsigned int max_cpus) diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c index e8ab80a..1e1462d 100644 --- a/arch/x86/xen/spinlock.c +++ b/arch/x86/xen/spinlock.c @@ -81,8 +81,11 @@ void xen_init_lock_cpu(int cpu) int irq; char *name; - if (!xen_pvspin) + if (!xen_pvspin) { + if (cpu == 0) + static_branch_disable(&virt_spin_lock_key); return; + } WARN(per_cpu(lock_kicker_irq, cpu) >= 0, "spinlock on CPU%d exists on IRQ%d!\n", cpu, per_cpu(lock_kicker_irq, cpu)); @@ -130,7 +133,6 @@ void __init xen_init_spinlocks(void) if (!xen_pvspin) { printk(KERN_DEBUG "xen: PV spinlocks disabled\n"); - static_branch_disable(&virt_spin_lock_key); return; } printk(KERN_DEBUG "xen: PV spinlocks enabled\n");