[PATCH 0/2] perf: Fix PERF_EVENT_IOC_REFRESH for tracepoints and breakpoints

From: Paolo Bertinetti

Date: Tue Nov 03 2026 - 08:15:47 EST


Since commit 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage"),
an event that reaches its PERF_EVENT_IOC_REFRESH limit is stopped with
pmu->stop() and disabled. Re-arming it adds it back with PERF_EF_START,
but perf_trace_add() and hw_breakpoint_add() never clear
PERF_HES_STOPPED. Tracepoint, kprobe, uprobe and breakpoint events
re-armed this way deliver only their first overflow. Francesco reported
it with the "Event re-armed with PERF_EVENT_IOC_REFRESH" perf test,
found through an async-profiler bug.

These patches make both PMUs set the state from PERF_EF_START on every
add, as perf_swevent_add() does. The pmu->stop() call stays, so the
POLL_HUP fix of 18dbcbfabfff is kept.

Leo's series [1] removes that pmu->stop() call instead, which also
avoids this, and is still pending. Either way, add() with PERF_EF_START
should start the event.

Tested in QEMU/KVM, x86_64, 4 vCPUs, v7.4-rc1 with PROVE_LOCKING:

- perf test "Event re-armed with PERF_EVENT_IOC_REFRESH": the tracepoint
case goes from FAILED (count 1, 1 overflow) to Ok (count 1000, 1000
POLL_HUP signals).

- A small test that re-arms each event from its signal handler and
triggers it 200 times, overflows delivered:

v7.4-rc1 + patch 1 + patch 2
tracepoint 1 200 200
kprobe 1 200 200
uprobe 1 200 200
breakpoint 1 1 200

- The full perf test suite and tools/testing/selftests/perf_events give
the same results before and after, apart from the REFRESH test. Many
perf tests fail in my VM on both kernels, for setup reasons.

- No lockdep or other warnings in dmesg.

I can add kprobe, uprobe and breakpoint cases to the perf test if that
helps.

[1] https://lore.kernel.org/r/20260514-arm_cs_clean_perf_handle-v2-0-cbb29c3b3661@xxxxxxx/

Paolo Bertinetti (2):
tracing/perf: Clear stop state in perf_trace_add()
perf/hw_breakpoint: Clear stop state in hw_breakpoint_add()

kernel/events/hw_breakpoint.c | 3 +--
kernel/trace/trace_event_perf.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.53.0