Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"seanjc@google.com" <seanjc@google.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
	"kas@kernel.org" <kas@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"nik.borisov@suse.com" <nik.borisov@suse.com>
Subject: Re: [PATCH v4 2/9] KVM: TDX: Check if there is valid exit infos based on vp_enter_ret
Date: Thu, 20 Aug 2026 09:53:16 +0800	[thread overview]
Message-ID: <4fb37a2a-a069-4d73-9df1-b4fc250437ff@intel.com> (raw)
In-Reply-To: <71de12296f46dec7753f9dec2ac08df97b49e8b8.camel@intel.com>

On 8/20/2026 12:39 AM, Edgecombe, Rick P wrote:
> On Wed, 2026-08-19 at 17:48 +0800, Xiaoyao Li wrote:
>> Check if there is valid exit info based on vp_enter_ret instead of relying
>> on the clobbered Exit Reason, in tdx_get_exit_info().
>>
>> Current KVM uses "Exit Reason is not equal to the synthesized invalid
>> Exit Reason, -1u," as the condition to identify there is a real TD Exit
>> and valid exit infos.  However, there is one issue with this approach:
>> KVM updates the Exit Reason to the synthesized invalid Exit Reason for
>> real EPT MISCONFIG as well.  This is a false positive for real EPT
>> MISCONFIG, which has valid exit infos.
>>
>> Though the issue can be addressed by changing the handling for real EPT
>> MISCONFIG to not update the Exit Reason to the synthesized one, relying
>> on the clobbered Exit Reason itself is brittle.  Instead, check
>> vp_enter_ret directly to identify if it is a valid Exit Reason.
>>
>> Fixes: da407fe45908 ("KVM: TDX: Handle EPT violation/misconfig exit")
>> Cc: stable@vger.kernel.org
>> Suggested-by: Sean Christopherson <seanjc@google.com>
>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>> ---
> 
> This series has grown unfortunately, and I wasn't able to catch up on the
> threads from yesterday. Can we really not put this one in the non-stable patches
> at the end? Or maybe you can explain why it's needed?

It was suggested[1] (or requested) by Sean.

I agree that it's not mandatory for enabling Bus Lock VM exit for TDX. 
But considering that without this patch, both patch 3 and patch 4 need 
to change the line

	if (*reason != -1u)

in tdx_get_exit_info(), which brings unnecessary code churn. And given 
the patch number needs to increase anyway in this v4. So I just put this 
patch in to make patch 3 and patch 4 simpler.

[1] https://lore.kernel.org/all/an0N0vHwsYEqjpRe@google.com/

> Also "KVM: VMX: Preserve negative return value in vmx_handle_exit() with bus
> lock detected"?

It was suggested[2] by Sean.

(Since there are discussions happening in the cover letter thread about 
it. Let's continue the discussion there.)

[2] https://lore.kernel.org/all/an0KokdtSXE2GmM1@google.com/

  reply	other threads:[~2026-08-20  1:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19  9:48 [PATCH v4 0/9] KVM: TDX: Enable VM-DoS Prevention Features for TDX Xiaoyao Li
2026-08-19  9:48 ` [PATCH v4 1/9] KVM: TDX: Enable Notify VM exit Xiaoyao Li
2026-08-19  9:48 ` [PATCH v4 2/9] KVM: TDX: Check if there is valid exit infos based on vp_enter_ret Xiaoyao Li
2026-08-19 16:39   ` Edgecombe, Rick P
2026-08-20  1:53     ` Xiaoyao Li [this message]
2026-08-19  9:48 ` [PATCH v4 3/9] KVM: TDX: Set bits 31:16 to 0 for the synthesized Exit Reason Xiaoyao Li
2026-08-19  9:48 ` [PATCH v4 4/9] KVM: TDX: Don't assume exit_reason[31:16] is all-0 in tdx_to_vmx_exit_reason() Xiaoyao Li
2026-08-19 10:16   ` sashiko-bot
2026-08-19  9:48 ` [PATCH v4 5/9] KVM: TDX: Update exit_reason on wait_for_sept_zap return Xiaoyao Li
2026-08-19 19:08   ` Edgecombe, Rick P
2026-08-19  9:49 ` [PATCH v4 6/9] KVM: VMX: Preserve negative return value in vmx_handle_exit() with bus lock detected Xiaoyao Li
2026-08-19  9:49 ` [PATCH v4 7/9] KVM: VMX: Make handle_bus_lock_vmexit() a shared helper Xiaoyao Li
2026-08-19  9:49 ` [PATCH v4 8/9] KVM: TDX: Enable Bus Lock VM exit Xiaoyao Li
2026-08-19  9:49 ` [PATCH v4 9/9] KVM: VMX: Consolidate the exit handler for VMX and TDX Xiaoyao Li
2026-08-19 22:57 ` [PATCH v4 0/9] KVM: TDX: Enable VM-DoS Prevention Features for TDX Edgecombe, Rick P
2026-08-19 23:03   ` Sean Christopherson
2026-08-19 23:08     ` Edgecombe, Rick P

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=4fb37a2a-a069-4d73-9df1-b4fc250437ff@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=kas@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nik.borisov@suse.com \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=seanjc@google.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