From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] KVM: x86: Check for in-kernel xAPIC when querying APICv for directed yield
Date: Tue, 14 Jun 2022 23:05:46 +0000 [thread overview]
Message-ID: <20220614230548.3852141-4-seanjc@google.com> (raw)
In-Reply-To: <20220614230548.3852141-1-seanjc@google.com>
Use kvm_vcpu_apicv_active() to check if APICv is active when seeing if a
vCPU is a candidate for directed yield due to a pending ACPIv interrupt.
This will allow moving apicv_active into kvm_lapic without introducing a
potential NULL pointer deref (kvm_vcpu_apicv_active() effectively adds a
pre-check on the vCPU having an in-kernel APIC).
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
arch/x86/kvm/x86.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2318a99139fa..cd554a62eb0f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -12375,7 +12375,8 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
bool kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu)
{
- if (vcpu->arch.apicv_active && static_call(kvm_x86_dy_apicv_has_pending_interrupt)(vcpu))
+ if (kvm_vcpu_apicv_active(vcpu) &&
+ static_call(kvm_x86_dy_apicv_has_pending_interrupt)(vcpu))
return true;
return false;
--
2.36.1.476.g0c4daa206d-goog
next prev parent reply other threads:[~2022-06-14 23:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 23:05 [PATCH 0/5] KVM: x86: Move apicv_active into kvm_lapic Sean Christopherson
2022-06-14 23:05 ` [PATCH 1/5] KVM: SVM: Drop unused AVIC / kvm_x86_ops declarations Sean Christopherson
2022-06-14 23:05 ` [PATCH 2/5] KVM: x86: Drop @vcpu parameter from kvm_x86_ops.hwapic_isr_update() Sean Christopherson
2022-06-15 13:15 ` Paolo Bonzini
2022-06-15 13:55 ` Sean Christopherson
2022-06-14 23:05 ` Sean Christopherson [this message]
2022-06-14 23:05 ` [PATCH 4/5] KVM: x86: Move "apicv_active" into "struct kvm_lapic" Sean Christopherson
2022-06-14 23:05 ` [PATCH 5/5] KVM: x86: Use lapic_in_kernel() to query in-kernel APIC in APICv helper 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=20220614230548.3852141-4-seanjc@google.com \
--to=seanjc@google.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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®