Re: [RFC PATCH v5 075/104] KVM: x86: Check for pending APICv interrupt in kvm_vcpu_has_events()

From: Paolo Bonzini
Date: Fri Apr 15 2022 - 10:20:45 EST


On 4/8/22 18:24, Sean Christopherson wrote:
Return true for kvm_vcpu_has_events() if the vCPU has a pending APICv
interrupt to support TDX's usage of APICv. Unlike VMX, TDX doesn't have
access to vmcs.GUEST_INTR_STATUS and so can't emulate posted interrupts,
Based on the discussion in the HLT patch, this is no longer true.


It's still true, it only has access to RVI > PPR (which is enough to check
if the vCPU is runnable).

Rather than hook this path, I would rather we tag kvm_apic has having some of its
state protected. Then kvm_cpu_has_interrupt() can invoke the alternative,
protected-apic-only hook when appropriate, and kvm_apic_has_interrupt() can bail
immediately instead of doing useless processing of stale vAPIC state.

Agreed, this is similar to my suggestion on the HLT patch:

https://lkml.kernel.org/r/a7d28775-2dbe-7d97-7053-e182bd5be51c@xxxxxxxxxx

Paolo