From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (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 A875B21B9DA for ; Thu, 15 Jan 2026 01:12:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768439545; cv=none; b=a+5FsfoYDBGKRS0sl6ox5JuNmtmGWuk/pbgMRhhDoosNo1Smw5HQIkAeLS9PyMVxL70un2hq9rnqUehB17D5dI/pUSrHh6pK/+h7P8re/j20dOtzWt2tQ7C8hkvr2oY24GWzZGhl7+cVAI+YVYj0VX7jOgvdwrFhN5jbbs8gPPA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768439545; c=relaxed/simple; bh=dVHAfBRpEgC5Ucvxc9exvOiwGfv4r7hTfYbBvXV5ZcU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qSTlAPvT53YW4TzkpBif+SSpnfdg8GZJH1HS3+kuq9X8vq4c5GTL6VgyCGAk6qjneIqIJWN5lfzVO6rXU0obSCL0koKdBrRmd2ExufkAxHJevQR6PpWmgRFpcfXSJaxIm+WWmm/vlfXiW+gFfvgqwv9X9vqjE10h+Bk5AoZHksA= 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=jTOCmLYN; arc=none smtp.client-ip=209.85.216.73 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="jTOCmLYN" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-34c5d6193daso541059a91.1 for ; Wed, 14 Jan 2026 17:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768439542; x=1769044342; 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=Blk5r+gNg8D5o7ALzuwBmyzjRV/ZbOgxlBeTlxNYU2g=; b=jTOCmLYN5pEisIVnkBiZWAdCvCKly2lZVZIn6T1pgmqPSjKG818cNxul5DyEFJRGbz MWP8N6i6vlZx2uWWKApBV7K/9PbyJdZm2cVvS5Ayz/nMP8wJT2Gu6gGieDQtsh1fuxkG TCQmKF2o0AW/YlRvtQacn1nRFeBs4ZiL5X0t48A8zgLlepw5uO5x7F4Q+uDmojKJBOsz ekIgVApVoHKVBYgE0pZps7sbyrgYGKaLBL4+meWp32CHelJx2ClARW1bZABsZp3lmtRm 0H+ChRnLfO6+n+fPHzJHJbRp7n/FlzxTw03xhkUsNj9zm2KODC87u3+5cXq4OcSf9gOS wsGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768439542; x=1769044342; 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=Blk5r+gNg8D5o7ALzuwBmyzjRV/ZbOgxlBeTlxNYU2g=; b=aViuCGJoLt1cN3Wk/AOX3zkMUopG3xLb50ShetEoOW/x9k5O6P1nYdDBOK5QLBfJJM 7mCqzn0O4MonYb71ZcOnGV11rBl15MjODUBhA0Pf4WlEp/+nlybXARfSJT4+ptB9lei4 AnS9cx9Zv2P2JsS0IrF7R/vbjKfj+wQVVifN88PPAqMy9TzXh8vwnlI4U8pe7Op/Rb78 RKti/PsuNsKt1HUaaAjKb1sqva6Gt9HUR/R96PEDDjVglUPm9oHKVVnPjiOZaRYMRxtG rBcEB+tfaLBXCZGE/N3a3yone6sGAkfJ1c9/iaE+CxmKHAKMrgQDDR1XxEBBo4x2++B7 0eaA== X-Forwarded-Encrypted: i=1; AJvYcCV5jzIXWZ+MAmtmY0wGBqWbA4SrtMEehySQdpydG4xb0E/rZGqhpwm1E9n1o7mwIpTt8vD7ZJCN9J747U4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz2z8ondD4qGkVP9Wk0VwjRDB/S6u3POW4O82xrzyxlOINHZ/h/ mCYTwc76JtuYMVAEyHWpdCYledyRlY8KxzNH91NEy/yDVIbwwdFgb0W0F9A+p3OENBVxkp0lEou 1woe6rA== X-Received: from pjre16.prod.google.com ([2002:a17:90a:b390:b0:340:9d73:9c06]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:2250:b0:34c:a29d:992f with SMTP id 98e67ed59e1d1-3510913e074mr4478597a91.31.1768439542099; Wed, 14 Jan 2026 17:12:22 -0800 (PST) Date: Wed, 14 Jan 2026 17:12:20 -0800 In-Reply-To: <6cozacewv4sop77ilrqnervzpifinxki2ykef55awan2ka5jdf@sqyj7jed3qii> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251215192722.3654335-1-yosry.ahmed@linux.dev> <3rdy3n6phleyz2eltr5fkbsavlpfncgrnee7kep2jkh2air66c@euczg54kpt47> <6cozacewv4sop77ilrqnervzpifinxki2ykef55awan2ka5jdf@sqyj7jed3qii> Message-ID: Subject: Re: [PATCH] KVM: SVM: Fix redundant updates of LBR MSR intercepts From: Sean Christopherson To: Yosry Ahmed Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Thu, Jan 15, 2026, Yosry Ahmed wrote: > On Wed, Jan 14, 2026 at 02:07:10PM -0800, Sean Christopherson wrote: > > On Mon, Dec 15, 2025, Yosry Ahmed wrote: > > > On Mon, Dec 15, 2025 at 11:38:00AM -0800, Sean Christopherson wrote: > > > > On Mon, Dec 15, 2025, Yosry Ahmed wrote: > > > > > On Mon, Dec 15, 2025 at 07:26:54PM +0000, Yosry Ahmed wrote: > > > > > > svm_update_lbrv() always updates LBR MSRs intercepts, even when they are > > > > > > already set correctly. This results in force_msr_bitmap_recalc always > > > > > > being set to true on every nested transition, essentially undoing the > > > > > > hyperv optimization in nested_svm_merge_msrpm(). > > > > > > > > > > > > Fix it by keeping track of whether LBR MSRs are intercepted or not and > > > > > > only doing the update if needed, similar to x2avic_msrs_intercepted. > > > > > > > > > > > > Avoid using svm_test_msr_bitmap_*() to check the status of the > > > > > > intercepts, as an arbitrary MSR will need to be chosen as a > > > > > > representative of all LBR MSRs, and this could theoretically break if > > > > > > some of the MSRs intercepts are handled differently from the rest. > > > > > > > > > > > > Also, using svm_test_msr_bitmap_*() makes backports difficult as it was > > > > > > only recently introduced with no direct alternatives in older kernels. > > > > > > > > > > > > Fixes: fbe5e5f030c2 ("KVM: nSVM: Always recalculate LBR MSR intercepts in svm_update_lbrv()") > > > > > > Cc: stable@vger.kernel.org > > > > > > Signed-off-by: Yosry Ahmed > > > > > > > > > > Sigh.. I had this patch file in my working directory and it was sent by > > > > > mistake with the series, as the cover letter nonetheless. Sorry about > > > > > that. Let me know if I should resend. > > > > > > > > Eh, it's fine for now. The important part is clarfying that this patch should > > > > be ignored, which you've already done. > > > > > > FWIW that patch is already in Linus's tree so even if someone applies > > > it, it should be fine. > > > > Narrator: it wasn't fine. > > > > Please resend this series. The base-commit is garbage because your working tree > > was polluted with non-public patches, I can't quickly figure out what your "real" > > base was, and I don't have the bandwidth to manually work through the mess. > > > > In the future, please, please don't post patches against a non-public base. It > > adds a lot of friction on my end, and your series are quite literally the only > > ones I've had problems with in the last ~6 months. > > Sorry this keeps happening, I honestly don't know how it happened. In my > local repo the base commit is supposedly from your tree: > > $ git show 58e10b63777d0aebee2cf4e6c67e1a83e7edbe0f > > commit 58e10b63777d0aebee2cf4e6c67e1a83e7edbe0f > Merge: e0c26d47def7 297631388309 > Author: Sean Christopherson > Date: Mon Dec 8 14:58:37 2025 +0000 > > Merge branch 'fixes' > > * fixes: > KVM: nVMX: Immediately refresh APICv controls as needed on nested VM-Exit > KVM: VMX: Update SVI during runtime APICv activation > KVM: nSVM: Set exit_code_hi to -1 when synthesizing SVM_EXIT_ERR (failed VMRUN) > KVM: nSVM: Clear exit_code_hi in VMCB when synthesizing nested VM-Exits > KVM: Harden and prepare for modifying existing guest_memfd memslots > KVM: Disallow toggling KVM_MEM_GUEST_MEMFD on an existing memslot > KVM: selftests: Add a CPUID testcase for KVM_SET_CPUID2 with runtime updates > KVM: x86: Apply runtime updates to current CPUID during KVM_SET_CPUID{,2} > KVM: selftests: Add missing "break" in rseq_test's param parsing > > But then I cannot actually find it in your tree. Perhaps I rebased the > baseline patches accidentally :/ Argh. And now that I checked some of my other repositories, it looks like I have it in literally every repo _except_ the one I use to push to kvm-x86. Double argh. This is my fault. 12/08 lines up with the "KVM: x86 and guest_memfd fixes for 6.19" pull request I sent on 12/10. So it makes sense that the only branch merged into kvm-x86/next would be 'fixes'. I can only assume I forgot to tag that specific incarnation. So, my bad, and sorry for falsely accusing you. > Anyway, I rebased and retested on top of kvm-x86/next and will resend > shortly. Please do, even though I've now got this version applied locally; it'd be nice to have a conflict-free version. Again, my apologies.