]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: Fix last_boosted_vcpu index assignment bug
authorWanpeng Li <wanpengli@tencent.com>
Mon, 10 Nov 2025 03:32:27 +0000 (11:32 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:21 +0000 (12:57 +0100)
commit2c3719a04b04a251782e77618d4255907ea4bbc8
tree60f4082751c9f2fa7d44ef9b6b16bf4807bcd71b
parent691ff7e13f0d825b91bc50cb4ceb00af2178e9ec
KVM: Fix last_boosted_vcpu index assignment bug

commit 32bd348be3fa07b26c5ea6b818a161c142dcc2f2 upstream.

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.

Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20251110033232.12538-7-kernellwp@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
virt/kvm/kvm_main.c