]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf/x86/intel/bts: Check if bts_ctx is allocated when calling BTS functions
authorLi RongQing <lirongqing@baidu.com>
Thu, 6 Mar 2025 05:11:02 +0000 (13:11 +0800)
committerIngo Molnar <mingo@kernel.org>
Thu, 6 Mar 2025 21:42:26 +0000 (22:42 +0100)
commit7a310c644cf571fbdb1d447a1dc39cf048634589
treecbb30b31daebb68a368dd3b3a5d2d094f19de2e0
parentfa6192adc32f4fdfe5b74edd5b210e12afd6ecc0
perf/x86/intel/bts: Check if bts_ctx is allocated when calling BTS functions

bts_ctx might not be allocated, for example if the CPU has X86_FEATURE_PTI,
but intel_bts_disable/enable_local() and intel_bts_interrupt() are called
unconditionally from intel_pmu_handle_irq() and crash on bts_ctx.

So check if bts_ctx is allocated when calling BTS functions.

Fixes: 3acfcefa795c ("perf/x86/intel/bts: Allocate bts_ctx only if necessary")
Reported-by: Jiri Olsa <olsajiri@gmail.com>
Tested-by: Jiri Olsa <jolsa@kernel.org>
Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Suggested-by: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250306051102.2642-1-lirongqing@baidu.com
arch/x86/events/intel/bts.c