From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v6 05/11] pvqspinlock, x86: Allow unfair spinlock in a PV guest Date: Wed, 19 Mar 2014 18:08:07 +0100 Message-ID: <5329CEF7.6030406@redhat.com> References: <1394650498-30118-1-git-send-email-Waiman.Long@hp.com> <1394650498-30118-6-git-send-email-Waiman.Long@hp.com> <53218E7A.8090707@citrix.com> <5321AF96.6070909@redhat.com> <20140317190511.GB11707@phenom.dumpdata.com> <53280075.1020804@redhat.com> <53290BCD.8010001@hp.com> <53296C6F.7040709@redhat.com> <5329CCAA.9000909@hp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5329CCAA.9000909@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 Cc: Jeremy Fitzhardinge , Raghavendra K T , kvm@vger.kernel.org, Peter Zijlstra , virtualization@lists.linux-foundation.org, Andi Kleen , "H. Peter Anvin" , Michel Lespinasse , Alok Kataria , linux-arch@vger.kernel.org, Gleb Natapov , x86@kernel.org, Ingo Molnar , xen-devel@lists.xenproject.org, "Paul E. McKenney" , Rik van Riel , Arnd Bergmann , Konrad Rzeszutek Wilk , Scott J Norton , Steven Rostedt , Chris Wright , Thomas Gleixner , Aswin Chandramouleeswaran , Chegu Vinod List-Id: virtualization@lists.linuxfoundation.org Il 19/03/2014 17:58, Waiman Long ha scritto: >> Exactly. What you want is boot_cpu_has(X86_FEATURE_HYPERVISOR). > > The unfair lock is to be enabled by boot time check, not just by the > presence of a configuration macro during the build process in order to > avoid using unfair lock on bare metal. Of course, Linux distros can > modify this if that suits their need. "boot_cpu_has" is a run-time check. You can use it after setup_arch has called init_hypervisor_platform and kvm_guest_init. Can you just just check if the PV path has been enabled and, if not, do a static_key_inc to enable the unfair path? Paolo