Re: [PATCH v2] perf test: Add test for events re-armed with PERF_EVENT_IOC_REFRESH
From: Arnaldo Carvalho de Melo
Date: Wed Oct 21 2026 - 17:59:11 EST
On Wed, Oct 21, 2026 at 10:33:42AM -0700, Ian Rogers wrote:
> On Wed, Oct 21, 2026 at 7:17 AM Francesco Nigro <nigro.fra@xxxxxxxxx> wrote:
> >
> > Open a sampling event with sample_period 1, re-arm it with
> > PERF_EVENT_IOC_REFRESH from its overflow signal handler, as
> > self-profilers such as async-profiler do, and check that each of 1000
> > events delivers a signal. One case uses a software event (page faults),
> > the other the syscalls:sys_enter_getppid tracepoint. The signal is a
> > real-time one, so overflows cannot be coalesced, and the page fault
> > buffer is marked MADV_NOHUGEPAGE so that each touched page faults once.
> >
> > The tracepoint case fails since
> > commit 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage"):
> > only the first overflow is delivered. The re-arming ioctl succeeds,
> > but the event count stays at 1. It passes on the parent commit. The
> > software case passes on both.
> >
> > The test was written with an AI coding assistant (Claude) from a
> > standalone reproducer; I reviewed it and ran it in QEMU on current
> > mainline, on that commit and on its parent.
> >
> > Link: https://github.com/async-profiler/async-profiler/issues/1813
> > Signed-off-by: Francesco Nigro <nigro.fra@xxxxxxxxx>
>
> Thanks Francesco, testing locally I see a failure on 7.1.6:
> ```
> $ sudo /tmp/perf/perf test -v IOC_REFRESH
> Not taking turns using the perf mlock budget: nothing can exhaust it
> 20: Event re-armed with PERF_EVENT_IOC_REFRESH :
> 20.1: Software event : Ok
> ---- start ----
> test child forked, pid 187381
> 1000 events, count 1, 1 overflows (1 POLL_HUP), re-arm errno 0
> ---- end(-1) ----
> 20.2: Tracepoint event : FAILED!
>
> === Test Summary ===
> Passed main tests : 0
> Passed subtests : 1
> Skipped tests : 0
> Failed tests : 1
> List of failed tests:
> 20.2: Tracepoint event
> ```
> I believe this is currently expected until the kernel is fixed, which
> is somewhat unfortunate. The code looks okay and the build isn't
> regressed.
>
> Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>
Thanks Francesco for writing the test!
Applied to perf-tools-next, for v7.4.
- Arnaldo