linux/arch/powerpc/perf
Aboorva Devarajan 81e3a86030 powerpc/perf: fix preempt count underflow in fsl_emb_pmu_del
fsl_emb_pmu_del() unconditionally calls put_cpu_var(cpu_hw_events) at
the 'out:' label, but only calls the matching get_cpu_var() after the
'i < 0' early-return check. When event->hw.idx is negative the
function jumps to 'out:' without having taken get_cpu_var(), and the
trailing put_cpu_var() then issues an unmatched preempt_enable(),
underflowing preempt_count.

On a CONFIG_PREEMPT=y kernel preempt_count would underflow and
eventually present as a 'scheduling while atomic' BUG.

Move put_cpu_var() to pair with get_cpu_var() so the percpu access is
correctly bracketed and the 'out:' label only handles perf_pmu_enable.

Fixes: a11106544f ("powerpc/perf: e500 support")
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260605082912.305100-2-aboorvad@linux.ibm.com
2026-06-15 16:25:21 +05:30
..
req-gen powerpc/hv-gpci: Fix hv_gpci event list 2022-12-02 20:39:26 +11:00
8xx-pmu.c asm-generic: introduce text-patching.h 2024-11-07 14:25:15 -08:00
bhrb.S powerpc/64: asm use consistent global variable declaration and access 2022-09-28 19:22:12 +10:00
callchain_32.c powerpc, perf: Check that current->mm is alive before getting user callchain 2026-03-12 11:02:55 +05:30
callchain_64.c powerpc, perf: Check that current->mm is alive before getting user callchain 2026-03-12 11:02:55 +05:30
callchain.c powerpc, perf: Check that current->mm is alive before getting user callchain 2026-03-12 11:02:55 +05:30
callchain.h powerpc/64s/hash: Make hash faults work in NMI context 2022-02-24 12:46:54 +11:00
core-book3s.c powerpc: use sysfs_emit{_at} in sysfs show functions 2026-06-02 11:24:32 +05:30
core-fsl-emb.c powerpc/perf: fix preempt count underflow in fsl_emb_pmu_del 2026-06-15 16:25:21 +05:30
e500-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
e6500-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
generic-compat-pmu.c powerpc/perf: Add support for caps under sysfs in powerpc 2022-07-18 10:39:54 +10:00
hv-24x7-catalog.h
hv-24x7-domains.h
hv-24x7.c powerpc: use sysfs_emit{_at} in sysfs show functions 2026-06-02 11:24:32 +05:30
hv-24x7.h
hv-common.c
hv-common.h
hv-gpci-requests.h powerpc/hv-gpci: Fix hv_gpci event list 2022-12-02 20:39:26 +11:00
hv-gpci.c powerpc: use sysfs_emit{_at} in sysfs show functions 2026-06-02 11:24:32 +05:30
hv-gpci.h powerpc/hv-gpci: Fix hv_gpci event list 2022-12-02 20:39:26 +11:00
imc-pmu.c powerpc/perf: Use cpumask_intersects api for checking disable path 2026-06-02 11:24:32 +05:30
internal.h powerpc/perf: Power11 Performance Monitoring support 2024-02-21 23:11:00 +11:00
isa207-common.c arch/powerpc/perf: Update get_mem_data_src function to use saved values of sier and mmcra regs 2025-02-11 11:33:11 +05:30
isa207-common.h powerpc/perf: Update MMCR2 to support event exclude_idle 2022-06-29 19:42:41 +10:00
kvm-hv-pmu.c powerpc: use sysfs_emit{_at} in sysfs show functions 2026-06-02 11:24:32 +05:30
Makefile powerpc/vpa_dtl: Add interface to expose vpa dtl counters via perf 2025-09-22 14:48:57 +05:30
mpc7450-pmu.c powerpc/perf: Properly detect mpc7450 family 2023-03-30 23:35:43 +11:00
perf_regs.c powerpc: Use the newly added is_tsk_32bit_task() macro 2022-02-12 22:47:42 +11:00
power5-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power5+-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power6-pmu.c powerpc/perf: Optimize find_alternatives_list() using binary search 2023-10-19 23:18:59 +11:00
power7-events-list.h
power7-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power8-events-list.h
power8-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power9-events-list.h
power9-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power10-events-list.h powerpc/perf: Fix cycles/instructions as PM_CYC/PM_INST_CMPL in power10 2021-10-14 21:46:45 +11:00
power10-pmu.c powerpc/perf: Set cpumode flags using sample address 2024-06-17 22:47:16 +10:00
ppc970-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
vpa-dtl.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vpa-pmu.c powerpc: use sysfs_emit{_at} in sysfs show functions 2026-06-02 11:24:32 +05:30