Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sebastian Andrzej Siewior" <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH v4] ARM, ARM64, LONGARCH, XTENSA: Delay HW BP notification to task_work()
Date: Mon, 12 Oct 2026 09:18:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-167891@kernel.org> (raw)
In-Reply-To: <20261012090431.TF3iVDsk@linutronix.de>

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@linutronix.de>

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@redhat.com/

> 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@linutronix.de?part=1

  reply	other threads:[~2026-10-12  9:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12  9:04 [PATCH v4] ARM, ARM64, LONGARCH, XTENSA: Delay HW BP notification to task_work() Sebastian Andrzej Siewior
2026-10-12  9:18 ` sashiko-bot [this message]
2026-10-12  9:37   ` Sebastian Andrzej Siewior
2026-10-12 10:15 ` Huacai Chen
2026-10-12 10:21   ` Sebastian Andrzej Siewior
2026-10-13  2:46     ` Huacai Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-167891@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox