From: Sean Christopherson <seanjc@google.com>
To: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: pbonzini@redhat.com, nikunj.dadhania@amd.com,
manali.shukla@amd.com, dapeng1.mi@intel.com,
srikanth.aithal@amd.com, kvm@vger.kernel.org,
santosh.shukla@amd.com
Subject: Re: [kvm-unit-tests RFC] x86: Fix "debug" test on AMD uArch
Date: Mon, 24 Feb 2025 07:28:23 -0800 [thread overview]
Message-ID: <Z7yQFz3niLKXIdOQ@google.com> (raw)
In-Reply-To: <20250224112601.6504-1-ravi.bangoria@amd.com>
On Mon, Feb 24, 2025, Ravi Bangoria wrote:
> As per the AMD APM[1], DR6[BusLockDetect] bit is unmodified for any source
> of #DB exception other than Bus Lock (and AMD HW is working correctly as
> per the spec).
>
> KUT debug test initializes DR6[BusLockDetect] with 0 before executing each
> test and thus the bit remains 0 at the #DB exception for sources other
> than Bus Lock. Since DR6[BusLockDetect] bit has opposite polarity, as in,
> value 0 indicates the condition, KUT tests are interpreting it as #DB due
> to Bus Lock and thus they are failing.
>
> Fix this by initializing DR6 with a valid default value before running the
> test.
The test is weird, but as-is it's correct. The APM does a poor job of stating
the exact behavior, but DR6[11] should never go to '0' if BusLockTrap is disabled,
even if software explicitly writes '0'. Any other behavior would break backwards
compatibility with existing software (as evidenced by the test failing).
Editing to omit irrelevant snippets:
Software enables bus lock trap by setting DebugCtl MSR[BLCKDB] (bit 2) to 1
When bus lock trap is enabled, ... The processor indicates that this #DB was
caused by a bus lock by clearing DR6[BLD] (bit 11). DR6[11] previously had
been defined to be always 1.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The test fails because the host leaves DebugCtl.BLCKDB, a.k.a. BusLockDetect,
enabled. With my to-be-posted change to manually clear DebugCtl prior to VMRUN,
the test passes.
prev parent reply other threads:[~2025-02-24 15:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 11:26 [kvm-unit-tests RFC] x86: Fix "debug" test on AMD uArch Ravi Bangoria
2025-02-24 15:28 ` Sean Christopherson [this message]
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=Z7yQFz3niLKXIdOQ@google.com \
--to=seanjc@google.com \
--cc=dapeng1.mi@intel.com \
--cc=kvm@vger.kernel.org \
--cc=manali.shukla@amd.com \
--cc=nikunj.dadhania@amd.com \
--cc=pbonzini@redhat.com \
--cc=ravi.bangoria@amd.com \
--cc=santosh.shukla@amd.com \
--cc=srikanth.aithal@amd.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