From: "Pratik R. Sampat" <prsampat@amd.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org, tglx@kernel.org, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, pbonzini@redhat.com,
thomas.lendacky@amd.com, kim.phillips@amd.com, nikunj@amd.com,
michael.roth@amd.com, ashish.kalra@amd.com
Subject: Re: [PATCH 1/3] KVM: SVM: Re-queue events that were never injected
Date: Tue, 22 Sep 2026 16:45:02 -0400 [thread overview]
Message-ID: <55683a14-5888-43e5-8e73-04c85d2750ff@amd.com> (raw)
In-Reply-To: <arEuMojZa_kv9VXA@google.com>
On 9/21/26 9:16 AM, Sean Christopherson wrote:
> On Mon, Sep 14, 2026, Pratik R. Sampat wrote:
>> When injecting an event into the guest via the event_inj field, a
>> non-zero event_inj value on #VMEXIT means that the hardware was not able
>> to inject the event into the guest. This used to only occur for the
>> VMEXIT_INVALID intercept code, which was a fatal error and resulted in
>> the guest being torn down.
>>
>> Enhanced SMT Protection (ESMTP) invalidates that assumption. When ESMTP
>> is enabled, VMRUN doesn't enter guest mode immediately; it stalls at a
>> synchronization point until every sibling thread is either idle or has
>> executed VMRUN for a legal sibling vCPU. If an ESMTP timeout / illegal
>> sibling exit / interrupt arrives while VMRUN is stalled, VMRUN can now
>> terminate with the corresponding #VMEXIT intercept code, without
>> entering guest mode, and thus without injecting the event.
>>
>> For example, on a 2-way SMT core running vCPU0 on thread 0 and vCPU1 on
>> thread 1:
>> Thread 0 (vCPU0) Thread 1 (vCPU1)
>> ---------------- ----------------
>> Interrupt A injected to the guest in host
>> VMRUN |
>> | |
>> v |
>> Stall waiting for sibling |
>> | |
>> | host INTR arrives on thread 0 |
>> | while it waits |
>> | |
>> v |
>> #VMEXIT v
>> Interrupt B injected to the guest idle
>> VMRUN
>
> So how is KVM_RUN_FORCE_IMMEDIATE_EXIT supposed to work?
I don't think KVM_RUN_FORCE_IMMEDIATE_EXIT should be affected negatively right?
On SVM, it queues a self-IPI before VMRUN. Normally, VMRUN enters the guest,
consumes EVENTINJ, and then exits with VMEXIT_INTR; EXITINTINFO may describe
interrupted event delivery.
With ESMTP, the pending IPI could terminate a stalled VMRUN before guest entry.
EVENTINJ would remain valid, and this patch would requeue it for another
attempt. That should preserve the intended behavior across retries. Of course,
progress would still be gated on it being a legal sibling to begin with, but
that should be fine.
Thanks,
--Pratik
next prev parent reply other threads:[~2026-09-22 20:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 16:55 [PATCH 0/3] Introduce Enhanced SMT Protection for SEV-SNP Pratik R. Sampat
2026-09-14 16:55 ` [PATCH 1/3] KVM: SVM: Re-queue events that were never injected Pratik R. Sampat
2026-09-21 13:16 ` Sean Christopherson
2026-09-22 20:45 ` Pratik R. Sampat [this message]
2026-09-14 16:55 ` [PATCH 2/3] KVM: SVM: Add host support for Enhanced SMT Protection Pratik R. Sampat
2026-09-16 19:56 ` Borislav Petkov
2026-09-17 15:07 ` Pratik R. Sampat
2026-09-14 16:55 ` [PATCH 3/3] x86/sev: Add guest " Pratik R. Sampat
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=55683a14-5888-43e5-8e73-04c85d2750ff@amd.com \
--to=prsampat@amd.com \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=kim.phillips@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@kernel.org \
--cc=thomas.lendacky@amd.com \
--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
all inboxes | Powered by JetHome®