All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] guard virt_spin_lock() with a static key
@ 2017-09-06 17:36 ` Juergen Gross
  0 siblings, 0 replies; 19+ messages in thread
From: Juergen Gross @ 2017-09-06 17:36 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: jeremy, chrisw, akataria, rusty, boris.ostrovsky, hpa, tglx,
	mingo, peterz, longman, Juergen Gross

With virt_spin_lock() being guarded by a static key the bare metal case
can be optimized by patching the call away completely. In case a kernel
running as a guest it can decide whether to use paravitualized
spinlocks, the current fallback to the unfair test-and-set scheme, or
to mimic the bare metal behavior.

V3:
- remove test for hypervisor environment from virt_spin_lock(9 as
  suggested by Waiman Long

V2:
- use static key instead of making virt_spin_lock() a pvops function

Juergen Gross (2):
  paravirt/locks: use new static key for controlling call of
    virt_spin_lock()
  paravirt,xen: correct xen_nopvspin case

 arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
 arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
 arch/x86/kernel/smpboot.c            |  2 ++
 arch/x86/xen/spinlock.c              |  2 ++
 kernel/locking/qspinlock.c           |  4 ++++
 5 files changed, 24 insertions(+), 1 deletion(-)

-- 
2.12.3

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v3 0/2] guard virt_spin_lock() with a static key
@ 2017-09-06 17:36 ` Juergen Gross
  0 siblings, 0 replies; 19+ messages in thread
From: Juergen Gross @ 2017-09-06 17:36 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: Juergen Gross, jeremy, peterz, chrisw, mingo, tglx, hpa, longman,
	akataria, boris.ostrovsky

With virt_spin_lock() being guarded by a static key the bare metal case
can be optimized by patching the call away completely. In case a kernel
running as a guest it can decide whether to use paravitualized
spinlocks, the current fallback to the unfair test-and-set scheme, or
to mimic the bare metal behavior.

V3:
- remove test for hypervisor environment from virt_spin_lock(9 as
  suggested by Waiman Long

V2:
- use static key instead of making virt_spin_lock() a pvops function

Juergen Gross (2):
  paravirt/locks: use new static key for controlling call of
    virt_spin_lock()
  paravirt,xen: correct xen_nopvspin case

 arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
 arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
 arch/x86/kernel/smpboot.c            |  2 ++
 arch/x86/xen/spinlock.c              |  2 ++
 kernel/locking/qspinlock.c           |  4 ++++
 5 files changed, 24 insertions(+), 1 deletion(-)

-- 
2.12.3

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v3 1/2] paravirt/locks: use new static key for controlling call of virt_spin_lock()
  2017-09-06 17:36 ` Juergen Gross
                   ` (2 preceding siblings ...)
  (?)
@ 2017-09-06 17:36 ` Juergen Gross
  2017-10-10 11:03   ` [tip:locking/core] locking/paravirt: Use " tip-bot for Juergen Gross
  -1 siblings, 1 reply; 19+ messages in thread
From: Juergen Gross @ 2017-09-06 17:36 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: jeremy, chrisw, akataria, rusty, boris.ostrovsky, hpa, tglx,
	mingo, peterz, longman, Juergen Gross

There are cases where a guest tries to switch spinlocks to bare metal
behavior (e.g. by setting "xen_nopvspin" boot parameter). Today this
has the downside of falling back to unfair test and set scheme for
qspinlocks due to virt_spin_lock() detecting the virtualized
environment.

Add a static key controlling whether virt_spin_lock() should be
called or not. When running on bare metal set the new key to false.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
 arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
 arch/x86/kernel/smpboot.c            |  2 ++
 kernel/locking/qspinlock.c           |  4 ++++
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h
index 48a706f641f2..308dfd0714c7 100644
--- a/arch/x86/include/asm/qspinlock.h
+++ b/arch/x86/include/asm/qspinlock.h
@@ -1,6 +1,7 @@
 #ifndef _ASM_X86_QSPINLOCK_H
 #define _ASM_X86_QSPINLOCK_H
 
+#include <linux/jump_label.h>
 #include <asm/cpufeature.h>
 #include <asm-generic/qspinlock_types.h>
 #include <asm/paravirt.h>
@@ -46,10 +47,14 @@ static inline void queued_spin_unlock(struct qspinlock *lock)
 #endif
 
 #ifdef CONFIG_PARAVIRT
