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

sashiko-bot
2026-04-25T23:11:43Z

Sashiko AI review found 2 potential issue(s):
- [Medium] Event filtering logic incorrectly drops `raw_syscalls:sys_exit` events due to a trailing underscore.
- [Low] The `unhandled` dictionary tracks dropped events but is never accessed or printed.
--

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

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

This commit ports the legacy Perl script failed-syscalls.pl to a Python
script. It introduces a class-based FailedSyscalls analyzer that processes
sys_exit events from a perf.data file and tracks failed system calls.

> 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_"):

Does the trailing underscore in the raw_syscalls:sys_exit_ pattern cause the
script to inadvertently drop standard raw syscall exit events? The generic raw
syscall exit tracepoint is typically named evsel(raw_syscalls:sys_exit)
without the trailing underscore.

> + return
> +
> + try:
> + ret = sample.ret
> + except AttributeError:
> + self.unhandled[event_name] += 1

This isn't a bug, but the unhandled dictionary tracks dropped events here
without ever being accessed or printed in the script's output routines. Should
this tracked state be included in the summary table, or is the dictionary
unnecessary?

> + return
> +
> + if ret >= 0:
> + return

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