Re: [PATCH v5 1/2] perf/core: Prevent duplicate sigtrap task work enqueue
From: Sebastian Andrzej Siewior
Date: Fri Nov 20 2026 - 09:16:24 EST
On 2026-11-20 13:14:36 [+0100], Peter Zijlstra wrote:
> > Also use smp_load_acquire() when checking pending_work in
> > the exclude_kernel warning path to ensure the read is properly
> > ordered.
>
> I am confused by the use of smp_*() and cmpxchg() here. Where is the
> multi-cpu scenario?
The same event is used in process context and NMI
| perf-tc1-7647 [001] d..6. 114.513688: __perf_event_overflow: ffff888100d68540
| perf-tc1-7647 [001] d.Z2. 114.513703: __perf_event_overflow: ffff888100d68540
I don't see how to deal with this without cmpxchg. And the same event is
also used by other task
| perf-tc1-7657 [001] d.Z2. 114.598356: __perf_event_overflow: ffff888100d68540
which makes me thing that it could be pinned to another CPU (unless
there is something that impossible and it is strictly per-CPU).
The smp load/store macros is my fault as it looked better to do this
than plain stores (given that we have the cmpxchg already).
Sebastian