linux-yocto/arch/x86
Kan Liang 79e2dd5731 perf/x86/intel: Fix crash in icl_update_topdown_event()
[ Upstream commit b0823d5fba ]

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-01 09:47:32 +01:00
..
boot x86/build: Fix broken copy command in genimage.sh when making isoimage 2025-06-04 14:42:05 +02:00
coco x86/tdx: Fix arch_safe_halt() execution for TDX VMs 2025-04-25 10:45:55 +02:00
configs - The first, cleanup part of the microcode loader reorg tglx has been 2023-08-28 15:55:20 -07:00
crypto crypto: x86/aegis128 - access 32-bit arguments as 32-bit 2024-12-09 10:32:43 +01:00
entry x86/bugs: Rename MDS machinery to something more generic 2025-07-10 16:03:21 +02:00
events perf/x86/intel: Fix crash in icl_update_topdown_event() 2025-08-01 09:47:32 +01:00
hyperv x86/hyperv: Fix usage of cpu_online_mask to get valid cpu 2025-08-01 09:47:28 +01:00
ia32
include x86/rdrand: Disable RDSEED on AMD Cyan Skillfish 2025-07-17 18:35:15 +02:00
kernel x86/bugs: Fix use of possibly uninit value in amd_check_tsa_microcode() 2025-08-01 09:47:31 +01:00
kvm KVM: x86/xen: Fix cleanup logic in emulation of Xen schedop poll hypercalls 2025-07-24 08:53:22 +02:00
lib x86/its: Add support for ITS-safe return thunk 2025-05-18 08:24:11 +02:00
math-emu x86/fpu: Include asm/fpu/regset.h 2023-05-18 11:56:18 -07:00
mm x86/mm/init: Handle the special case of device private pages in add_pages(), to not increase max_pfn and trigger dma_addressing_limited() bounce buffers bounce buffers 2025-06-04 14:42:21 +02:00
net x86/its: FineIBT-paranoid vs ITS 2025-05-18 08:24:12 +02:00
pci PCI: Avoid putting some root ports into D3 on TUXEDO Sirius Gen1 2025-02-17 09:40:26 +01:00
platform x86/pvh: Call C code via the kernel virtual mapping 2025-05-02 07:51:02 +02:00
power mm/treewide: replace pud_large() with pud_leaf() 2024-04-10 16:35:46 +02:00
purgatory x86/purgatory: Switch to the position-independent small code model 2024-06-12 11:11:43 +02:00
ras
realmode x86/realmode: Make stack lock work in trampoline_compat() 2023-05-30 14:11:47 +02:00
tools x86/tools: Drop duplicate unlikely() definition in insn_decoder_test.c 2025-07-06 11:00:16 +02:00
um um: Add cmpxchg8b_emu and checksum functions to asm-prototypes.h 2025-07-06 11:00:07 +02:00
video Merge drm/drm-next into drm-misc-next 2023-07-24 15:44:47 +02:00
virt/vmx/tdx x86/tdx: Pass TDCALL/SEAMCALL input/output registers via a structure 2024-12-09 10:32:19 +01:00
xen x86/xen: fix memblock_reserve() usage on PVH 2025-04-25 10:45:55 +02:00
.gitignore
Kbuild
Kconfig x86/mm: Disable hugetlb page table sharing on 32-bit 2025-07-17 18:35:15 +02:00
Kconfig.assembler x86/kconfig: Add as-instr64 macro to properly evaluate AS_WRUSS 2024-08-03 08:53:21 +02:00
Kconfig.cpu x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 2024-02-23 09:25:10 +01:00
Kconfig.debug x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y 2024-06-12 11:12:46 +02:00
Makefile x86/boot: Compile boot code with -std=gnu11 too 2025-06-04 14:42:21 +02:00
Makefile_32.cpu
Makefile.postlink x86/build: Avoid relocation information in final vmlinux 2023-06-14 19:54:40 +02:00
Makefile.um