+DECLARE_STATIC_KEY_TRUE(virt_spin_lock_key);
+
+void native_pv_lock_init(void) __init;
+
 #define virt_spin_lock virt_spin_lock
 static inline bool virt_spin_lock(struct qspinlock *lock)
 {
-	if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
+	if (!static_branch_likely(&virt_spin_lock_key))
 		return false;
 
 	/*
@@ -65,6 +70,10 @@ static inline bool virt_spin_lock(struct qspinlock *lock)
 
 	return true;
 }
+#else
+static inline void native_pv_lock_init(void)
+{
+}
 #endif /* CONFIG_PARAVIRT */
 
 #include <asm-generic/qspinlock.h>
diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c
index 8f2d1c9d43a8..2fc65ddea40d 100644
--- a/arch/x86/kernel/paravirt-spinlocks.c
+++ b/arch/x86/kernel/paravirt-spinlocks.c
@@ -42,3 +42,9 @@ struct pv_lock_ops pv_lock_ops = {
 #endif /* SMP */
 };
 EXPORT_SYMBOL(pv_lock_ops);
+
+void __init native_pv_lock_init(void)
+{
+	if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
+		static_branch_disable(&virt_spin_lock_key);
+}
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 54b9e89d4d6b..21500d3ba359 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -77,6 +77,7 @@
 #include <asm/i8259.h>
 #include <asm/realmode.h>
 #include <asm/misc.h>
+#include <asm/qspinlock.h>
 
 /* Number of siblings per CPU package */
 int smp_num_siblings = 1;
@@ -1381,6 +1382,7 @@ 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/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index 294294c71ba4..838d235b87ef 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -76,6 +76,10 @@
 #define MAX_NODES	4
 #endif
 
+#ifdef CONFIG_PARAVIRT
+DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key);
+#endif
+
 /*
  * Per-CPU queue node structures; we can never have more than 4 nested
  * contexts: task, softirq, hardirq, nmi.
-- 
2.12.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 1/2] paravirt/locks: use new static key for controlling call of virt_spin_lock()
  2017-09-06 17:36 ` Juergen Gross
  (?)
  (?)
@ 2017-09-06 17:36 ` Juergen Gross
  -1 siblings, 0 replies; 19+ messages in thread
From: Juergen Gross @ 2017-09-06 17:36 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: Juergen Gross, jeremy, peterz, chrisw, mingo, tglx, hpa, longman,
	akataria, boris.ostrovsky

There are cases where a guest tries to switch spinlocks to bare metal
behavior (e.g. by setting "xen_nopvspin" boot parameter). Today this
has the downside of falling back to unfair test and set scheme for
qspinlocks due to virt_spin_lock() detecting the virtualized
environment.

Add a static key controlling whether virt_spin_lock() should be
called or not. When running on bare metal set the new key to false.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
 arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
 arch/x86/kernel/smpboot.c            |  2 ++
 kernel/locking/qspinlock.c           |  4 ++++
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h
index 48a706f641f2..308dfd0714c7 100644
--- a/arch/x86/include/asm/qspinlock.h
+++ b/arch/x86/include/asm/qspinlock.h
@@ -1,6 +1,7 @@
 #ifndef _ASM_X86_QSPINLOCK_H
 #define _ASM_X86_QSPINLOCK_H
 
+#include <linux/jump_label.h>
 #include <asm/cpufeature.h>
 #include <asm-generic/qspinlock_types.h>
 #include <asm/paravirt.h>
@@ -46,10 +47,14 @@ static inline void queued_spin_unlock(struct qspinlock *lock)
 #endif
 
 #ifdef CONFIG_PARAVIRT
+DECLARE_STATIC_KEY_TRUE(virt_spin_lock_key);
+
+void native_pv_lock_init(void) __init;
+
 #define virt_spin_lock virt_spin_lock
 static inline bool virt_spin_lock(struct qspinlock *lock)
 {
-	if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
+	if (!static_branch_likely(&virt_spin_lock_key))
 		return false;
 
 	/*
@@ -65,6 +70,10 @@ static inline bool virt_spin_lock(struct qspinlock *lock)
 
 	return true;
 }
+#else
+static inline void native_pv_lock_init(void)
+{
+}
 #endif /* CONFIG_PARAVIRT */
 
 #include <asm-generic/qspinlock.h>
diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c
index 8f2d1c9d43a8..2fc65ddea40d 100644
--- a/arch/x86/kernel/paravirt-spinlocks.c
+++ b/arch/x86/kernel/paravirt-spinlocks.c
@@ -42,3 +42,9 @@ struct pv_lock_ops pv_lock_ops = {
 #endif /* SMP */
 };
 EXPORT_SYMBOL(pv_lock_ops);
+
+void __init native_pv_lock_init(void)
+{
+	if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
+		static_branch_disable(&virt_spin_lock_key);
+}
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 54b9e89d4d6b..21500d3ba359 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -77,6 +77,7 @@
 #include <asm/i8259.h>
 #include <asm/realmode.h>
 #include <asm/misc.h>
+#include <asm/qspinlock.h>
 
 /* Number of siblings per CPU package */
 int smp_num_siblings = 1;
@@ -1381,6 +1382,7 @@ 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/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index 294294c71ba4..838d235b87ef 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -76,6 +76,10 @@
 #define MAX_NODES	4
 #endif
 
