From: Sean Christopherson <seanjc@google.com>
To: Adrian Hunter <adrian.hunter@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
Subject: Re: [PATCH RFC 1/2] KVM: TDX: Disable general support for MWAIT in guest
Date: Mon, 18 Aug 2025 07:05:57 -0700 [thread overview]
Message-ID: <aKMzEYR4t4Btd7kC@google.com> (raw)
In-Reply-To: <20250816144436.83718-2-adrian.hunter@intel.com>
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.
next prev parent reply other threads:[~2025-08-18 14:06 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: MWAIT in guest 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 [this message]
2025-08-18 15:07 ` Adrian Hunter
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=aKMzEYR4t4Btd7kC@google.com \
--to=seanjc@google.com \
--cc=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=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=reinette.chatre@intel.com \
--cc=rick.p.edgecombe@intel.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;
as well as URLs for NNTP newsgroup(s).