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

sashiko-bot
2026-04-24T17:20:33Z

Sashiko AI review found 1 potential issue(s):
- [Medium] The event filtering condition drops `raw_syscalls:sys_exit` events due to a trailing underscore in the prefix match.
--

commit badfbafe402502cf834a49c44f2d34e63cf304da
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 Python using
the perf module. It uses the perf.session API to filter sys_exit events and
aggregate failed system call counts by command name.

> diff --git a/tools/perf/python/failed-syscalls.py b/tools/perf/python/failed-syscalls.py
> new file mode 100755
> index 00000000000000..178c1458430a24
> --- /dev/null
> +++ b/tools/perf/python/failed-syscalls.py
> @@ -0,0 +1,78 @@
[ ... ]
> + 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_"):
> + return

Does this inadvertently drop raw_syscalls:sys_exit events?

The raw_syscalls subsystem provides a catch-all exit tracepoint named
exactly raw_syscalls:sys_exit, so the stringified evsel is
evsel(raw_syscalls:sys_exit). Because the startswith check includes a
trailing underscore, it seems it will evaluate to false and drop these
events.

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