From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Kiryl Shutsemau <kas@kernel.org>
Cc: x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev,
kvm@vger.kernel.org, Reinette Chatre <reinette.chatre@intel.com>,
Chenyi Qiang <chenyi.qiang@intel.com>,
chao.p.peng@intel.com, xiaoyao.li@intel.com
Subject: [PATCH 0/2] x86/split_lock: Fix and enhancement for TDX guest
Date: Wed, 26 Nov 2025 18:02:02 +0800 [thread overview]
Message-ID: <20251126100205.1729391-1-xiaoyao.li@intel.com> (raw)
Running a split lock test[1] inside a TDX guest under KVM triggers the
warning below. The test hangs but can be terminated.
x86/split lock detection: #AC: split_lock/1176 took a split_lock trap at address: 0x5630b30921f9
unchecked MSR access error: WRMSR to 0x33 (tried to write 0x0000000000000000) at rIP: 0xffffffff812a061f (native_write_msr+0xf/0x30)
Call Trace:
handle_user_split_lock
exc_alignment_check
asm_exc_alignment_check
It turns out that split lock detection is enabled (by the host) when the
TDX vCPU is running, and #AC is not intercepted but delivered directly to
the TDX guest. The default "warning" mode of split lock #AC handler in
the guest tries to handle the split lock by temporarily disabling
detection. However, the MSR that disables detection is not accessible to
a guest.
Patch 1 forces the TDX guest to always treat the split lock #AC as the
"fatal" mode. This prevents the TDX guest from attempting invalid MSR
writes.
Patch 2 enhances the sld_state_show() to indicate that the TDX guest can
receive #AC on split locks depending on the host's split lock detection
configuration.
Note that all the split lock issues on TDX guests are due to the
non-architectural behavior of TDX: a TDX guest can receive #AC even
though the split lock detection feature is not available and the
relevant MSR is not accessible.
One option is to make the behavior architectural for TDX guests by not
delivering the (unexpected) #AC to the TDX guest and letting the host
handle it instead. This is exactly how KVM handles split lock #AC for
normal VMs. This option also has the advantage that the TDX guest can
survive from split locks when the host mode is not fatal.
However, this option cannot replace current patches because it changes
the behavior of current TDX and would need to be opted-in by the host VMM
for compatibility. More importantly, it would be a new feature available
only in newer TDX modules, which means all existing TDX modules
cannot benefit from it.
We list the option here as an open to solicit feedback and determine
whether to pursue adding such feature to TDX module.
[1] https://github.com/xiaoyaoli-intel/splitlock/blob/main/splitlock.c
Xiaoyao Li (2):
x86/split_lock: Don't try to handle user split lock in TDX guest
x86/split_lock: Describe #AC handling in TDX guest kernel log
arch/x86/kernel/cpu/bus_lock.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
base-commit: ac3fd01e4c1efce8f2c054cdeb2ddd2fc0fb150d
--
2.43.0
next reply other threads:[~2025-11-26 10:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 10:02 Xiaoyao Li [this message]
2025-11-26 10:02 ` [PATCH 1/2] x86/split_lock: Don't try to handle user split lock in " Xiaoyao Li
2025-11-26 11:25 ` Kiryl Shutsemau
2025-11-26 12:17 ` Xiaoyao Li
2025-11-26 13:35 ` Kiryl Shutsemau
2025-11-27 2:00 ` Xiaoyao Li
2025-11-27 16:16 ` Kiryl Shutsemau
2025-11-27 16:55 ` Andrew Cooper
2025-11-28 2:40 ` Xiaoyao Li
2025-11-28 2:28 ` Xiaoyao Li
2025-12-17 10:56 ` Xiaoyao Li
2025-11-26 10:02 ` [PATCH 2/2] x86/split_lock: Describe #AC handling in TDX guest kernel log Xiaoyao Li
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=20251126100205.1729391-1-xiaoyao.li@intel.com \
--to=xiaoyao.li@intel.com \
--cc=bp@alien8.de \
--cc=chao.p.peng@intel.com \
--cc=chenyi.qiang@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=reinette.chatre@intel.com \
--cc=rick.p.edgecombe@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@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
all inboxes | Powered by JetHome®