+#ifdef CONFIG_PARAVIRT
+DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key);
+#endif
+
 /*
  * Per-CPU queue node structures; we can never have more than 4 nested
  * contexts: task, softirq, hardirq, nmi.
-- 
2.12.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 1/2] paravirt/locks: use new static key for controlling call of virt_spin_lock()
  2017-09-06 17:36 ` Juergen Gross
  (?)
@ 2017-09-06 17:36 ` Juergen Gross
  -1 siblings, 0 replies; 19+ messages in thread
From: Juergen Gross @ 2017-09-06 17:36 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: Juergen Gross, jeremy, peterz, rusty, chrisw, mingo, tglx, hpa,
	longman, akataria, boris.ostrovsky

There are cases where a guest tries to switch spinlocks to bare metal
behavior (e.g. by setting "xen_nopvspin" boot parameter). Today this
has the downside of falling back to unfair test and set scheme for
qspinlocks due to virt_spin_lock() detecting the virtualized
environment.

Add a static key controlling whether virt_spin_lock() should be
called or not. When running on bare metal set the new key to false.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
 arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
 arch/x86/kernel/smpboot.c            |  2 ++
 kernel/locking/qspinlock.c           |  4 ++++
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h
index 48a706f641f2..308dfd0714c7 100644
--- a/arch/x86/include/asm/qspinlock.h
+++ b/arch/x86/include/asm/qspinlock.h
@@ -1,6 +1,7 @@
 #ifndef _ASM_X86_QSPINLOCK_H
 #define _ASM_X86_QSPINLOCK_H
 
+#include <linux/jump_label.h>
 #include <asm/cpufeature.h>
 #include <asm-generic/qspinlock_types.h>
 #include <asm/paravirt.h>
@@ -46,10 +47,14 @@ static inline void queued_spin_unlock(struct qspinlock *lock)
 #endif
 
 #ifdef CONFIG_PARAVIRT
+DECLARE_STATIC_KEY_TRUE(virt_spin_lock_key);
+
+void native_pv_lock_init(void) __init;
+
 #define virt_spin_lock virt_spin_lock
 static inline bool virt_spin_lock(struct qspinlock *lock)
 {
-	if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
+	if (!static_branch_likely(&virt_spin_lock_key))
 		return false;
 
 	/*
@@ -65,6 +70,10 @@ static inline bool virt_spin_lock(struct qspinlock *lock)
 
 	return true;
 }
+#else
+static inline void native_pv_lock_init(void)
+{
+}
 #endif /* CONFIG_PARAVIRT */
 
 #include <asm-generic/qspinlock.h>
diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c
index 8f2d1c9d43a8..2fc65ddea40d 100644
--- a/arch/x86/kernel/paravirt-spinlocks.c
+++ b/arch/x86/kernel/paravirt-spinlocks.c
@@ -42,3 +42,9 @@ struct pv_lock_ops pv_lock_ops = {
 #endif /* SMP */
 };
 EXPORT_SYMBOL(pv_lock_ops);
+
+void __init native_pv_lock_init(void)
+{
+	if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
+		static_branch_disable(&virt_spin_lock_key);
+}
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 54b9e89d4d6b..21500d3ba359 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -77,6 +77,7 @@
 #include <asm/i8259.h>
 #include <asm/realmode.h>
 #include <asm/misc.h>
+#include <asm/qspinlock.h>
 
 /* Number of siblings per CPU package */
 int smp_num_siblings = 1;
@@ -1381,6 +1382,7 @@ 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/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index 294294c71ba4..838d235b87ef 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -76,6 +76,10 @@
 #define MAX_NODES	4
 #endif
 
