From: Adrian Hunter <adrian.hunter@intel.com>
To: "Brown, Len" <len.brown@intel.com>
Cc: <pbonzini@redhat.com>, <kvm@vger.kernel.org>,
<rick.p.edgecombe@intel.com>, <kirill.shutemov@linux.intel.com>,
<kai.huang@intel.com>, <reinette.chatre@intel.com>,
<xiaoyao.li@intel.com>, <tony.lindgren@linux.intel.com>,
<binbin.wu@linux.intel.com>, <isaku.yamahata@intel.com>,
<linux-kernel@vger.kernel.org>, <yan.y.zhao@intel.com>,
<chao.gao@intel.com>, <ira.weiny@intel.com>,
"Sean Christopherson" <seanjc@google.com>
Subject: Re: [PATCH RFC 1/2] KVM: TDX: Disable general support for MWAIT in guest
Date: Mon, 18 Aug 2025 18:07:06 +0300 [thread overview]
Message-ID: <4bd07d7d-f4f8-4175-9384-d90b0e3c6e57@intel.com> (raw)
In-Reply-To: <aKMzEYR4t4Btd7kC@google.com>
On 18/08/2025 17:05, Sean Christopherson wrote:
> On Sat, Aug 16, 2025, Adrian Hunter wrote:
>> TDX support for using the MWAIT instruction in a guest has issues, so
>> disable it for now.
>>
>> Background
>>
>> Like VMX, TDX can allow the MWAIT instruction to be executed in a guest.
>> Unlike VMX, TDX cannot necessarily provide for virtualization of MSRs that
>> a guest might reasonably expect to exist as well.
>>
>> For example, in the case of a Linux guest, the default idle driver
>> intel_idle may access MSR_POWER_CTL or MSR_PKG_CST_CONFIG_CONTROL. To
>> virtualize those, KVM would need the guest not to enable #VE reduction,
>> which is not something that KVM can control or even be aware of. Note,
>> however, that the consequent unchecked MSR access errors might be harmless.
>>
>> Without #VE reduction enabled, the TDX Module will inject #VE for MSRs that
>> it does not virtualize itself. The guest can then hypercall the host VMM
>> for a resolution.
>>
>> With #VE reduction enabled, accessing MSRs such as the 2 above, results in
>> the TDX Module injecting #GP.
>>
>> Currently, Linux guest opts for #VE reduction unconditionally if it is
>> available, refer reduce_unnecessary_ve(). However, the #VE reduction
>> feature was not added to the TDX Module until versions 1.5.09 and 2.0.04.
>> Refer https://github.com/intel/tdx-module/releases
>>
>> There is also a further issue experienced by a Linux guest. Prior to
>> TDX Module versions 1.5.09 and 2.0.04, the Always-Running-APIC-Timer (ARAT)
>> feature (CPUID leaf 6: EAX bit 2) is not exposed. That results in cpuidle
>> disabling the timer interrupt and invoking the Tick Broadcast framework
>> to provide a wake-up. Currently, that falls back to the PIT timer which
>> does not work for TDX, resulting in the guest becoming stuck in the idle
>> loop.
>>
>> Conclusion
>>
>> User's may expect TDX support of MWAIT in a guest to be similar to VMX
>> support, but KVM cannot ensure that. Consequently KVM should not expose
>> the capability.
>>
>> Fixes: 0186dd29a2518 ("KVM: TDX: add ioctl to initialize VM with TDX specific parameters")
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>> ---
>
> NAK.
>
> Fix the guest, or wherever else in the pile there are issues. KVM is NOT carrying
> hack-a-fixes to workaround buggy software/firmware. Been there, done that.
Thanks for the quick reply. Adding Len Brown for intel_idle.
Len, you may recall that MSR_PKG_CST_CONFIG_CONTROL came up in
the following context:
https://bugzilla.kernel.org/show_bug.cgi?id=218792
https://lore.kernel.org/kvm/bug-218792-28872-5sylPIVpHD@https.bugzilla.kernel.org%2F/
For TDX platforms we would need _safe() MSR access for MSR_POWER_CTL
and MSR_PKG_CST_CONFIG_CONTROL. Would that be OK?
next prev parent reply other threads:[~2025-08-18 15:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-16 14:44 [PATCH RFC 0/2] KVM: TDX: " Adrian Hunter
2025-08-16 14:44 ` [PATCH RFC 1/2] KVM: TDX: Disable general support for " Adrian Hunter
2025-08-18 14:05 ` Sean Christopherson
2025-08-18 15:07 ` Adrian Hunter [this message]
2025-08-18 18:49 ` Edgecombe, Rick P
2025-08-19 5:40 ` Binbin Wu
2025-08-19 15:59 ` Edgecombe, Rick P
2025-08-28 10:11 ` Binbin Wu
2025-08-19 7:38 ` Adrian Hunter
2025-08-19 15:07 ` Edgecombe, Rick P
2025-08-19 23:35 ` Sean Christopherson
2025-08-20 1:31 ` Xiaoyao Li
2025-08-16 14:44 ` [PATCH RFC 2/2] KVM: TDX: Add flag to support MWAIT instruction only Adrian Hunter
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=4bd07d7d-f4f8-4175-9384-d90b0e3c6e57@intel.com \
--to=adrian.hunter@intel.com \
--cc=binbin.wu@linux.intel.com \
--cc=chao.gao@intel.com \
--cc=ira.weiny@intel.com \
--cc=isaku.yamahata@intel.com \
--cc=kai.huang@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=reinette.chatre@intel.com \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
--cc=tony.lindgren@linux.intel.com \
--cc=xiaoyao.li@intel.com \
--cc=yan.y.zhao@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®