From: sashiko-bot@kernel.org
To: "Leo Yan" <leo.yan@arm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 6/7] perf test: Cover multi-record thread map synthesis
Date: Fri, 04 Dec 2026 13:22:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-249856@kernel.org> (raw)
In-Reply-To: <20261204-perf_fix_large_threads-v2-6-a6c077f3037d@arm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] perf test: missing explicit stdio.h and stdbool.h includes in
thread-map.c
- [Low] perf test: duplicated max_nr calculation and hardcoded limits in
thread-map.c
--
commit e2b0a1a73dca6e5c1f8eb5380921925d2faf9ba2
Author: Leo Yan <leo.yan@arm.com>
perf test: Cover multi-record thread map synthesis
This commit extends the thread-map synthesis test with empty maps and
sizes around the one-record and two-record limits, reassembling each map
to verify record headers, process IDs, and command names.
> diff --git a/tools/perf/tests/thread-map.c b/tools/perf/tests/thread-map.c
> index 877868107455e..ced1a357233d6 100644
> --- a/tools/perf/tests/thread-map.c
> +++ b/tools/perf/tests/thread-map.c
> @@ -1,6 +1,9 @@
> // SPDX-License-Identifier: GPL-2.0
> #include <stdlib.h>
> #include <string.h>
> +#include <errno.h>
> +#include <stdint.h>
> +#include <linux/kernel.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <sys/prctl.h>
[Severity: Low]
Should <stdbool.h> and <stdio.h> also be included explicitly here?
process_thread_map_chunk() uses bool and test_thread_map_chunks() calls
snprintf(), so relying on transitive includes risks build failures if
internal perf headers change or when building against musl.
[ ... ]
> +static int process_thread_map_chunk(const struct perf_tool *tool,
> + union perf_event *event,
> + struct perf_sample *sample __maybe_unused,
> + struct machine *machine __maybe_unused)
> +{
> + struct thread_map_synthesize *data = container_of(tool, struct thread_map_synthesize, tool);
> + struct perf_record_thread_map *map = &event->thread_map;
> + const int max_nr = (UINT16_MAX - sizeof(*map)) / sizeof(map->entries[0]);
[ ... ]
> +static int check_thread_map_chunks(struct thread_map_synthesize *data)
> +{
> + const int max_nr = (UINT16_MAX - sizeof(struct perf_record_thread_map)) /
> + sizeof(struct perf_record_thread_map_entry);
[ ... ]
> static int test__thread_map_synthesize(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
> {
> struct perf_thread_map *threads;
> + static const int sizes[] = { 0, 1, 2729, 2730, 3000, 5458, 5459 };
[Severity: Low]
Could max_nr be consolidated into a single file-scope constant or macro?
process_thread_map_chunk() and check_thread_map_chunks() duplicate the
per-record entry limit calculation, and sizes[] hardcodes 2729, 2730,
5458, and 5459 instead of expressing them in terms of max_nr. A shared
constant would remove the duplication and make the one-record and
two-record boundary sizes self-documenting.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-perf_fix_large_threads-v2-0-a6c077f3037d@arm.com?part=6
next prev parent reply other threads:[~2026-12-04 13:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 11:23 [PATCH v2 0/7] perf: Support thread maps larger than one record Leo Yan
2026-12-04 11:23 ` [PATCH v2 1/7] perf stat: Release aggregation maps on report exit Leo Yan
2026-12-04 11:23 ` [PATCH v2 2/7] perf stat: Drop CPU and thread map references " Leo Yan
2026-12-04 11:23 ` [PATCH v2 3/7] perf stat: Release the initial evlist before opening the session Leo Yan
2026-12-04 11:23 ` [PATCH v2 4/7] perf synthetic-events: Split oversized thread maps into records Leo Yan
2026-12-04 12:15 ` sashiko-bot
2026-12-04 12:31 ` Leo Yan
2026-12-04 11:23 ` [PATCH v2 5/7] perf: Assemble split thread maps in script and stat report Leo Yan
2026-12-04 12:39 ` sashiko-bot
2026-12-04 11:23 ` [PATCH v2 6/7] perf test: Cover multi-record thread map synthesis Leo Yan
2026-12-04 13:22 ` sashiko-bot [this message]
2026-12-04 11:23 ` [PATCH v2 7/7] perf docs: Describe multi-record thread maps Leo Yan
2026-12-04 13:22 ` [PATCH v2 0/7] perf: Support thread maps larger than one record sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-249856@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox