From: Shivansh Dhiman <shivansh.dhiman@amd.com>
To: Yosry Ahmed <yosry@kernel.org>
Cc: <seanjc@google.com>, <pbonzini@redhat.com>, <tglx@linutronix.de>,
<mingo@redhat.com>, <kvm@vger.kernel.org>, <x86@kernel.org>,
<yosry.ahmed@linux.dev>, <jmattson@google.com>,
<thomas.lendacky@amd.com>, <nikunj.dadhania@amd.com>,
<ravi.bangoria@amd.com>, <santosh.shukla@amd.com>,
Shivansh Dhiman <shivansh.dhiman@amd.com>
Subject: Re: [PATCH v3 1/5] KVM: SVM: Refactor svm_update_lbrv()
Date: Mon, 13 Jul 2026 11:55:12 +0530 [thread overview]
Message-ID: <eb51c52e-5b58-46df-9b60-0054851a38cd@amd.com> (raw)
In-Reply-To: <CAO9r8zOE6m-G8fmNSTnCcvXpzYvR8Egx3PkM2uSaJcZj8PVLqA@mail.gmail.com>
On 10-07-26 01:23, Yosry Ahmed wrote:
> On Thu, Jul 9, 2026 at 1:31 AM Shivansh Dhiman <shivansh.dhiman@amd.com> wrote:
>>
>> Rewrite the enable_lbrv computation in svm_update_lbrv() as a series of
>> 'if' statements, and use nested_vmcb12_has_lbrv() instead of open-coding
>> the nested LBRV check.
>>
>> No functional change intended.
>>
>> Suggested-by: Yosry Ahmed <yosry@kernel.org>
>> Signed-off-by: Shivansh Dhiman <shivansh.dhiman@amd.com>
>> ---
>> Changelog:
>> v3:
>> * New patch.
>> * Refactor the enable_lbrv computation into 'if' statements (Yosry Ahmed).
>>
>> ---
>> arch/x86/kvm/svm/nested.c | 2 +-
>> arch/x86/kvm/svm/svm.c | 10 +++++++---
>> arch/x86/kvm/svm/svm.h | 1 +
>> 3 files changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
>> index c1485c3e691c..d3df6b22bfef 100644
>> --- a/arch/x86/kvm/svm/nested.c
>> +++ b/arch/x86/kvm/svm/nested.c
>> @@ -736,7 +736,7 @@ static int nested_svm_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3,
>> return 0;
>> }
>>
>> -static bool nested_vmcb12_has_lbrv(struct kvm_vcpu *vcpu)
>> +bool nested_vmcb12_has_lbrv(struct kvm_vcpu *vcpu)
>
> We might wanna rename this function now that we are exposing it
> outside of nested.c, but otherwise this looks good to me:
Agreed, will rename it to nested_lbrv_enabled() in v4.
>
> Reviewed-by: Yosry Ahmed <yosry@kernel.org>
Thanks for the review!
>
>> {
>> return guest_cpu_cap_has(vcpu, X86_FEATURE_LBRV) &&
>> (to_svm(vcpu)->nested.ctl.misc_ctl2 & SVM_MISC2_ENABLE_V_LBR);
next prev parent reply other threads:[~2026-07-13 6:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 8:29 [PATCH v3 0/5] KVM: SVM: Add Bus Lock Detect support and refactor LBRV Shivansh Dhiman
2026-07-09 8:29 ` [PATCH v3 1/5] KVM: SVM: Refactor svm_update_lbrv() Shivansh Dhiman
2026-07-09 19:53 ` Yosry Ahmed
2026-07-13 6:25 ` Shivansh Dhiman [this message]
2026-07-09 8:29 ` [PATCH v3 2/5] KVM: nSVM: Disable LBRV in nested control cache when unsupported Shivansh Dhiman
2026-07-09 8:50 ` sashiko-bot
2026-07-09 19:42 ` Yosry Ahmed
2026-07-14 14:31 ` Shivansh Dhiman
2026-07-09 19:48 ` Yosry Ahmed
2026-07-13 6:28 ` Shivansh Dhiman
2026-07-09 8:29 ` [PATCH v3 3/5] KVM: nSVM: Sanitize nested DR6 using kvm_dr6_fixed() Shivansh Dhiman
2026-07-09 8:51 ` sashiko-bot
2026-07-13 6:47 ` Shivansh Dhiman
2026-07-14 10:02 ` Nikunj A. Dadhania
2026-07-14 15:52 ` Shivansh Dhiman
2026-07-09 8:29 ` [PATCH v3 4/5] KVM: SVM: Compute DEBUGCTL reserved bits dynamically Shivansh Dhiman
2026-07-09 8:44 ` sashiko-bot
2026-07-13 7:05 ` Shivansh Dhiman
2026-07-09 8:29 ` [PATCH v3 5/5] KVM: SVM: Add Bus Lock Detect support Shivansh Dhiman
2026-07-09 8:55 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eb51c52e-5b58-46df-9b60-0054851a38cd@amd.com \
--to=shivansh.dhiman@amd.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nikunj.dadhania@amd.com \
--cc=pbonzini@redhat.com \
--cc=ravi.bangoria@amd.com \
--cc=santosh.shukla@amd.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
--cc=yosry.ahmed@linux.dev \
--cc=yosry@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.