[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aR-0nGgVuc2EWm2a@google.com>
Date: Thu, 20 Nov 2025 16:38:52 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Wanpeng Li <kernellwp@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>, Paolo Bonzini <pbonzini@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>, Vincent Guittot <vincent.guittot@...aro.org>,
Juri Lelli <juri.lelli@...hat.com>, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Wanpeng Li <wanpengli@...cent.com>
Subject: Re: [PATCH 06/10] KVM: Fix last_boosted_vcpu index assignment bug
On Thu, Nov 20, 2025, Sean Christopherson wrote:
> On Mon, Nov 10, 2025, Wanpeng Li wrote:
> > From: Wanpeng Li <wanpengli@...cent.com>
> >
> > From: Wanpeng Li <wanpengli@...cent.com>
>
> Something might be off in your email scripts. Speaking of email, mostly as an
> FYI, your @tencent email was bouncing as of last year, and prompted commit
> b018589013d6 ("MAINTAINERS: Drop Wanpeng Li as a Reviewer for KVM Paravirt support").
>
> > In kvm_vcpu_on_spin(), the loop counter 'i' is incorrectly written to
> > last_boosted_vcpu instead of the actual vCPU index 'idx'. This causes
> > last_boosted_vcpu to store the loop iteration count rather than the
> > vCPU index, leading to incorrect round-robin behavior in subsequent
> > directed yield operations.
> >
> > Fix this by using 'idx' instead of 'i' in the assignment.
>
> Fixes: 7e513617da71 ("KVM: Rework core loop of kvm_vcpu_on_spin() to use a single for-loop")
> Cc: stable@...r.kernel.org
> Reviewed-by: Sean Christopherson <seanjc@...gle.com>
>
> Please, please don't bury fixes like this in a large-ish series, especially in a
> series that's going to be quite contentious and thus likely to linger on-list for
> quite some time. It's pretty much dumb luck on my end that I saw this.
>
> That said, thank you for fixing my goof :-)
>
> Paolo, do you want to grab this for 6.19? Or just wait for 6.20?
Err, off-by-one. 6.18 and 6.19....
> > Signed-off-by: Wanpeng Li <wanpengli@...cent.com>
> > ---
> > virt/kvm/kvm_main.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> > index b7a0ae2a7b20..cde1eddbaa91 100644
> > --- a/virt/kvm/kvm_main.c
> > +++ b/virt/kvm/kvm_main.c
> > @@ -4026,7 +4026,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool yield_to_kernel_mode)
> >
> > yielded = kvm_vcpu_yield_to(vcpu);
> > if (yielded > 0) {
> > - WRITE_ONCE(kvm->last_boosted_vcpu, i);
> > + WRITE_ONCE(kvm->last_boosted_vcpu, idx);
> > break;
> > } else if (yielded < 0 && !--try) {
> > break;
> > --
> > 2.43.0
> >
Powered by blists - more mailing lists