From: Sean Christopherson <seanjc@google.com>
To: Shivansh Dhiman <shivansh.dhiman@amd.com>
Cc: pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com,
kvm@vger.kernel.org, x86@kernel.org, yosry@kernel.org,
jmattson@google.com, thomas.lendacky@amd.com,
nikunj.dadhania@amd.com, ravi.bangoria@amd.com,
santosh.shukla@amd.com
Subject: Re: [PATCH v4 0/5] KVM: SVM: Add Bus Lock Detect support and refactor LBRV
Date: Thu, 1 Oct 2026 16:11:49 -0700 [thread overview]
Message-ID: <ar7otaTgi8SYLUfF@google.com> (raw)
In-Reply-To: <e905df55-6d91-40f1-8761-6bcf600d8b7e@amd.com>
On Fri, Oct 02, 2026, Shivansh Dhiman wrote:
> On 26-09-26 04:31, Sean Christopherson wrote:
> (2) BLCKDB=0: DR6.BLD=0 is lost
>
> /* KUT test continued from above */
> write_dr6(0xffff07f0); /* DR6.BLD=0 */
> wrmsr(DEBUGCTL, 0);
> cpuid(0); /* unrelated #VMEXIT */
> read_dr6(); /* -> ffff0ff0 */
>
> #VMEXIT: exit_code=26, vmcb dr6=ffff0ff0
> VMRUN: vmcb dr6=ffff07f0, dbgctl=0, v_lbr=0
> #VMEXIT: exit_code=7b, vmcb dr6=ffff07f0
>
> KVM loads BLD=0, yet the guest reads BLD=1, so KVM isn't the one setting it.
> The VMCB still shows BLD=0 at the next #VMEXIT, though.
Yep. This is why I view this as a hardware/ucode flaw.
> I wanted to understand the practical side better, since I may well be missing
> something. My reading of APM 13.1.3.6 is that the processor clears DR6.BLD
> only for a bus lock #DB (so only while BLCKDB=1), and that system software
> then sets it back to 1 before returning to the interrupted task. I'm not
> sure if any software is intended to work by clearing DR6.BLD themselves.
It has to, because that's effectively what VMRUN does by loading DR6. It's not
as straightforward as MOV DR6 (obviously), but for all intents and purposes it's
still a software write.
> Are there any flows where a guest can end up with DR6.BLD=0 and BLCKDB=0? That
> would help me understand where this bites.
In practice, I doubt it will be problematic. But it's not completely absurd that
software might do something like temporarily disable DEBUGCTL.BUS_LOCK at the
start of its #DB handler, before reading DR6. That would work on bare metal and
*usually* work in a VM, but would cause the guest to "miss" a Bus Lock #DB if a
#VMEXIT hit between disabling DEBUGCTL.BUS_LOCK and reading DR6.
next prev parent reply other threads:[~2026-10-01 23:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 5:05 [PATCH v4 0/5] KVM: SVM: Add Bus Lock Detect support and refactor LBRV Shivansh Dhiman
2026-07-21 5:05 ` [PATCH v4 1/5] KVM: SVM: Refactor svm_update_lbrv() Shivansh Dhiman
2026-07-21 6:40 ` Nikunj A. Dadhania
2026-07-21 9:16 ` Shivansh Dhiman
2026-09-25 17:31 ` Sean Christopherson
2026-09-30 22:16 ` Shivansh Dhiman
2026-07-21 5:05 ` [PATCH v4 2/5] KVM: nSVM: Disable LBRV in nested control cache when unsupported Shivansh Dhiman
2026-07-21 5:05 ` [PATCH v4 3/5] KVM: nSVM: Sanitize nested DR6 using kvm_dr6_fixed() Shivansh Dhiman
2026-07-21 5:21 ` sashiko-bot
2026-09-25 17:26 ` Sean Christopherson
2026-09-25 17:39 ` Sean Christopherson
2026-09-30 22:16 ` Shivansh Dhiman
2026-07-21 5:05 ` [PATCH v4 4/5] KVM: SVM: Turn DEBUGCTL_RESERVED_BITS into a helper Shivansh Dhiman
2026-09-25 17:43 ` Sean Christopherson
2026-09-30 22:29 ` Shivansh Dhiman
2026-07-21 5:06 ` [PATCH v4 5/5] KVM: SVM: Add Bus Lock Detect support Shivansh Dhiman
2026-09-25 17:45 ` [PATCH v4 0/5] KVM: SVM: Add Bus Lock Detect support and refactor LBRV Sean Christopherson
2026-09-25 23:01 ` Sean Christopherson
2026-09-28 18:38 ` Shivansh Dhiman
2026-10-01 20:18 ` Shivansh Dhiman
2026-10-01 23:11 ` Sean Christopherson [this message]
2026-09-30 23:05 ` Shivansh Dhiman
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=ar7otaTgi8SYLUfF@google.com \
--to=seanjc@google.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=shivansh.dhiman@amd.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox