]> Gentwo Git Trees - linux/.git/commit
KVM: x86: Only allow "fast" IPIs in fastpath WRMSR(X2APIC_ICR) handler
authorSean Christopherson <seanjc@google.com>
Tue, 5 Aug 2025 19:05:11 +0000 (12:05 -0700)
committerSean Christopherson <seanjc@google.com>
Tue, 19 Aug 2025 18:59:32 +0000 (11:59 -0700)
commit777414340085711cafd3807a72c531107c0ff7f6
treeffbfa1a11638237c6611c257dcea50ddd8515c69
parent15daa58e78cef70945324db162d1afbf3f493fb6
KVM: x86: Only allow "fast" IPIs in fastpath WRMSR(X2APIC_ICR) handler

Explicitly restrict fastpath ICR writes to IPIs that are "fast", i.e. can
be delivered without having to walk all vCPUs, and that target at most 16
vCPUs.  Artificially restricting ICR writes to physical mode guarantees
at most one vCPU will receive in IPI (because x2APIC IDs are read-only),
but that delivery might not be "fast".  E.g. even if the vCPU exists, KVM
might have to iterate over 4096 vCPUs to find the right one.

Limiting delivery to fast IPIs aligns the WRMSR fastpath with
kvm_arch_set_irq_inatomic() (which also runs with IRQs disabled), and will
allow dropping the semi-arbitrary restrictions on delivery mode and type.

Link: https://lore.kernel.org/r/20250805190526.1453366-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/lapic.c
arch/x86/kvm/lapic.h
arch/x86/kvm/x86.c