Re: [PATCH v8] perf record: Fix unhandled POLLHUP on non_perf_event descriptors
Ian Rogers <[email protected]>
| Newsgroups | org.kernel.vger.linux-perf-users |
|---|---|
| Message-ID | <CAP-5=fWRhOdjT+9wUqOy59Hz4fSZQgibanisytCy_3TNTN1ecg@mail.gmail.com> |
On Thu, Aug 20, 2026 at 2:47 PM <[email protected]> wrote: > > > 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! Random unnecessary comment: v6, v7 and v8 only differ by comments. The comments were added to avoid hallucinations in the issues Sashiko was seeing; I wasn't seeing the issue internally. This is the first time I've encountered this problem. Thanks, Ian > -- > Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1 >