From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>, kas@kernel.org
Cc: bp@alien8.de, chao.p.peng@intel.com, chenyi.qiang@intel.com,
dave.hansen@linux.intel.com, hpa@zytor.com, kvm@vger.kernel.org,
linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org,
mingo@redhat.com, reinette.chatre@intel.com,
rick.p.edgecombe@intel.com, tglx@linutronix.de, x86@kernel.org
Subject: Re: [PATCH 1/2] x86/split_lock: Don't try to handle user split lock in TDX guest
Date: Fri, 28 Nov 2025 10:40:14 +0800 [thread overview]
Message-ID: <6105befe-cb9c-45d3-8536-c0aab63e1b57@intel.com> (raw)
In-Reply-To: <4676722f-98a3-4217-a357-068440dc6e14@citrix.com>
Hi Andrew,
On 11/28/2025 12:55 AM, Andrew Cooper wrote:
>> I am not sure. Leaving it as produces produces false messages which is
>> not good, but not critical.
>>
>> Maybe just clear X86_FEATURE_BUS_LOCK_DETECT and stop pretending we
>> control split-lock behaviour from the guest?
>
> (Having just played with this mess for another task) you're talking
> about two different things.
>
> Sapphire Rapids has an architectural BUS_LOCK_DETECT (trap semantics,
> #DB or VMExit), and a model-specific BUS_LOCK_DISABLE.
>
> It's BUS_LOCK_DISABLE which generates #AC, with fault semantics,
> preventing forward progress. It also means the Bus Lock didn't happen,
> and there's nothing to trigger the BUS_LOCK_DETECT (trap) behaviour.
>
> Given that TDX is enabling BUS_LOCK_DISABLE, it's probably also enabling
> UC_LOCK_DISABLE (causes #GP) too.
Well, more accurate, it's SPLIT_LOCK_DISABLE, not BUS_LOCK_DISABLE.(bus
lock have two types: split lock and uc lock)
No, it's not TDX who is enabling SPLIT_LOCK_DISABLE, but the host. The
default mode of Linux is "warn", so that by default the host Linux
enables SPLIT_LOCK_DISABLE. And TDX module doesn't context switch
MSR_TEST_CTRL when entering into the TDX vCPU because MSR_TEST_CTRL is
not virtualizable. Thus SPLIT_LOCK_DISABLE remains enabled when TDX vCPU
is running.
Regarding UC_LOCK_DISABLE, Linux doesn't enable it. Not sure if BIOS
enables it or not (as far as I know, I don't see any bios enables it)
> Looking at the backtrace:
>
> 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)
>
>
> First, "took a split_lock trap" is wrong. It's a fault, not a trap.
Hi x86 maintainers,
Should we fix it?
> Second, because the attempt to disable BUS_LOCK_DISABLE was blocked,
> simply retrying the instruction will generate a new #AC and livelock.
> Linux probably ought to raise SIGSEGV with userspace, for want of
> anything better to do.
This patch is just achieving this, while it raises the SIGBUS to userspace.
> It looks like software in a TDX VM will simply have to accept that it
> cannot cause a bus lock.
If the host doesn't enable SPLIT_LOCK_DISABLE, then split lock might not
be fatal to TDX guests.
> ~Andrew
next prev parent reply other threads:[~2025-11-28 2:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 10:02 [PATCH 0/2] x86/split_lock: Fix and enhancement for TDX guest Xiaoyao Li
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 [this message]
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=6105befe-cb9c-45d3-8536-c0aab63e1b57@intel.com \
--to=xiaoyao.li@intel.com \
--cc=andrew.cooper3@citrix.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