Re: [PATCH v4] ARM, ARM64, LONGARCH, XTENSA: Delay HW BP notification to task_work()
From: sashiko-bot
Date: Mon Oct 12 2026 - 05:23:02 EST
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] perf: ODR violation and ABI mismatch in struct perf_event due to unexported macro
--
commit fc15e8519a12261f55ee613e302041c25e4218d0
Author: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
ARM, ARM64, LONGARCH, XTENSA: Delay HW BP notification to task_work()
This commit delays the hardware event delivery callback to task_work() to
fix sleeping while atomic warnings on PREEMPT_RT. It implements a generic
perf callback perf_hwbp_notify() and adds ARCH_NEED_PERF_HW_NOTIFY to
supported architectures.
Closes: https://lore.kernel.org/all/aho0eqjMESuHxECr@xxxxxxxxxx/
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -215,6 +215,10 @@ struct hw_perf_event {
>
> /* Last sync'ed generation of filters */
> unsigned long addr_filters_gen;
> +#ifdef ARCH_NEED_PERF_HW_NOTIFY
> + struct callback_head arch_hw_notif;
> + int arch_hw_notif_busy;
> +#endif
[Severity: Critical]
Does this cause an ABI mismatch and One Definition Rule violation across
the kernel?
The ARCH_NEED_PERF_HW_NOTIFY macro is defined in architecture-specific
headers like arch/arm64/include/asm/hw_breakpoint.h, but it is used here
in the generic include/linux/perf_event.h header.
Because linux/perf_event.h does not universally include asm/hw_breakpoint.h,
translation units that include linux/perf_event.h without previously
including the architecture hardware breakpoint header will evaluate
struct hw_perf_event without these fields. Since struct hw_perf_event
is embedded in struct perf_event, this alters the size and member offsets
of struct perf_event across different subsystems.
Can this lead to memory corruption when perf_event objects are passed
between translation units with mismatched struct definitions? Should these
conditional fields be driven by a globally visible Kconfig symbol instead?
>
> /*
> * hw_perf_event::state flags; used to track the PERF_EF_* state.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261012090431.TF3iVDsk@xxxxxxxxxxxxx?part=1