linux-stable/arch/x86
Sandipan Das f5a55db79b KVM: x86/pmu: Do not mask LVTPC when handling a PMI on AMD platforms
commit 49ff3b4aec upstream.

On AMD and Hygon platforms, the local APIC does not automatically set
the mask bit of the LVTPC register when handling a PMI and there is
no need to clear it in the kernel's PMI handler.

For guests, the mask bit is currently set by kvm_apic_local_deliver()
and unless it is cleared by the guest kernel's PMI handler, PMIs stop
arriving and break use-cases like sampling with perf record.

This does not affect non-PerfMonV2 guests because PMIs are handled in
the guest kernel by x86_pmu_handle_irq() which always clears the LVTPC
mask bit irrespective of the vendor.

Before:

  $ perf record -e cycles:u true
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.001 MB perf.data (1 samples) ]

After:

  $ perf record -e cycles:u true
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.002 MB perf.data (19 samples) ]

Fixes: a16eb25b09 ("KVM: x86: Mask LVTPC when handling a PMI")
Cc: stable@vger.kernel.org
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
[sean: use is_intel_compatible instead of !is_amd_or_hygon()]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20240405235603.1173076-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-27 17:05:28 +02:00
..
boot arch: Introduce CONFIG_FUNCTION_ALIGNMENT 2024-04-10 16:18:49 +02:00
configs
crypto crypto: x86/sha - load modules based on CPU features 2023-11-28 16:56:27 +00:00
entry x86/bhi: Add support for clearing branch history at syscall entry 2024-04-10 16:19:43 +02:00
events perf/x86: Fix out of range data 2024-04-17 11:15:16 +02:00
hyperv x86/hyperv: Remove unregister syscore call from Hyper-V cleanup 2022-12-31 13:14:39 +01:00
ia32
include KVM: x86: Snapshot if a vCPU's vendor model is AMD vs. Intel compatible 2024-04-27 17:05:28 +02:00
kernel x86/cpufeatures: Fix dependencies for GFNI, VAES, and VPCLMULQDQ 2024-04-27 17:05:26 +02:00
kvm KVM: x86/pmu: Do not mask LVTPC when handling a PMI on AMD platforms 2024-04-27 17:05:28 +02:00
lib x86/retpoline: Do the necessary fixup to the Zen3/4 srso return thunk for !SRSO 2024-04-10 16:19:43 +02:00
math-emu
mm x86/mm/pat: fix VM_PAT handling in COW mappings 2024-04-13 13:01:47 +02:00
net x86/returnthunk: Allow different return thunks 2024-03-01 13:21:49 +01:00
pci x86/PCI: Add quirk for AMD XHCI controller that loses MSI-X state in D3hot 2023-04-20 12:13:55 +02:00
platform x86/olpc: fix 'logical not is only applied to the left hand side' 2022-08-17 14:24:18 +02:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2022-12-02 17:41:09 +01:00
purgatory x86/purgatory: Remove LTO flags 2023-09-23 11:10:01 +02:00
ras
realmode
tools x86, relocs: Ignore relocations in .notes section 2024-03-26 18:21:21 -04:00
um x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list 2023-03-11 13:57:26 +01:00
video
xen x86/xen: Add some null pointer checking to smp.c 2024-03-26 18:21:12 -04:00
.gitignore
Kbuild
Kconfig x86/bugs: Replace CONFIG_SPECTRE_BHI_{ON,OFF} with CONFIG_MITIGATION_SPECTRE_BHI 2024-04-17 11:15:17 +02:00
Kconfig.assembler
Kconfig.cpu x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 2024-02-23 08:55:08 +01:00
Kconfig.debug arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic 2022-08-17 14:23:00 +02:00
Makefile x86/realmode: build with -D__DISABLE_EXPORTS 2022-07-23 12:53:56 +02:00
Makefile.um
Makefile_32.cpu