From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Maxim Levitsky <mlevitsk@redhat.com>,
Jim Mattson <jmattson@google.com>
Subject: [PATCH 6/6] KVM: x86: WARN if a vCPU gets a valid wakeup that KVM can't yet inject
Date: Fri, 7 Jun 2024 10:26:09 -0700 [thread overview]
Message-ID: <20240607172609.3205077-7-seanjc@google.com> (raw)
In-Reply-To: <20240607172609.3205077-1-seanjc@google.com>
WARN if a blocking vCPU is awaked by a valid wake event that KVM can't
inject, e.g. because KVM needs to completed a nested VM-enter, or needs to
re-inject an exception. For the nested VM-Enter case, KVM is supposed to
clear "nested_run_pending" if L1 puts L2 into HLT, i.e. entering HLT
"completes" the nested VM-Enter. And for already-injected exceptions, it
should be impossible for the vCPU to be in a blocking state if a VM-Exit
occurred while an exception was being vectored.
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
arch/x86/kvm/x86.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 82442960b499..f6ace2bd7124 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -11233,7 +11233,10 @@ static inline int vcpu_block(struct kvm_vcpu *vcpu)
* causes a spurious wakeup from HLT).
*/
if (is_guest_mode(vcpu)) {
- if (kvm_check_nested_events(vcpu) < 0)
+ int r = kvm_check_nested_events(vcpu);
+
+ WARN_ON_ONCE(r == -EBUSY);
+ if (r < 0)
return 0;
}
--
2.45.2.505.gda0bf45e8d-goog
next prev parent reply other threads:[~2024-06-07 17:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 17:26 [PATCH 0/6] KVM: nVMX: Fix nested posted intr vs. HLT Sean Christopherson
2024-06-07 17:26 ` [PATCH 1/6] KVM: nVMX: Add a helper to get highest pending from Posted Interrupt vector Sean Christopherson
2024-06-07 17:26 ` [PATCH 2/6] KVM: nVMX: Request immediate exit iff pending nested event needs injection Sean Christopherson
2024-06-07 17:26 ` [PATCH 3/6] KVM: VMX: Split out the non-virtualization part of vmx_interrupt_blocked() Sean Christopherson
2024-06-07 17:26 ` [PATCH 4/6] KVM: nVMX: Check for pending posted interrupts when looking for nested events Sean Christopherson
2024-06-07 17:26 ` [PATCH 5/6] KVM: nVMX: Fold requested virtual interrupt check into has_nested_events() Sean Christopherson
2024-06-07 17:26 ` Sean Christopherson [this message]
2024-06-28 22:55 ` [PATCH 0/6] KVM: nVMX: Fix nested posted intr vs. HLT Sean Christopherson
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=20240607172609.3205077-7-seanjc@google.com \
--to=seanjc@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.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®