locking/spinlocks, paravirt, xen: Correct the xen_nopvspin case
authorJuergen Gross <jgross@suse.com>
Wed, 6 Sep 2017 17:36:25 +0000 (19:36 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 10 Oct 2017 09:50:13 +0000 (11:50 +0200)
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

index 25a7c4302ce70390e81f98be0df2324a725364d5..e8ab80ad7a6ffa7d94f98f909d4a3df282218e1e 100644 (file)
@@ -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");