lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <066780ea-95f0-49c4-938a-3405975ebf60@intel.com>
Date: Fri, 15 Aug 2025 10:47:27 +0800
From: "Guo, Wangyang" <wangyang.guo@...el.com>
To: Peter Zijlstra <peterz@...radead.org>, "Li,Rongqing"
 <lirongqing@...du.com>
Cc: Sean Christopherson <seanjc@...gle.com>,
 Paolo Bonzini <pbonzini@...hat.com>, Vitaly Kuznetsov <vkuznets@...hat.com>,
 Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
 Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
 "x86@...nel.org" <x86@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
 "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
 "Li, Tianyou" <tianyou.li@...el.com>, Tim Chen <tim.c.chen@...ux.intel.com>
Subject: Re: [????] RE: [PATCH RESEND^2] x86/paravirt: add backoff mechanism
 to virt_spin_lock

On 8/14/2025 6:41 PM, Peter Zijlstra wrote:
> On Thu, Aug 14, 2025 at 03:10:46AM +0000, Li,Rongqing wrote:
>>> On 8/13/2025 10:33 PM, Peter Zijlstra wrote:
>>>> On Wed, Aug 13, 2025 at 08:50:43AM +0800, Wangyang Guo wrote:
>>>>> Binary exponential backoff is introduced. As try-lock attempt
>>>>> increases, there is more likely that a larger number threads compete
>>>>> for the same lock, so increase wait time in exponential.
>>>>
>>>> You shouldn't be using virt_spin_lock() to begin with. That means
>>>> you've misconfigured your guest.
>>>>
>>>> We have paravirt spinlocks for a reason.
>>>
>>> We have tried PARAVIRT_SPINLOCKS, it can help to reduce the contention cycles,
>>> but the throughput is not good. I think there are two factors:
>>>
>>> 1. the VM is not overcommit, each thread has its CPU resources to doing spin
>>> wait.
>>
>> If vm is not overcommit, guest should have KVM_HINTS_REALTIME, I think native qspinlock should be better
>> Could you try test this patch
>> https://patchwork.kernel.org/project/kvm/patch/20250722110005.4988-1-lirongqing@baidu.com/
> 
> Right, that's the knob.

Yes, that works.
By providing qemu-kvm with `-cpu host,kvm-hint-dedicated` option, it can 
use mcs qspinlock and have better performance compared to virt_spin_lock().

But for non-overcommit VM, we may add `-overcommit cpu-pm=on` to let 
guest to handle idle by itself and reduce the guest latency. Current 
kernel will fallback to virt_spin_lock, even kvm-hint-dedicated is 
provided. With Rongqing's patch, it can fix this problem.

BR
Wangyang


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