From: bot+bpf-ci@kernel.org
To: sh_def@163.com,qmo@kernel.org
Cc: bpf@vger.kernel.org,linux-kernel@vger.kernel.org,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com,martin.lau@linux.dev,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,ihor.solodrai@linux.dev,davem@davemloft.net,kuba@kernel.org,horms@kernel.org,sh_def@163.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf v2 2/2] bpftool: Fix sparse CPU IDs in prog profile
Date: Fri, 18 Sep 2026 11:38:17 +0000 (UTC) [thread overview]
Message-ID: <bb560a0b6748ccfdf1f1f5ba5927b63c57133e5246bcaa61cc35ff2f6b92f480@mail.kernel.org> (raw)
In-Reply-To: <20260918102052.1247819-3-sh_def@163.com>
[-- Attachment #1: Type: text/plain, Size: 2660 bytes --]
> Tested:
> - Built tools/bpf/bpftool successfully on the host.
> - Booted an arm64 QEMU guest with a patched virt device tree reporting
> possible=0,2-3, present=0,2-3, and online=0,2-3.
> - Ran both pre-fix and fixed bpftool with cycles and instructions against
> a BTF-enabled fentry target. The pre-fix binary faulted in
> perf_event_alloc(), while the fixed binary reached perf-event setup and
> reported failure to create the instructions event on CPU 0. QEMU did
> not provide a usable hardware PMU runtime result, so no profile counts
> are claimed.
This isn't a bug, but would it read better to move the Tested: block
below the --- line, or fold it into a shorter sentence, so the changelog
itself stays focused on the sparse-mask problem and the new stride? The
block is the longest section of the message while reporting that the run
did not produce a usable result ("reported failure to create the
instructions event on CPU 0", "QEMU did not provide a usable hardware
PMU runtime result, so no profile counts are claimed").
> diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
> index a9f730d407a92..bb969ffce453d 100644
> --- a/tools/bpf/bpftool/prog.c
> +++ b/tools/bpf/bpftool/prog.c
[ ... ]
> @@ -2440,7 +2449,8 @@ static void int_exit(int signo)
>
> static int do_profile(int argc, char **argv)
> {
> - int num_metric, num_cpu, err = -1;
> + int num_metric, err = -1;
> + int *cpu_ids = NULL;
> struct bpf_program *prog;
> unsigned long duration;
> char *endptr;
[ ... ]
> @@ -2471,11 +2481,13 @@ static int do_profile(int argc, char **argv)
> if (num_metric <= 0)
> goto out;
>
> - num_cpu = libbpf_num_possible_cpus();
> - if (num_cpu <= 0) {
> + profile_cpu_cnt = get_possible_cpu_ids(&cpu_ids);
> + if (profile_cpu_cnt <= 0) {
> p_err("failed to identify number of CPUs");
> goto out;
> }
> + profile_cpu_ids = cpu_ids;
> + profile_cpu_id_span = cpu_ids[profile_cpu_cnt - 1] + 1;
This isn't a bug, but could this pass &profile_cpu_ids straight into
get_possible_cpu_ids() and drop the local plus its initializer, since
the helper already clears the output pointer on entry? The local cpu_ids
exists only to be copied into the profile_cpu_ids static on the next
line, and its = NULL initializer is never observed because
get_possible_cpu_ids() unconditionally does *cpu_ids = NULL as its first
statement.
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35336124623
next prev parent reply other threads:[~2026-09-18 11:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 10:20 [PATCH bpf v2 0/2] bpftool: Fix sparse CPU IDs Hui Su
2026-09-18 10:20 ` [PATCH bpf v2 1/2] bpftool: Fix CPU IDs in per-CPU map output Hui Su
2026-09-18 11:38 ` bot+bpf-ci
2026-09-18 10:20 ` [PATCH bpf v2 2/2] bpftool: Fix sparse CPU IDs in prog profile Hui Su
2026-09-18 11:38 ` bot+bpf-ci [this message]
2026-09-21 21:59 ` Andrii Nakryiko
2026-09-22 3:15 ` Hui Su
2026-09-18 11:26 ` [PATCH bpf v2 0/2] bpftool: Fix sparse CPU IDs Quentin Monnet
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=bb560a0b6748ccfdf1f1f5ba5927b63c57133e5246bcaa61cc35ff2f6b92f480@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=horms@kernel.org \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=mason@kernel.org \
--cc=memxor@gmail.com \
--cc=qmo@kernel.org \
--cc=sh_def@163.com \
--cc=song@kernel.org \
--cc=yonghong.song@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
all inboxes | Powered by JetHome®