]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: nVMX: Explicitly update vPPR on successful nested VM-Enter
authorSean Christopherson <seanjc@google.com>
Fri, 1 Nov 2024 19:14:43 +0000 (12:14 -0700)
committerSean Christopherson <seanjc@google.com>
Thu, 19 Dec 2024 15:34:11 +0000 (07:34 -0800)
commitcda3960fbcc532f8609fc32b07196abe2a2f0376
tree97b18c428308cbd2cd39197d3bd4c2425f9288dc
parentfdd2db5126ce9cce22947354008d430252b08a03
KVM: nVMX: Explicitly update vPPR on successful nested VM-Enter

Always request pending event evaluation after successful nested VM-Enter
if L1 has a pending IRQ, as KVM will effectively do so anyways when APICv
is enabled, by way of vmx_has_apicv_interrupt().  This will allow dropping
the aforementioned APICv check, and will also allow handling nested Posted
Interrupt processing entirely within vmx_check_nested_events(), which is
necessary to honor priority between concurrent events.

Note, checking for pending IRQs has a subtle side effect, as it results in
a PPR update for L1's vAPIC (PPR virtualization does happen at VM-Enter,
but for nested VM-Enter that affects L2's vAPIC, not L1's vAPIC).  However,
KVM updates PPR _constantly_, even when PPR technically shouldn't be
refreshed, e.g. kvm_vcpu_has_events() re-evaluates PPR if IRQs are
unblocked, by way of the same kvm_apic_has_interrupt() check.  Ditto for
nested VM-Enter itself, when nested posted interrupts are enabled.  Thus,
trying to avoid a PPR update on VM-Enter just to be pedantically accurate
is ridiculous, given the behavior elsewhere in KVM.

Link: https://lore.kernel.org/kvm/20230312180048.1778187-1-jason.cj.chen@intel.com
Closes: https://lore.kernel.org/all/20240920080012.74405-1-mankku@gmail.com
Signed-off-by: Chao Gao <chao.gao@intel.com>
Link: https://lore.kernel.org/r/20241101191447.1807602-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/nested.c