From: Peter Zijlstra <peterz@infradead.org>
To: "Guo, Wangyang" <wangyang.guo@intel.com>
Cc: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"Li, Tianyou" <tianyou.li@intel.com>,
Tim Chen <tim.c.chen@linux.intel.com>
Subject: Re: [PATCH RESEND^2] x86/paravirt: add backoff mechanism to virt_spin_lock
Date: Thu, 14 Aug 2025 12:39:53 +0200 [thread overview]
Message-ID: <20250814103953.GU4067720@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <DS0PR11MB8018B027AA0738EB8B6CD55D9235A@DS0PR11MB8018.namprd11.prod.outlook.com>
On Thu, Aug 14, 2025 at 01:26:59AM +0000, Guo, Wangyang wrote:
> On 8/13/2025 10:33 PM, Peter Zijlstra wrote:
> > On Wed, Aug 13, 2025 at 08:50:43AM +0800, Wangyang Guo wrote:
> >> When multiple threads waiting for lock at the same time, once lock owner
> >> releases the lock, waiters will see lock available and all try to lock,
> >> which may cause an expensive CAS storm.
> >>
> >> 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.
In the non-overcommit, physically pinned case, there is a knob to use
native spinlocks.
prev parent reply other threads:[~2025-08-14 10:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 0:50 Wangyang Guo
2025-08-13 14:23 ` Dave Hansen
2025-08-14 1:14 ` Guo, Wangyang
2025-08-13 14:33 ` Peter Zijlstra
2025-08-14 1:26 ` Guo, Wangyang
2025-08-14 3:10 ` [????] " Li,Rongqing
2025-08-14 10:41 ` Peter Zijlstra
2025-08-15 2:47 ` Guo, Wangyang
2025-08-14 10:39 ` Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250814103953.GU4067720@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=tianyou.li@intel.com \
--cc=tim.c.chen@linux.intel.com \
--cc=vkuznets@redhat.com \
--cc=wangyang.guo@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®