From: Dou Liyang <douly.fnst@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>, <x86@kernel.org>,
<xen-devel@lists.xenproject.org>
Cc: <tglx@linutronix.de>, <mingo@redhat.com>, <hpa@zytor.com>,
<jgross@suse.com>, <boris.ostrovsky@oracle.com>, <bp@suse.de>,
<luto@kernel.org>, <vkuznets@redhat.com>,
Dou Liyang <douly.fnst@cn.fujitsu.com>
Subject: [PATCH tip v2] x86/paravirt: Make the virt_spin_lock_key setup after jump_label_init()
Date: Sat, 28 Oct 2017 14:06:44 +0800 [thread overview]
Message-ID: <1509170804-3813-1-git-send-email-douly.fnst@cn.fujitsu.com> (raw)
Commit:
9043442b43b1 ("locking/paravirt: Use new static key for controlling
call of virt_spin_lock()")
set the static virt_spin_lock_key to a value before jump_label_init()
has been called, which will result in a WARN().
Move the native_pv_lock_init() into native_smp_prepare_cpus(), and set
the value in xen_init_lock_cpu() to make the setup later and avoid the
WARN().
Reported-by: Juergen Gross <jgross@suse.com>
Suggested-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
---
changelog:
v1-->v2: remove the native_pv_lock_init() from xen_pv_smp_prepare_cpus(),
It is redundant, suggested by Juergen.
---
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 aed1460..6b1335a 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1323,6 +1323,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();
@@ -1350,7 +1352,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");
--
2.5.5
next reply other threads:[~2017-10-28 6:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-28 6:06 Dou Liyang [this message]
2017-10-30 11:25 ` [tip:locking/core] x86/paravirt: Set up the virt_spin_lock_key after static keys get initialized tip-bot for Dou Liyang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1509170804-3813-1-git-send-email-douly.fnst@cn.fujitsu.com \
--to=douly.fnst@cn.fujitsu.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®