linux/arch/x86
Kan Liang e97c45c770 perf/x86/intel: Fix crash in icl_update_topdown_event()
commit b0823d5fba upstream.

The perf_fuzzer found a hard-lockup crash on a RaptorLake machine:

  Oops: general protection fault, maybe for address 0xffff89aeceab400: 0000
  CPU: 23 UID: 0 PID: 0 Comm: swapper/23
  Tainted: [W]=WARN
  Hardware name: Dell Inc. Precision 9660/0VJ762
  RIP: 0010:native_read_pmc+0x7/0x40
  Code: cc e8 8d a9 01 00 48 89 03 5b cd cc cc cc cc 0f 1f ...
  RSP: 000:fffb03100273de8 EFLAGS: 00010046
  ....
  Call Trace:
    <TASK>
    icl_update_topdown_event+0x165/0x190
    ? ktime_get+0x38/0xd0
    intel_pmu_read_event+0xf9/0x210
    __perf_event_read+0xf9/0x210

CPUs 16-23 are E-core CPUs that don't support the perf metrics feature.
The icl_update_topdown_event() should not be invoked on these CPUs.

It's a regression of commit:

  f9bdf1f953 ("perf/x86/intel: Avoid disable PMU if !cpuc->enabled in sample read")

The bug introduced by that commit is that the is_topdown_event() function
is mistakenly used to replace the is_topdown_count() call to check if the
topdown functions for the perf metrics feature should be invoked.

Fix it.

Fixes: f9bdf1f953 ("perf/x86/intel: Avoid disable PMU if !cpuc->enabled in sample read")
Closes: https://lore.kernel.org/lkml/352f0709-f026-cd45-e60c-60dfd97f73f3@maine.edu/
Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Vince Weaver <vincent.weaver@maine.edu>
Cc: stable@vger.kernel.org # v6.15+
Link: https://lore.kernel.org/r/20250612143818.2889040-1-kan.liang@linux.intel.com
[ omitted PEBS check ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Angel Adetula <angeladetula@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-09-25 11:13:44 +02:00
..
boot x86/sev: Evict cache lines during SNP memory validation 2025-08-15 12:14:12 +02:00
coco x86/sev: Ensure SVSM reserved fields in a page validation entry are initialized to zero 2025-08-28 16:31:03 +02:00
configs tinyconfig: remove unnecessary 'is not set' for choice blocks 2024-09-01 20:34:38 +09:00
crypto crypto: lib/Kconfig - Hide arch options from user 2025-05-02 07:59:32 +02:00
entry x86/bugs: Rename MDS machinery to something more generic 2025-07-10 16:05:14 +02:00
events perf/x86/intel: Fix crash in icl_update_topdown_event() 2025-09-25 11:13:44 +02:00
hyperv x86/hyperv: Fix APIC ID and VP index confusion in hv_snp_boot_ap() 2025-08-01 09:48:46 +01:00
ia32 x86/signal/32: Merge native and compat 32-bit signal code 2022-10-19 09:58:49 +02:00
include x86/vmscape: Add conditional IBPB mitigation 2025-09-11 17:21:46 +02:00
kernel x86: disable image size check for test builds 2025-09-19 16:35:52 +02:00
kvm x86/vmscape: Add conditional IBPB mitigation 2025-09-11 17:21:46 +02:00
lib x86/insn: Fix opcode map (!REX2) superscript tags 2025-06-19 15:31:28 +02:00
math-emu x86/math-emu: Fix function cast warnings 2024-04-08 16:06:22 +02:00
mm x86/mm/64: define ARCH_PAGE_TABLE_SYNC_MASK and arch_sync_kernel_mappings() 2025-09-09 18:58:15 +02:00
net x86/its: FineIBT-paranoid vs ITS 2025-05-18 08:25:00 +02:00
pci PCI/MSI: Convert pci_msi_ignore_mask to per MSI domain flag 2025-05-02 07:58:56 +02:00
platform x86/pvh: Call C code via the kernel virtual mapping 2024-12-05 14:01:12 +01:00
power x86/fred: Fix system hang during S4 resume with FRED enabled 2025-05-29 11:02:02 +02:00
purgatory Kbuild updates for v6.10 2024-05-18 12:39:20 -07:00
ras treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
realmode Makefile: remove redundant tool coverage variables 2024-05-14 23:35:48 +09:00
tools x86/tools: Drop duplicate unlikely() definition in insn_decoder_test.c 2025-06-27 11:11:41 +01:00
um um: Add cmpxchg8b_emu and checksum functions to asm-prototypes.h 2025-07-06 11:01:34 +02:00
video arch: Fix name collision with ACPI's video.o 2024-05-20 21:17:06 +00:00
virt x86/virt/tdx: Avoid indirect calls to TDX assembly functions 2025-06-27 11:11:38 +01:00
xen x86/xen: disable CPU idle and frequency drivers for PVH dom0 2025-05-02 07:59:23 +02:00
.gitignore x86/purgatory: Omit use of bin2c 2022-07-25 10:32:32 +02:00
Kbuild x86/build: Use obj-y to descend into arch/x86/virt/ 2024-03-30 10:41:49 +01:00
Kconfig x86/vmscape: Enable the mitigation 2025-09-11 17:21:46 +02:00
Kconfig.assembler x86/kconfig: Add as-instr64 macro to properly evaluate AS_WRUSS 2024-06-20 19:48:18 +02:00
Kconfig.cpu x86/Kconfig: Add cmpxchg8b support back to Geode CPUs 2025-04-10 14:39:37 +02:00
Kconfig.debug x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y 2024-05-20 11:37:23 +02:00
Makefile x86/stackprotector: Work around strict Clang TLS symbol requirements 2024-11-08 13:16:00 +01:00
Makefile.postlink kbuild: remove ARCH_POSTLINK from module builds 2023-10-28 21:10:08 +09:00
Makefile.um um: Pass the correct Rust target and options with gcc 2025-04-10 14:39:25 +02:00
Makefile_32.cpu x86/build: Do not add -falign flags unconditionally for clang 2021-09-19 10:35:53 +09:00