Re: [PATCH v8] perf record: Fix unhandled POLLHUP on non_perf_event descriptors
| Newsgroups | org.kernel.vger.linux-perf-users |
|---|---|
| Message-ID | <[email protected]> |
> When processing POLLHUP on a non_perf_event control descriptor,
> evlist__finalize_ctlfd() is invoked to finalize the setup, correctly
> setting the core evlist's poll array file descriptor to -1. However,
> this finalized teardown state is never propagated back to the
> individual thread's local replica of the pollfd array.
>
> Consequently, on the next iteration of the main recording loop,
> record__update_evlist_pollfd_from_thread() performs a strict
> equivalence check between the core evlist's array and the thread's
> localized poll array, detecting that the fd values no longer match.
> This causes an immediate -EINVAL abort and a premature teardown.
>
> Fix the underlying logic within
> record__update_evlist_pollfd_from_thread() to sustainably propagate
> the finalized teardown statuses (-1) originating from the core evlist
> back to the thread's localized poll structure. This correctly
> maintains synchronization and entirely prevents the unhandled
> index mismatch crashes.
>
> Additionally, add a unit test that explicitly validates that
> fdarray__filter() preserves its invariants regarding
> fdarray_flag__nonfilterable items to guard against regressions.
>
> Fixes: fb4751e79c45 ("perf record: Fix teardown hang on system-wide multi-threaded sessions")
> Assisted-by: Gemini:gemini-3.1-pro
> Signed-off-by: Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1