]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf/x86/core: Add APIs to switch to/from mediated PMI vector (for KVM)
authorSean Christopherson <seanjc@google.com>
Sat, 6 Dec 2025 00:16:45 +0000 (16:16 -0800)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 17 Dec 2025 12:31:06 +0000 (13:31 +0100)
commit560ac136f25da2da44a8b68d581adfdc8230b7e2
treed2d03ad780049f301acf07f65fd263acb88df502
parenta05385d84b2af64600fc84b027bea481e8f6261d
perf/x86/core: Add APIs to switch to/from mediated PMI vector (for KVM)

Add APIs (exported only for KVM) to switch PMIs to the dedicated mediated
PMU IRQ vector when loading guest context, and back to perf's standard NMI
when the guest context is put.  I.e. route PMIs to
PERF_GUEST_MEDIATED_PMI_VECTOR when the guest context is active, and to
NMIs while the host context is active.

While running with guest context loaded, ignore all NMIs (in perf).  Any
NMI that arrives while the LVTPC points at the mediated PMU IRQ vector
can't possibly be due to a host perf event.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251206001720.468579-10-seanjc@google.com
arch/x86/events/core.c
arch/x86/include/asm/perf_event.h