From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim Krcmar Subject: Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set Date: Thu, 9 Nov 2017 17:00:30 +0100 Message-ID: <20171109160029.GD20859@flask> References: <1509999980-10828-1-git-send-email-eduval@amazon.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Eduardo Valentin , Paolo Bonzini , Matt Wilson , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , the arch/x86 maintainers , Peter Zijlstra , Waiman Long , kvm , linux-doc@vger.kernel.org, "linux-kernel@vger.kernel.org" , "Jan H . Schoenherr" , Anthony Liguori To: Wanpeng Li Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2017-11-09 20:43+0800, Wanpeng Li: > 2017-11-07 4:26 GMT+08:00 Eduardo Valentin : > > Currently, the existing qspinlock implementation will fallback to > > test-and-set if the hypervisor has not set the PV_UNHALT flag. > > > > This patch gives the opportunity to guest kernels to select > > between test-and-set and the regular queueu fair lock implementation > > based on the PV_DEDICATED KVM feature flag. When the PV_DEDICATED > > flag is not set, the code will still fall back to test-and-set, > > but when the PV_DEDICATED flag is set, the code will use > > the regular queue spinlock implementation. > > > > With this patch, when in autoselect mode, the guest will > > use the default spinlock implementation based on host feature > > flags as follows: > > > > PV_DEDICATED = 1, PV_UNHALT = anything: default is qspinlock > > PV_DEDICATED = 0, PV_UNHALT = 1: default is pvqspinlock > > PV_DEDICATED = 0, PV_UNHALT = 0: default is tas > > > > Cc: Paolo Bonzini > > Cc: "Radim Krčmář" > > Cc: Jonathan Corbet > > Cc: Thomas Gleixner > > Cc: Ingo Molnar > > Cc: "H. Peter Anvin" > > Cc: x86@kernel.org > > Cc: Peter Zijlstra > > Cc: Waiman Long > > Cc: kvm@vger.kernel.org > > Cc: linux-doc@vger.kernel.org > > Cc: linux-kernel@vger.kernel.org > > Cc: Jan H. Schoenherr > > Cc: Anthony Liguori > > Suggested-by: Matt Wilson > > Signed-off-by: Eduardo Valentin > > --- > > You should also add a cpuid flag in kvm part. It is better without that. The flag has no dependency on KVM (kernel hypervisor) code.