Re: [PATCH v5 1/3] perf sched: Suppress latency table output when trace samples are missing
Namhyung Kim <[email protected]> Fri, 31 Jul 2026 14:59:23 -0700
| Newsgroups | org.kernel.vger.linux-perf-users,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Hello, On Thu, Jul 30, 2026 at 02:54:14PM -0400, Aaron Tomlin wrote: > When 'perf sched latency' is executed on a perf.data file that lacks > tracepoint samples (i.e., a file recorded without the -R flag or > containing only non-tracepoint events), perf_session__has_traces() > correctly outputs an error message. However, perf_sched__read_events() > subsequently falls through and returns 0 (success). > > Consequently, caller functions such as perf_sched__lat() assume event > processing succeeded and proceed to render empty latency header tables > and total summary statistics. > > Fix this behaviour by ensuring perf_sched__read_events() aborts early and > returns a suitable error code when perf_session__has_traces() evaluates > to false. > > For pipe mode streams, event attributes are received dynamically during > event processing, meaning session->evlist is not populated prior to > perf_session__process_events(). To handle pipe input correctly: > - Register the missing .attr, .tracing_data, .build_id, and .feature > callbacks in cmd_sched() > > - Promote the handlers array to file-scope (latency_handlers[]) and > invoke evlist__set_tracepoints_handlers() dynamically inside > perf_sched__process_tracepoint_sample() when evsel->handler is NULL > > - Perform the trace check post-processing when handling pipe data Can you please split the pipe mode changes into a separate commit? > > Additionally, validate thread__get_runtime() against NULL in > map_switch_event() to prevent potential null-pointer dereferences. This is small enough to be squashed. Thanks, Namhyung