Re: [PATCH v8 2/4] perf sched: Handle missing trace samples in pipe mode

[email protected] Wed, 05 Aug 2026 21:23:55 +0000
Newsgroups org.kernel.vger.linux-perf-users
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing explicit inclusion of `<string.h>` for `strcmp`.
--

--- Patch [2]: [PATCH v8 2/4] perf sched: Handle missing trace samples in pipe mode ---
commit 4cf6347760b0dc1a50946397641b493e66cea7c0
Author: Aaron Tomlin <[email protected]>

perf sched: Handle missing trace samples in pipe mode

This commit updates perf sched to properly handle pipe mode streams by
registering missing attributes and dynamically assigning tracepoint handlers
when the evsel handler is uninitialized.

> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index 94a323da0799a..d6b4412045e22 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c

[ ... ]

> @@ -1946,7 +1956,23 @@ static int perf_sched__process_tracepoint_sample(const struct perf_tool *tool __
>  	struct evsel *evsel = sample->evsel;
>  	int err = 0;
>  
> -	if (evsel->handler != NULL) {
> +	if (evsel->handler == NULL) {
> +		evsel->handler = process_sched_ignore;
> +		for (size_t i = 0; i < ARRAY_SIZE(latency_handlers); i++) {
> +			if (!evsel__name_is(evsel, latency_handlers[i].name))
> +				continue;
> +
> +			if (!strcmp(latency_handlers[i].name, "sched:sched_wakeup") &&

[Severity: Low]
This isn't a bug, but are we missing an explicit include for <string.h>?

Even if the file previously omitted it, the perf subsystem guidelines
require files using POSIX libc functions like strcmp() to directly include
their respective headers. Relying on implicit inclusions can lead to
compilation failures under musl libc.

> +			    sample->evsel->evlist &&
> +			    evlist__find_tracepoint_by_name(sample->evsel->evlist, "sched:sched_waking"))
> +				break;
> +
> +			evsel->handler = latency_handlers[i].handler;
> +			break;
> +		}
> +	}
> +
> +	if (evsel->handler != process_sched_ignore) {
>  		tracepoint_handler f = evsel->handler;
>  		err = f(tool, sample, machine);
>  	}

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=2