From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1D072609FD for ; Fri, 21 Nov 2025 00:38:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763685537; cv=none; b=bd3mp7tBlbDUfrM9Gr2+9Uwf62D56cQsAkxQzxE41r/0kRqgNqMt3mtz911PxlTuBiK/KdZO6qn+2g/HwdNDYpWvQKz+F2W5+dSrzzLRo46xQJ0Vi5HPJkcPZBYUgNgMQFCRuTaA47yHIb3v34afxbWGqr/ZhDx7297k2DE3lVk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763685537; c=relaxed/simple; bh=ZVm9oVg9+oHojYwfCqjOSWTPawiDqofHfvzZVybJeio=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JrboK5WzeO8YKnpclBFgjw5WvyjorlEx6VoALU7ewOAc1B7siLp/E/f9elNzkRD0V+zNBzKadnQm/AsPGeKDhnsAyXNUfd7YGLKTxel3cPCTw3pHGYPl1EY7t/zEbWTZxfS7sTHIUTOoqgUSd621X3X/QcoUocPYAToTHGe+Fec= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=FOnEgNLs; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FOnEgNLs" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2958c80fcabso45940325ad.0 for ; Thu, 20 Nov 2025 16:38:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763685534; x=1764290334; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=9yHOty/6mNUkhCHBQeglcNfXba5Wpwpq1aZlNIfnHbs=; b=FOnEgNLsm1yir+BEN6I/gb5qFuDj++EybRuA7xiV2i85p7uK51ZsrlgrNHBkbEDHg/ Co22vWBB6ahUYK6bhrnt5SsVcNNe6/SWWoWN2WBiH/9t6Ns6Shqv1ibKEpzHFx6nwlf+ aKXOzBm8f8tc0MiK4b5LuwlGytAyH2ZZ/gXdExf6ddjkD2Xlzr8k7N0DU9guFUXAQhr+ jOyHV8ph5OJU9Jfji4heeQ2SH/ZcefR2Q1AJJIE+4uPPaxgaP5XZBrzWsnrxQSRQekgh ztd0lQemQo3UpOkObVL/k6Yd4KiOw66Vjs0XN2l+n2Du6ctSgiQJn8e6jYWJN9AjN0qn asKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763685534; x=1764290334; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9yHOty/6mNUkhCHBQeglcNfXba5Wpwpq1aZlNIfnHbs=; b=LeahQPXefj5qLYPs1W4IpQzdD4HgaSlldkvkIu7s2DElR7kKLqEgX4SpjBO91KY5oe NZfZQR76KQVHU2rgLFKA9VX93sXbu3weHNemSa/8fdTo8YDgeCuhMyLjGwaMXxFJ69i6 1dBnH86UgIqbv8qh6tMQ+B5qd8dkCaCM6GrsgQjuVIdcYIyUn5U1Ae0z4sRxa1r2aQo4 ZEnKWc4+Ivv6C1uywBV56nfdXQSOsKdS9g1UZ03r6F4jxKE7kLvvBX7aN6tUvxkXfxoV LdKnAwRyBmtvaueEhmqSbi4da9Jja4nW1zxyShvvL1xwmsRJoV6aVOXGEbaWKJIelI09 PIuw== X-Forwarded-Encrypted: i=1; AJvYcCX0qA0eAtcYIIjte9NdjiUqj/WKAjsIWwQlGpLXVJhed+sFpFa5t7nXOto8oP4YnP9D42bIxUR/E2tqUT4=@vger.kernel.org X-Gm-Message-State: AOJu0YyFveyzxeYKN/443jKMcYWXta5McBWg6jqBvs65u0Pkm/AP+WFe jWK8iv1qs4dZdTIBQJI/BhSuc24GcnkDiYRbLhivp0mdbQzLx2sIIKoUWKaT2pXRhpvewAVgc4D yFeGtgQ== X-Google-Smtp-Source: AGHT+IHAtQ5uOa4zy//oPlSviihcy4vHTC+g1fwm6GKeCXN14PJK2EED5KkhT/Iqwbi3W7eOGEFuceginJY= X-Received: from pjbbb10.prod.google.com ([2002:a17:90b:8a:b0:340:53bc:56cb]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:3c6f:b0:295:8c51:64ff with SMTP id d9443c01a7336-29b6bf37d57mr6409455ad.29.1763685533874; Thu, 20 Nov 2025 16:38:53 -0800 (PST) Date: Thu, 20 Nov 2025 16:38:52 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251110033232.12538-1-kernellwp@gmail.com> <20251110033232.12538-7-kernellwp@gmail.com> Message-ID: Subject: Re: [PATCH 06/10] KVM: Fix last_boosted_vcpu index assignment bug From: Sean Christopherson To: Wanpeng Li Cc: Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Paolo Bonzini , Steven Rostedt , Vincent Guittot , Juri Lelli , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Wanpeng Li Content-Type: text/plain; charset="us-ascii" On Thu, Nov 20, 2025, Sean Christopherson wrote: > On Mon, Nov 10, 2025, Wanpeng Li wrote: > > From: Wanpeng Li > > > > From: Wanpeng Li > > 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@vger.kernel.org > Reviewed-by: Sean Christopherson > > 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 > > --- > > 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 > >