Re: [PATCH v4 1/7] perf lock contention: Filter events before creating lock_stat

From: Arnaldo Carvalho de Melo

Date: Wed Oct 21 2026 - 17:39:44 EST


On Mon, Oct 19, 2026 at 09:34:04PM -0700, Namhyung Kim wrote:
> On Mon, Oct 19, 2026 at 03:09:09PM -0700, Ian Rogers wrote:
> > In report_lock_contention_begin_event(), lock_stat_findnew() was
> > called before checking filters.nr_types (-Y), filters.nr_addrs (-L),
> > and match_callstack_filter() (-S).
> >
> > When a filtered-out lock event (such as a mutex contention when
> > running with -Y spinlock) shared the same aggregation key as a
> > subsequent matching event (for example, contention on the mutex's
> > internal wait_lock spinlock from the same caller), the first event
> > created the lock_stat entry with the filtered-out lock's flags and the
> > second event reused that entry, causing non-spinlock entries to appear
> > in -Y spinlock output.
> >
> > Check the type, address, and callstack filters before looking up or
> > creating the lock_stat entry.
> >
> > Fixes: b4a7eff93c39 ("perf lock contention: Add -Y/--type-filter option")
> > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
>
> Reviewed-by: Namhyung Kim <namhyung@xxxxxxxxxx>

Cherry picked this one as its the first in the series.

- Arnaldo