From: Nikolay Borisov <nik.borisov@suse.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Kiryl Shutsemau <kas@kernel.org>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: TDX: Enable Notify VM exit
Date: Thu, 6 Aug 2026 16:33:20 +0300 [thread overview]
Message-ID: <82482276-0140-4d90-a983-fdfc5bc2e4a5@suse.com> (raw)
In-Reply-To: <20260805031257.1844914-2-xiaoyao.li@intel.com>
On 8/5/26 06:12, Xiaoyao Li wrote:
> Enable Notify VM exit functionality for TDX guests.
>
> Notify VM exit is an existing feature supported by KVM. Userspace can
> enable Notify VM exit through KVM_CAP_X86_NOTIFY_VMEXIT when it's
> reported as supported. However, KVM reports the support of this CAP just
> based on the hardware capability but doesn't differentiate between VMX
> and TDX. This leads to the issue that userspace can enable this cap for
> TDX guests without getting an error, but the feature is not actually
> enabled because KVM doesn't call the TDX module API to program the
> relevant TD VMCS fields.
>
> Enable Notify VM exit for TDX guests by:
>
> - Invoking TDX module API calls to set NOTIFY_VM_EXITING and Notify
> Window in TD VMCS. It's done in tdx_vcpu_init() where other TD VMCS
> bits are set. Since TDX vCPU cannot be reset, it only needs to be
> configured once when initializing the TDX vCPU.
>
> - Adding corresponding exit handler for TDX Notify VM Exit.
nit: That feature is completely misnamed in the kernel. It should be
instruction timeout (as is in the SDM). Please reword the changelog to
refer to the name of the features as they are in the SDM. I.e if you
search for NOTIFY_VMEXIT or NOTIFY_WINDOW absolutely nothing can be
found in the SDM. The changelog should ideally mention both - SDM's
nomenclature and linux's nomenclature.
>
> Note, Notify VM exit can happen when executing the IRET instruction. If
> the IRET unblocks the NMI blocking state, bit 12 of the exit qualification
> is set. In this case, the VMM needs to restore the "blocked by NMI" state
> when it decides to re-enter the guest. For TDX, KVM cannot manage the
> GUEST_INTERRUPTIBILITY_INFO and it's TDX module's responsibility to
> handle it.
>
> Fixes: 161d34609f9b ("KVM: TDX: Make TDX VM type supported")
> Cc: stable@vger.kernel.org
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
> The enabling of Notify VM exit was missed in the initial upstreaming of
> TDX base support. We suppose the patch needs to be backported to
> stable kernels. So, the cc stable is added.
> ---
> arch/x86/kvm/vmx/tdx.c | 10 ++++++++++
> arch/x86/kvm/vmx/vmx.c | 23 +++++++++++++++--------
> arch/x86/kvm/vmx/vmx.h | 1 +
> 3 files changed, 26 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index 545b03d9d10b..cdc0d24657ac 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -2129,6 +2129,9 @@ int tdx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t fastpath)
> * - If it's not an MSMI, no need to do anything here.
> */
> return 1;
> + case EXIT_REASON_NOTIFY:
> + /* NMI blocking state is handled by TDX module */
> + return __handle_notify(vcpu, false);
I'd rather there be a private handle_tdx_notify function in tdx.c than
exposing __handle_notify and introducing the boolean. This is needed
because the TDX module handles the NMI unblocking, so let's keep the
implementation specific to tdx.
<snip>
next prev parent reply other threads:[~2026-08-06 13:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 3:12 [PATCH 0/2] KVM: TDX: Enable VM-DoS Prevention Features for TDX Xiaoyao Li
2026-08-05 3:12 ` [PATCH 1/2] KVM: TDX: Enable Notify VM exit Xiaoyao Li
2026-08-06 13:33 ` Nikolay Borisov [this message]
2026-08-06 13:50 ` Sean Christopherson
2026-08-07 0:27 ` Edgecombe, Rick P
2026-08-07 0:32 ` Sean Christopherson
2026-08-07 1:07 ` Xiaoyao Li
2026-08-07 6:46 ` Nikolay Borisov
2026-08-07 1:06 ` Xiaoyao Li
2026-08-07 14:38 ` Sean Christopherson
2026-08-05 3:12 ` [PATCH 2/2] KVM: TDX: Enable Bus Lock " 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=82482276-0140-4d90-a983-fdfc5bc2e4a5@suse.com \
--to=nik.borisov@suse.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
--cc=xiaoyao.li@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®