From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v7 06/11] pvqspinlock, x86: Allow unfair queue spinlock in a KVM guest Date: Thu, 20 Mar 2014 23:01:39 +0100 Message-ID: <532B6543.7050707@redhat.com> References: <1395260049-30839-1-git-send-email-Waiman.Long@hp.com> <1395260049-30839-7-git-send-email-Waiman.Long@hp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1395260049-30839-7-git-send-email-Waiman.Long@hp.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Waiman Long , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Arnd Bergmann , Peter Zijlstra Cc: Jeremy Fitzhardinge , Raghavendra K T , Gleb Natapov , Aswin Chandramouleeswaran , Andi Kleen , Michel Lespinasse , Boris Ostrovsky , linux-arch@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, xen-devel@lists.xenproject.org, "Paul E. McKenney" , Scott J Norton , Steven Rostedt , Chris Wright , Alok Kataria , virtualization@lists.linux-foundation.org, Chegu Vinod , Oleg Nesterov , linux-kernel@vger.kernel.org, David Vrabel , Andrew Morton List-Id: linux-arch.vger.kernel.org Il 19/03/2014 21:14, Waiman Long ha scritto: > This patch adds a KVM init function to activate the unfair queue > spinlock in a KVM guest when the PARAVIRT_UNFAIR_LOCKS kernel config > option is selected. > > Signed-off-by: Waiman Long > --- > arch/x86/kernel/kvm.c | 17 +++++++++++++++++ > 1 files changed, 17 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > index 713f1b3..a489140 100644 > --- a/arch/x86/kernel/kvm.c > +++ b/arch/x86/kernel/kvm.c > @@ -826,3 +826,20 @@ static __init int kvm_spinlock_init_jump(void) > early_initcall(kvm_spinlock_init_jump); > > #endif /* CONFIG_PARAVIRT_SPINLOCKS */ > + > +#ifdef CONFIG_PARAVIRT_UNFAIR_LOCKS > +/* > + * Enable unfair lock if running in a real para-virtualized environment > + */ > +static __init int kvm_unfair_locks_init_jump(void) > +{ > + if (!kvm_para_available()) > + return 0; > + > + static_key_slow_inc(¶virt_unfairlocks_enabled); > + printk(KERN_INFO "KVM setup unfair spinlock\n"); > + > + return 0; > +} > +early_initcall(kvm_unfair_locks_init_jump); > +#endif > No! Please do what I asked you to do. You are not handling Hyper-V or VMWare. Just use X86_FEATURE_HYPERVISOR and it will cover all hypervisors that actually follow Intel's guidelines. Paolo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qg0-f41.google.com ([209.85.192.41]:64108 "EHLO mail-qg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759424AbaCTWCU (ORCPT ); Thu, 20 Mar 2014 18:02:20 -0400 Message-ID: <532B6543.7050707@redhat.com> Date: Thu, 20 Mar 2014 23:01:39 +0100 From: Paolo Bonzini MIME-Version: 1.0 Subject: Re: [PATCH v7 06/11] pvqspinlock, x86: Allow unfair queue spinlock in a KVM guest References: <1395260049-30839-1-git-send-email-Waiman.Long@hp.com> <1395260049-30839-7-git-send-email-Waiman.Long@hp.com> In-Reply-To: <1395260049-30839-7-git-send-email-Waiman.Long@hp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Waiman Long , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Arnd Bergmann , Peter Zijlstra Cc: Jeremy Fitzhardinge , Raghavendra K T , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, Andi Kleen , Michel Lespinasse , Alok Kataria , linux-arch@vger.kernel.org, Gleb Natapov , x86@kernel.org, xen-devel@lists.xenproject.org, "Paul E. McKenney" , Scott J Norton , Rusty Russell , Steven Rostedt , Chris Wright , Oleg Nesterov , Boris Ostrovsky , Aswin Chandramouleeswaran , Chegu Vinod , linux-kernel@vger.kernel.org, David Vrabel , Andrew Morton Message-ID: <20140320220139.1mbYVjUD625cysgI4iuXKvz9AHyImnstTQU0f6pGjks@z> Il 19/03/2014 21:14, Waiman Long ha scritto: > This patch adds a KVM init function to activate the unfair queue > spinlock in a KVM guest when the PARAVIRT_UNFAIR_LOCKS kernel config > option is selected. > > Signed-off-by: Waiman Long > --- > arch/x86/kernel/kvm.c | 17 +++++++++++++++++ > 1 files changed, 17 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > index 713f1b3..a489140 100644 > --- a/arch/x86/kernel/kvm.c > +++ b/arch/x86/kernel/kvm.c > @@ -826,3 +826,20 @@ static __init int kvm_spinlock_init_jump(void) > early_initcall(kvm_spinlock_init_jump); > > #endif /* CONFIG_PARAVIRT_SPINLOCKS */ > + > +#ifdef CONFIG_PARAVIRT_UNFAIR_LOCKS > +/* > + * Enable unfair lock if running in a real para-virtualized environment > + */ > +static __init int kvm_unfair_locks_init_jump(void) > +{ > + if (!kvm_para_available()) > + return 0; > + > + static_key_slow_inc(¶virt_unfairlocks_enabled); > + printk(KERN_INFO "KVM setup unfair spinlock\n"); > + > + return 0; > +} > +early_initcall(kvm_unfair_locks_init_jump); > +#endif > No! Please do what I asked you to do. You are not handling Hyper-V or VMWare. Just use X86_FEATURE_HYPERVISOR and it will cover all hypervisors that actually follow Intel's guidelines. Paolo