From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F29D16A956 for ; Sun, 3 May 2026 12:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777810590; cv=none; b=YI/3T1VQIX+VyHegMrgrPiWdN//V1r76Z6bjSOz0tYTN1YBXyMyxp2NuWGa+l9sAoHRV61xW6sOGwBVuPJW1vssk9Kt0P6gWcil08pxD8ZCNPvENwJ2fz3LF8CzC9V7LXXn2jvR/izfuATArC6xfmTOpTNh9SkkVodyFYoVXMQ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777810590; c=relaxed/simple; bh=cTKQ6IxJc1vREqOnN0bown8FAB/083uZ6bE1ZSoEFGA=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=LyTAlA3otMesq1xPgQpX7hsS2UkI6OrZBxjBsMI28eyJXfHsYckXOLHpzWAmy7ZyDTNYxYNMNGCDEsOyTzyXgqnY0ih5Pmm3CPywPVrbSfjAYA4w0C5cz1+WKSPzVFIZ2o2p25Nq123akJl3Gj5HRCTFdJspgbLcOrPnKvhSJEg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1a5+vsCi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1a5+vsCi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61C0AC2BCB4; Sun, 3 May 2026 12:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777810589; bh=cTKQ6IxJc1vREqOnN0bown8FAB/083uZ6bE1ZSoEFGA=; h=Subject:To:Cc:From:Date:From; b=1a5+vsCio8AO6RHimS6fuxg7Q3eeFqs4mSRMxFU+1CJGvovnYwLfSZlSmMWVirWUW c7TqBZiQsoPDcm2QkkdFRHSyFn2eNZLLSSD3wcCFIhGtJRBBRt7okV0x2HE1uCJLaz PjbB96DLizYsakRoI3vSDRnW4pMw0t3ofr+1r/zQ= Subject: FAILED: patch "[PATCH] KVM: nSVM: Refactor checking LBRV enablement in vmcb12 into a" failed to apply to 5.10-stable tree To: yosry@kernel.org,seanjc@google.com Cc: From: Date: Sun, 03 May 2026 14:16:15 +0200 Message-ID: <2026050315-showplace-delegator-2681@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x 290c8d82023ab0e1d2782d37136541e017174d7c # git commit -s git send-email --to '' --in-reply-to '2026050315-showplace-delegator-2681@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 290c8d82023ab0e1d2782d37136541e017174d7c Mon Sep 17 00:00:00 2001 From: Yosry Ahmed Date: Tue, 3 Mar 2026 00:34:00 +0000 Subject: [PATCH] KVM: nSVM: Refactor checking LBRV enablement in vmcb12 into a helper Refactor the vCPU cap and vmcb12 flag checks into a helper. The unlikely() annotation is dropped, it's unlikely (huh) to make a difference and the CPU will probably predict it better on its own. CC: stable@vger.kernel.org Co-developed-by: Sean Christopherson Signed-off-by: Yosry Ahmed Link: https://patch.msgid.link/20260303003421.2185681-7-yosry@kernel.org Signed-off-by: Sean Christopherson diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 7a472d7c6e98..d419fd516fa9 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -640,6 +640,12 @@ void nested_vmcb02_compute_g_pat(struct vcpu_svm *svm) svm->nested.vmcb02.ptr->save.g_pat = svm->vmcb01.ptr->save.g_pat; } +static bool nested_vmcb12_has_lbrv(struct kvm_vcpu *vcpu) +{ + return guest_cpu_cap_has(vcpu, X86_FEATURE_LBRV) && + (to_svm(vcpu)->nested.ctl.virt_ext & LBR_CTL_ENABLE_MASK); +} + static void nested_vmcb02_prepare_save(struct vcpu_svm *svm, struct vmcb *vmcb12) { bool new_vmcb12 = false; @@ -704,8 +710,7 @@ static void nested_vmcb02_prepare_save(struct vcpu_svm *svm, struct vmcb *vmcb12 vmcb_mark_dirty(vmcb02, VMCB_DR); } - if (unlikely(guest_cpu_cap_has(vcpu, X86_FEATURE_LBRV) && - (svm->nested.ctl.virt_ext & LBR_CTL_ENABLE_MASK))) { + if (nested_vmcb12_has_lbrv(vcpu)) { /* * Reserved bits of DEBUGCTL are ignored. Be consistent with * svm_set_msr's definition of reserved bits. @@ -1233,8 +1238,7 @@ int nested_svm_vmexit(struct vcpu_svm *svm) if (!nested_exit_on_intr(svm)) kvm_make_request(KVM_REQ_EVENT, &svm->vcpu); - if (unlikely(guest_cpu_cap_has(vcpu, X86_FEATURE_LBRV) && - (svm->nested.ctl.virt_ext & LBR_CTL_ENABLE_MASK))) { + if (nested_vmcb12_has_lbrv(vcpu)) { svm_copy_lbrs(&vmcb12->save, &vmcb02->save); } else { svm_copy_lbrs(&vmcb01->save, &vmcb02->save);