]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: nVMX: Honor event priority when emulating PI delivery during VM-Enter
authorSean Christopherson <seanjc@google.com>
Fri, 1 Nov 2024 19:14:47 +0000 (12:14 -0700)
committerSean Christopherson <seanjc@google.com>
Thu, 19 Dec 2024 15:34:14 +0000 (07:34 -0800)
commit3d91521e57df1f6903419502592910232af49dbb
tree780802a3630ffedac8fc55382ed0e52ae4cf5696
parentc829d2c35650e9e24dc338234bd14e4c7c6231f5
KVM: nVMX: Honor event priority when emulating PI delivery during VM-Enter

Move the handling of a nested posted interrupt notification that is
unblocked by nested VM-Enter (unblocks L1 IRQs when ack-on-exit is enabled
by L1) from VM-Enter emulation to vmx_check_nested_events().  To avoid a
pointless forced immediate exit, i.e. to not regress IRQ delivery latency
when a nested posted interrupt is pending at VM-Enter, block processing of
the notification IRQ if and only if KVM must block _all_ events.  Unlike
injected events, KVM doesn't need to actually enter L2 before updating the
vIRR and vmcs02.GUEST_INTR_STATUS, as the resulting L2 IRQ will be blocked
by hardware itself, until VM-Enter to L2 completes.

Note, very strictly speaking, moving the IRQ from L2's PIR to IRR before
entering L2 is still technically wrong.  But, practically speaking, only
an L1 hypervisor or an L0 userspace that is deliberately checking event
priority against PIR=>IRR processing can even notice; L2 will see
architecturally correct behavior, as KVM ensures the VM-Enter is finished
before doing anything that would effectively preempt the PIR=>IRR movement.

Reported-by: Chao Gao <chao.gao@intel.com>
Link: https://lore.kernel.org/r/20241101191447.1807602-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/nested.c