+#ifdef CONFIG_PARAVIRT
+DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key);
+#endif
+
 /*
  * Per-CPU queue node structures; we can never have more than 4 nested
  * contexts: task, softirq, hardirq, nmi.
-- 
2.12.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 2/2] paravirt,xen: correct xen_nopvspin case
  2017-09-06 17:36 ` Juergen Gross
@ 2017-09-06 17:36   ` Juergen Gross
  -1 siblings, 0 replies; 19+ messages in thread
From: Juergen Gross @ 2017-09-06 17:36 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: jeremy, chrisw, akataria, rusty, boris.ostrovsky, hpa, tglx,
	mingo, peterz, longman, Juergen Gross

With the boot parameter "xen_nopvspin" specified a Xen guest should not
make use of paravirt spinlocks, but behave as if running on bare
metal. This is not true, however, as the qspinlock code will fall back
to a test-and-set scheme when it is detecting a hypervisor.

In order to avoid this disable the virt_spin_lock_key.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/spinlock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 25a7c4302ce7..e8ab80ad7a6f 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -10,6 +10,7 @@
 #include <linux/slab.h>
 
 #include <asm/paravirt.h>
+#include <asm/qspinlock.h>
 
 #include <xen/interface/xen.h>
 #include <xen/events.h>
@@ -129,6 +130,7 @@ 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.12.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 2/2] paravirt,xen: correct xen_nopvspin case
@ 2017-09-06 17:36   ` Juergen Gross
  0 siblings, 0 replies; 19+ messages in thread
From: Juergen Gross @ 2017-09-06 17:36 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: Juergen Gross, jeremy, peterz, chrisw, mingo, tglx, hpa, longman,
	akataria, boris.ostrovsky

With the boot parameter "xen_nopvspin" specified a Xen guest should not
make use of paravirt spinlocks, but behave as if running on bare
metal. This is not true, however, as the qspinlock code will fall back
to a test-and-set scheme when it is detecting a hypervisor.

In order to avoid this disable the virt_spin_lock_key.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/spinlock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 25a7c4302ce7..e8ab80ad7a6f 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -10,6 +10,7 @@
 #include <linux/slab.h>
 
 #include <asm/paravirt.h>
+#include <asm/qspinlock.h>
 
 #include <xen/interface/xen.h>
 #include <xen/events.h>
@@ -129,6 +130,7 @@ 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.12.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 2/2] paravirt, xen: correct xen_nopvspin case
  2017-09-06 17:36 ` Juergen Gross
                   ` (3 preceding siblings ...)
  (?)
@ 2017-09-06 17:36 ` Juergen Gross
  -1 siblings, 0 replies; 19+ messages in thread
From: Juergen Gross @ 2017-09-06 17:36 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: Juergen Gross, jeremy, peterz, rusty, chrisw, mingo, tglx, hpa,
	longman, akataria, boris.ostrovsky

With the boot parameter "xen_nopvspin" specified a Xen guest should not
make use of paravirt spinlocks, but behave as if running on bare
metal. This is not true, however, as the qspinlock code will fall back
to a test-and-set scheme when it is detecting a hypervisor.

In order to avoid this disable the virt_spin_lock_key.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/spinlock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 25a7c4302ce7..e8ab80ad7a6f 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -10,6 +10,7 @@
 #include <linux/slab.h>
 
 #include <asm/paravirt.h>
+#include <asm/qspinlock.h>
 
 #include <xen/interface/xen.h>
 #include <xen/events.h>
@@ -129,6 +130,7 @@ 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.12.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 0/2] guard virt_spin_lock() with a static key
  2017-09-06 17:36 ` Juergen Gross
                   ` (6 preceding siblings ...)
  (?)
@ 2017-09-25 13:59 ` Juergen Gross
  2017-09-25 14:44   ` Waiman Long
                     ` (2 more replies)
  -1 siblings, 3 replies; 19+ messages in thread
From: Juergen Gross @ 2017-09-25 13:59 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: jeremy, chrisw, akataria, rusty, boris.ostrovsky, hpa, tglx,
	mingo, peterz, longman

Ping?

On 06/09/17 19:36, Juergen Gross wrote:
> With virt_spin_lock() being guarded by a static key the bare metal case
> can be optimized by patching the call away completely. In case a kernel
> running as a guest it can decide whether to use paravitualized
> spinlocks, the current fallback to the unfair test-and-set scheme, or
> to mimic the bare metal behavior.
> 
> V3:
> - remove test for hypervisor environment from virt_spin_lock(9 as
>   suggested by Waiman Long
> 
> V2:
> - use static key instead of making virt_spin_lock() a pvops function
> 
> Juergen Gross (2):
>   paravirt/locks: use new static key for controlling call of
>     virt_spin_lock()
>   paravirt,xen: correct xen_nopvspin case
> 
>  arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
>  arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
>  arch/x86/kernel/smpboot.c            |  2 ++
>  arch/x86/xen/spinlock.c              |  2 ++
>  kernel/locking/qspinlock.c           |  4 ++++
>  5 files changed, 24 insertions(+), 1 deletion(-)
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 0/2] guard virt_spin_lock() with a static key
  2017-09-06 17:36 ` Juergen Gross
                   ` (7 preceding siblings ...)
  (?)
@ 2017-09-25 13:59 ` Juergen Gross
  -1 siblings, 0 replies; 19+ messages in thread
From: Juergen Gross @ 2017-09-25 13:59 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: jeremy, peterz, rusty, chrisw, mingo, tglx, hpa, longman,
	akataria, boris.ostrovsky

Ping?

On 06/09/17 19:36, Juergen Gross wrote:
> With virt_spin_lock() being guarded by a static key the bare metal case
> can be optimized by patching the call away completely. In case a kernel
> running as a guest it can decide whether to use paravitualized
> spinlocks, the current fallback to the unfair test-and-set scheme, or
> to mimic the bare metal behavior.
> 
> V3:
> - remove test for hypervisor environment from virt_spin_lock(9 as
>   suggested by Waiman Long
> 
> V2:
> - use static key instead of making virt_spin_lock() a pvops function
> 
> Juergen Gross (2):
>   paravirt/locks: use new static key for controlling call of
>     virt_spin_lock()
>   paravirt,xen: correct xen_nopvspin case
> 
>  arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
>  arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
>  arch/x86/kernel/smpboot.c            |  2 ++
>  arch/x86/xen/spinlock.c              |  2 ++
>  kernel/locking/qspinlock.c           |  4 ++++
>  5 files changed, 24 insertions(+), 1 deletion(-)
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 0/2] guard virt_spin_lock() with a static key
  2017-09-06 17:36 ` Juergen Gross
                   ` (5 preceding siblings ...)
  (?)
@ 2017-09-25 13:59 ` Juergen Gross
  -1 siblings, 0 replies; 19+ messages in thread
From: Juergen Gross @ 2017-09-25 13:59 UTC (permalink / raw)
  To: linux-kernel, xen-devel, x86, virtualization
  Cc: jeremy, peterz, rusty, chrisw, mingo, tglx, hpa, longman,
	akataria, boris.ostrovsky

Ping?

On 06/09/17 19:36, Juergen Gross wrote:
> With virt_spin_lock() being guarded by a static key the bare metal case
> can be optimized by patching the call away completely. In case a kernel
> running as a guest it can decide whether to use paravitualized
> spinlocks, the current fallback to the unfair test-and-set scheme, or
> to mimic the bare metal behavior.
> 
> V3:
> - remove test for hypervisor environment from virt_spin_lock(9 as
>   suggested by Waiman Long
> 
> V2:
> - use static key instead of making virt_spin_lock() a pvops function
> 
> Juergen Gross (2):
>   paravirt/locks: use new static key for controlling call of
>     virt_spin_lock()
>   paravirt,xen: correct xen_nopvspin case
> 
>  arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
>  arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
>  arch/x86/kernel/smpboot.c            |  2 ++
>  arch/x86/xen/spinlock.c              |  2 ++
>  kernel/locking/qspinlock.c           |  4 ++++
>  5 files changed, 24 insertions(+), 1 deletion(-)
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 0/2] guard virt_spin_lock() with a static key
  2017-09-25 13:59 ` Juergen Gross
  2017-09-25 14:44   ` Waiman Long
  2017-09-25 14:44   ` Waiman Long
@ 2017-09-25 14:44   ` Waiman Long
  2 siblings, 0 replies; 19+ messages in thread
From: Waiman Long @ 2017-09-25 14:44 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, xen-devel, x86, virtualization
  Cc: jeremy, chrisw, akataria, rusty, boris.ostrovsky, hpa, tglx,
	mingo, peterz

On 09/25/2017 09:59 AM, Juergen Gross wrote:
> Ping?
>
> On 06/09/17 19:36, Juergen Gross wrote:
>> With virt_spin_lock() being guarded by a static key the bare metal case
>> can be optimized by patching the call away completely. In case a kernel
>> running as a guest it can decide whether to use paravitualized
>> spinlocks, the current fallback to the unfair test-and-set scheme, or
>> to mimic the bare metal behavior.
>>
>> V3:
>> - remove test for hypervisor environment from virt_spin_lock(9 as
>>   suggested by Waiman Long
>>
>> V2:
>> - use static key instead of making virt_spin_lock() a pvops function
>>
>> Juergen Gross (2):
>>   paravirt/locks: use new static key for controlling call of
>>     virt_spin_lock()
>>   paravirt,xen: correct xen_nopvspin case
>>
>>  arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
>>  arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
>>  arch/x86/kernel/smpboot.c            |  2 ++
>>  arch/x86/xen/spinlock.c              |  2 ++
>>  kernel/locking/qspinlock.c           |  4 ++++
>>  5 files changed, 24 insertions(+), 1 deletion(-)
>>
Acked-by: Waiman Long <longman@redhat.com>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 0/2] guard virt_spin_lock() with a static key
  2017-09-25 13:59 ` Juergen Gross
@ 2017-09-25 14:44   ` Waiman Long
  2017-09-25 14:44   ` Waiman Long
  2017-09-25 14:44   ` Waiman Long
  2 siblings, 0 replies; 19+ messages in thread
From: Waiman Long @ 2017-09-25 14:44 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, xen-devel, x86, virtualization
  Cc: jeremy, peterz, rusty, chrisw, mingo, tglx, hpa, akataria,
	boris.ostrovsky

On 09/25/2017 09:59 AM, Juergen Gross wrote:
> Ping?
>
> On 06/09/17 19:36, Juergen Gross wrote:
>> With virt_spin_lock() being guarded by a static key the bare metal case
>> can be optimized by patching the call away completely. In case a kernel
>> running as a guest it can decide whether to use paravitualized
>> spinlocks, the current fallback to the unfair test-and-set scheme, or
>> to mimic the bare metal behavior.
>>
>> V3:
>> - remove test for hypervisor environment from virt_spin_lock(9 as
>>   suggested by Waiman Long
>>
>> V2:
>> - use static key instead of making virt_spin_lock() a pvops function
>>
>> Juergen Gross (2):
>>   paravirt/locks: use new static key for controlling call of
>>     virt_spin_lock()
>>   paravirt,xen: correct xen_nopvspin case
>>
>>  arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
>>  arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
>>  arch/x86/kernel/smpboot.c            |  2 ++
>>  arch/x86/xen/spinlock.c              |  2 ++
>>  kernel/locking/qspinlock.c           |  4 ++++
>>  5 files changed, 24 insertions(+), 1 deletion(-)
>>
Acked-by: Waiman Long <longman@redhat.com>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 0/2] guard virt_spin_lock() with a static key
  2017-09-25 13:59 ` Juergen Gross
  2017-09-25 14:44   ` Waiman Long
@ 2017-09-25 14:44   ` Waiman Long
  2017-09-25 14:44   ` Waiman Long
  2 siblings, 0 replies; 19+ messages in thread
From: Waiman Long @ 2017-09-25 14:44 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, xen-devel, x86, virtualization
  Cc: jeremy, peterz, rusty, chrisw, mingo, tglx, hpa, akataria,
	boris.ostrovsky

On 09/25/2017 09:59 AM, Juergen Gross wrote:
> Ping?
>
> On 06/09/17 19:36, Juergen Gross wrote:
>> With virt_spin_lock() being guarded by a static key the bare metal case
>> can be optimized by patching the call away completely. In case a kernel
>> running as a guest it can decide whether to use paravitualized
>> spinlocks, the current fallback to the unfair test-and-set scheme, or
>> to mimic the bare metal behavior.
>>
>> V3:
>> - remove test for hypervisor environment from virt_spin_lock(9 as
>>   suggested by Waiman Long
>>
>> V2:
>> - use static key instead of making virt_spin_lock() a pvops function
>>
>> Juergen Gross (2):
>>   paravirt/locks: use new static key for controlling call of
>>     virt_spin_lock()
>>   paravirt,xen: correct xen_nopvspin case
>>
>>  arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
>>  arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
>>  arch/x86/kernel/smpboot.c            |  2 ++
>>  arch/x86/xen/spinlock.c              |  2 ++
>>  kernel/locking/qspinlock.c           |  4 ++++
>>  5 files changed, 24 insertions(+), 1 deletion(-)
>>
Acked-by: Waiman Long <longman@redhat.com>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 0/2] guard virt_spin_lock() with a static key
  2017-09-06 17:36 ` Juergen Gross
@ 2017-10-02 14:19   ` Peter Zijlstra
  -1 siblings, 0 replies; 19+ messages in thread
From: Peter Zijlstra @ 2017-10-02 14:19 UTC (permalink / raw)
  To: Juergen Gross
  Cc: linux-kernel, xen-devel, x86, virtualization, jeremy, chrisw,
	akataria, rusty, boris.ostrovsky, hpa, tglx, mingo, longman

On Wed, Sep 06, 2017 at 07:36:23PM +0200, Juergen Gross wrote:
> With virt_spin_lock() being guarded by a static key the bare metal case
> can be optimized by patching the call away completely. In case a kernel
> running as a guest it can decide whether to use paravitualized
> spinlocks, the current fallback to the unfair test-and-set scheme, or
> to mimic the bare metal behavior.
> 
> V3:
> - remove test for hypervisor environment from virt_spin_lock(9 as
>   suggested by Waiman Long
> 
> V2:
> - use static key instead of making virt_spin_lock() a pvops function
> 
> Juergen Gross (2):
>   paravirt/locks: use new static key for controlling call of
>     virt_spin_lock()
>   paravirt,xen: correct xen_nopvspin case
> 
>  arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
>  arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
>  arch/x86/kernel/smpboot.c            |  2 ++
>  arch/x86/xen/spinlock.c              |  2 ++
>  kernel/locking/qspinlock.c           |  4 ++++
>  5 files changed, 24 insertions(+), 1 deletion(-)

Sorry for the delay, picked it up now.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 0/2] guard virt_spin_lock() with a static key
@ 2017-10-02 14:19   ` Peter Zijlstra
  0 siblings, 0 replies; 19+ messages in thread
From: Peter Zijlstra @ 2017-10-02 14:19 UTC (permalink / raw)
  To: Juergen Gross
  Cc: jeremy, rusty, x86, linux-kernel, virtualization, chrisw, mingo,
	tglx, longman, hpa, xen-devel, akataria, boris.ostrovsky

On Wed, Sep 06, 2017 at 07:36:23PM +0200, Juergen Gross wrote:
> With virt_spin_lock() being guarded by a static key the bare metal case
> can be optimized by patching the call away completely. In case a kernel
> running as a guest it can decide whether to use paravitualized
> spinlocks, the current fallback to the unfair test-and-set scheme, or
> to mimic the bare metal behavior.
> 
> V3:
> - remove test for hypervisor environment from virt_spin_lock(9 as
>   suggested by Waiman Long
> 
> V2:
> - use static key instead of making virt_spin_lock() a pvops function
> 
> Juergen Gross (2):
>   paravirt/locks: use new static key for controlling call of
>     virt_spin_lock()
>   paravirt,xen: correct xen_nopvspin case
> 
>  arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
>  arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
>  arch/x86/kernel/smpboot.c            |  2 ++
>  arch/x86/xen/spinlock.c              |  2 ++
>  kernel/locking/qspinlock.c           |  4 ++++
>  5 files changed, 24 insertions(+), 1 deletion(-)

Sorry for the delay, picked it up now.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 0/2] guard virt_spin_lock() with a static key
  2017-09-06 17:36 ` Juergen Gross
                   ` (8 preceding siblings ...)
  (?)
@ 2017-10-02 14:19 ` Peter Zijlstra
  -1 siblings, 0 replies; 19+ messages in thread
From: Peter Zijlstra @ 2017-10-02 14:19 UTC (permalink / raw)
  To: Juergen Gross
  Cc: jeremy, rusty, x86, linux-kernel, virtualization, chrisw, mingo,
	tglx, longman, hpa, xen-devel, akataria, boris.ostrovsky

On Wed, Sep 06, 2017 at 07:36:23PM +0200, Juergen Gross wrote:
> With virt_spin_lock() being guarded by a static key the bare metal case
> can be optimized by patching the call away completely. In case a kernel
> running as a guest it can decide whether to use paravitualized
> spinlocks, the current fallback to the unfair test-and-set scheme, or
> to mimic the bare metal behavior.
> 
> V3:
> - remove test for hypervisor environment from virt_spin_lock(9 as
>   suggested by Waiman Long
> 
> V2:
> - use static key instead of making virt_spin_lock() a pvops function
> 
> Juergen Gross (2):
>   paravirt/locks: use new static key for controlling call of
>     virt_spin_lock()
>   paravirt,xen: correct xen_nopvspin case
> 
>  arch/x86/include/asm/qspinlock.h     | 11 ++++++++++-
>  arch/x86/kernel/paravirt-spinlocks.c |  6 ++++++
>  arch/x86/kernel/smpboot.c            |  2 ++
>  arch/x86/xen/spinlock.c              |  2 ++
>  kernel/locking/qspinlock.c           |  4 ++++
>  5 files changed, 24 insertions(+), 1 deletion(-)

Sorry for the delay, picked it up now.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [tip:locking/core] locking/paravirt: Use new static key for controlling call of virt_spin_lock()
  2017-09-06 17:36 ` Juergen Gross
@ 2017-10-10 11:03   ` tip-bot for Juergen Gross
  0 siblings, 0 replies; 19+ messages in thread
From: tip-bot for Juergen Gross @ 2017-10-10 11:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, linux-kernel, torvalds, hpa, mingo, longman, jgross, tglx

Commit-ID:  9043442b43b1fddf202591b84702863286700c1a
Gitweb:     https://git.kernel.org/tip/9043442b43b1fddf202591b84702863286700c1a
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed, 6 Sep 2017 19:36:24 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 10 Oct 2017 11:50:12 +0200

locking/paravirt: Use new static key for controlling call of virt_spin_lock()

There are cases where a guest tries to switch spinlocks to bare metal
behavior (e.g. by setting "xen_nopvspin" boot parameter). Today this
has the downside of falling back to unfair test and set scheme for
qspinlocks due to virt_spin_lock() detecting the virtualized
environment.

Add a static key controlling whether virt_spin_lock() should be
called or not. When running on bare metal set the new key to false.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Waiman Long <longman@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: akataria@vmware.com
Cc: boris.ostrovsky@oracle.com
Cc: chrisw@sous-sol.org
Cc: hpa@zytor.com
Cc: jeremy@goop.org
Cc: rusty@rustcorp.com.au
Cc: virtualization@lists.linux-foundation.org
Cc: xen-devel@lists.xenproject.org
Link: http://lkml.kernel.org/r/20170906173625.18158-2-jgross@suse.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/qspinlock.h | 11 ++++++++++-
 arch/x86/kernel/paravirt.c       | 14 ++++++++++++--
 arch/x86/kernel/smpboot.c        |  2 ++
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h
index 48a706f..308dfd0 100644
--- a/arch/x86/include/asm/qspinlock.h
+++ b/arch/x86/include/asm/qspinlock.h
@@ -1,6 +1,7 @@
 #ifndef _ASM_X86_QSPINLOCK_H
 #define _ASM_X86_QSPINLOCK_H
 
+#include <linux/jump_label.h>
 #include <asm/cpufeature.h>
 #include <asm-generic/qspinlock_types.h>
 #include <asm/paravirt.h>
@@ -46,10 +47,14 @@ static inline void queued_spin_unlock(struct qspinlock *lock)
 #endif
 
 #ifdef CONFIG_PARAVIRT
+DECLARE_STATIC_KEY_TRUE(virt_spin_lock_key);
+
+void native_pv_lock_init(void) __init;
+
 #define virt_spin_lock virt_spin_lock
 static inline bool virt_spin_lock(struct qspinlock *lock)
 {
-	if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
+	if (!static_branch_likely(&virt_spin_lock_key))
 		return false;
 
 	/*
@@ -65,6 +70,10 @@ static inline bool virt_spin_lock(struct qspinlock *lock)
 
 	return true;
 }
+#else
+static inline void native_pv_lock_init(void)
+{
+}
 #endif /* CONFIG_PARAVIRT */
 
 #include <asm-generic/qspinlock.h>
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 19a3e8f..041096b 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -115,8 +115,18 @@ unsigned paravirt_patch_jmp(void *insnbuf, const void *target,
 	return 5;
 }
 
