From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Xiaoyao Li <xiaoyao.li@intel.com>,
rangemachine@gmail.com, whanos@sergal.fun,
Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH v2 3/5] KVM: SVM: Manually context switch DEBUGCTL if LBR virtualization is disabled
Date: Thu, 27 Feb 2025 20:14:21 +0530 [thread overview]
Message-ID: <f560ecab-c1bd-483e-9cd6-f6fb4127b8b8@amd.com> (raw)
In-Reply-To: <Z8B2yWTva-B2Lfqt@google.com>
>> Somewhat related but independent: CPU automatically clears DEBUGCTL[BTF]
>> on #DB exception. So, when DEBUGCTL is save/restored by KVM (i.e. when
>> LBR virtualization is disabled), it's KVM's responsibility to clear
>> DEBUGCTL[BTF].
>> ---
>> @@ -2090,6 +2090,14 @@ static int db_interception(struct kvm_vcpu *vcpu)
>> (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) &&
>> !svm->nmi_singlestep) {
>> u32 payload = svm->vmcb->save.dr6 ^ DR6_ACTIVE_LOW;
>> +
>> + /*
>> + * CPU automatically clears DEBUGCTL[BTF] on #DB exception.
>> + * Simulate it when DEBUGCTL isn't auto save/restored.
>> + */
>> + if (!(svm->vmcb->control.virt_ext & LBR_CTL_ENABLE_MASK))
>> + svm->vmcb->save.dbgctl &= ~0x2;
>
> Any reason not to clear is unconditionally?
>
> svm->vmcb->save.dbgctl &= ~DEBUGCTLMSR_BTF;
No particular reason, just that HW would have already done it when LBRV
is enabled.
Thanks,
Ravi
next prev parent reply other threads:[~2025-02-27 14:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 1:13 [PATCH v2 0/5] KVM: SVM: Fix DEBUGCTL bugs Sean Christopherson
2025-02-27 1:13 ` [PATCH v2 1/5] KVM: SVM: Drop DEBUGCTL[5:2] from guest's effective value Sean Christopherson
2025-02-27 1:13 ` [PATCH v2 2/5] KVM: x86: Snapshot the host's DEBUGCTL in common x86 Sean Christopherson
2025-02-27 1:13 ` [PATCH v2 3/5] KVM: SVM: Manually context switch DEBUGCTL if LBR virtualization is disabled Sean Christopherson
2025-02-27 13:59 ` Ravi Bangoria
2025-02-27 14:09 ` Ravi Bangoria
2025-02-27 14:30 ` Sean Christopherson
2025-02-27 17:20 ` Sean Christopherson
2025-02-27 17:55 ` Sean Christopherson
2025-02-27 14:29 ` Sean Christopherson
2025-02-27 14:44 ` Ravi Bangoria [this message]
2025-02-27 1:13 ` [PATCH v2 4/5] KVM: x86: Snapshot the host's DEBUGCTL after disabling IRQs Sean Christopherson
2025-02-27 1:13 ` [PATCH v2 5/5] KVM: SVM: Treat DEBUGCTL[5:2] as reserved Sean Christopherson
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=f560ecab-c1bd-483e-9cd6-f6fb4127b8b8@amd.com \
--to=ravi.bangoria@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rangemachine@gmail.com \
--cc=seanjc@google.com \
--cc=whanos@sergal.fun \
--cc=xiaoyao.li@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®