Re: [PATCH 06/10] KVM: Fix last_boosted_vcpu index assignment bug

From: Wanpeng Li

Date: Fri Nov 21 2025 - 06:46:16 EST


On Fri, 21 Nov 2025 at 08:35, Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Mon, Nov 10, 2025, Wanpeng Li wrote:
> > From: Wanpeng Li <wanpengli@xxxxxxxxxxx>
> >
> > From: Wanpeng Li <wanpengli@xxxxxxxxxxx>
>
> 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").

Hi Paolo and Sean,

Regarding commit b018589013d6 — I'm back to active KVM development and
ready to resume reviewing. Please update my entry to Wanpeng Li
<kernellwp@xxxxxxxxx>. My recent patch series reflects the level of
engagement you can expect going forward.

>
> > 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@xxxxxxxxxxxxxxx
> Reviewed-by: Sean Christopherson <seanjc@xxxxxxxxxx>
>
> 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.

Good point about fixed visibility — it makes sense to keep them separate.

>
> That said, thank you for fixing my goof :-)

:)

Regards,
Wanpeng