Re: [PATCH v6 47/59] perf failed-syscalls: Port failed-syscalls to use python module

sashiko-bot
2026-04-25T18:08:05Z

Sashiko AI review found 1 potential issue(s):
- [Medium] The script incorrectly filters out `raw_syscalls:sys_exit` events because it requires the event name to end with an underscore.
--

commit d0669a431485bb5878875ee3c2d4a44c47d0f2ae
Author: Ian Rogers <irogers@google.com>

perf failed-syscalls: Port failed-syscalls to use python module

This commit ports the legacy failed-syscalls.pl Perl script to Python using
the perf module. It leverages the perf.session API to filter sys_exit events,
track failed system calls, and aggregate the counts per command name.

> diff --git a/tools/perf/python/failed-syscalls.py b/tools/perf/python/failed-syscalls.py
> new file mode 100755
> index 000000000000..c3b58664eb57
> --- /dev/null
> +++ b/tools/perf/python/failed-syscalls.py
[ ... ]
> + def process_event(self, sample: perf.sample_event) -> None:
> + """Process sys_exit events."""
> + event_name = str(sample.evsel)
> + if not event_name.startswith("evsel(syscalls:sys_exit_") and \
> + not event_name.startswith("evsel(raw_syscalls:sys_exit_"):

Will this condition unintentionally drop raw_syscalls:sys_exit events?

The stringified event name for raw syscall exits is
"evsel(raw_syscalls:sys_exit)", which does not have a trailing underscore.
Because the startswith check here specifically includes the trailing
underscore, it looks like traces recorded with raw_syscalls:sys_exit will be
discarded prematurely, leaving the script with empty output.

> + return

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260425174858.3922152-1-irogers@google.com?part=47