-/* Neat trick to map patch type back to the call within the
- * corresponding structure. */
+DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key);
+
+void __init native_pv_lock_init(void)
+{
+	if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
+		static_branch_disable(&virt_spin_lock_key);
+}
+
+/*
+ * Neat trick to map patch type back to the call within the
+ * corresponding structure.
+ */
 static void *get_call_destination(u8 type)
 {
 	struct paravirt_patch_template tmpl = {
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index ad59edd..361f916 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -77,6 +77,7 @@
 #include <asm/i8259.h>
 #include <asm/realmode.h>
 #include <asm/misc.h>
+#include <asm/qspinlock.h>
 
 /* Number of siblings per CPU package */
 int smp_num_siblings = 1;
@@ -1384,6 +1385,7 @@ 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)

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [tip:locking/core] locking/spinlocks, paravirt, xen: Correct the xen_nopvspin case
  2017-09-06 17:36   ` Juergen Gross
  (?)
@ 2017-10-10 11:03   ` tip-bot for Juergen Gross
  -1 siblings, 0 replies; 19+ messages in thread
From: tip-bot for Juergen Gross @ 2017-10-10 11:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: torvalds, hpa, mingo, tglx, longman, peterz, jgross, linux-kernel

Commit-ID:  e6fd28eb3522b31f79a938e24674f77268a120fd
Gitweb:     https://git.kernel.org/tip/e6fd28eb3522b31f79a938e24674f77268a120fd
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed, 6 Sep 2017 19:36:25 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 10 Oct 2017 11:50:13 +0200

locking/spinlocks, paravirt, xen: Correct the xen_nopvspin case

With the boot parameter "xen_nopvspin" specified a Xen guest should not
make use of paravirt spinlocks, but behave as if running on bare
metal. This is not true, however, as the qspinlock code will fall back
to a test-and-set scheme when it is detecting a hypervisor.

In order to avoid this disable the virt_spin_lock_key.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Waiman Long <longman@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: akataria@vmware.com
Cc: boris.ostrovsky@oracle.com
Cc: chrisw@sous-sol.org
Cc: hpa@zytor.com
Cc: jeremy@goop.org
Cc: rusty@rustcorp.com.au
Cc: virtualization@lists.linux-foundation.org
Cc: xen-devel@lists.xenproject.org
Link: http://lkml.kernel.org/r/20170906173625.18158-3-jgross@suse.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/xen/spinlock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 25a7c43..e8ab80a 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -10,6 +10,7 @@
 #include <linux/slab.h>
 
 #include <asm/paravirt.h>
+#include <asm/qspinlock.h>
 
 #include <xen/interface/xen.h>
 #include <xen/events.h>
@@ -129,6 +130,7 @@ 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");

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-10-10 11:07 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-06 17:36 [PATCH v3 0/2] guard virt_spin_lock() with a static key Juergen Gross
2017-09-06 17:36 ` Juergen Gross
2017-09-06 17:36 ` [PATCH v3 1/2] paravirt/locks: use new static key for controlling call of virt_spin_lock() Juergen Gross
2017-09-06 17:36 ` Juergen Gross
2017-09-06 17:36 ` Juergen Gross
2017-10-10 11:03   ` [tip:locking/core] locking/paravirt: Use " tip-bot for Juergen Gross
2017-09-06 17:36 ` [PATCH v3 2/2] paravirt, xen: correct xen_nopvspin case Juergen Gross
2017-09-06 17:36 ` [PATCH v3 2/2] paravirt,xen: " Juergen Gross
2017-09-06 17:36   ` Juergen Gross
2017-10-10 11:03   ` [tip:locking/core] locking/spinlocks, paravirt, xen: Correct the " tip-bot for Juergen Gross
2017-09-25 13:59 ` [PATCH v3 0/2] guard virt_spin_lock() with a static key Juergen Gross
2017-09-25 13:59 ` Juergen Gross
2017-09-25 14:44   ` Waiman Long
2017-09-25 14:44   ` Waiman Long
2017-09-25 14:44   ` Waiman Long
2017-09-25 13:59 ` Juergen Gross
2017-10-02 14:19 ` Peter Zijlstra
2017-10-02 14:19 ` Peter Zijlstra
2017-10-02 14:19   ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.