From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
James Clark <james.clark@linaro.org>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Clark Williams <williams@redhat.com>,
linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Hang Zhengyang <hang.zhengyang1010@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH] perf bpf_counter: Fix the 32-bit build
Date: Fri, 27 Nov 2026 22:31:44 -0300 [thread overview]
Message-ID: <20261128013144.16600-1-acme@kernel.org> (raw)
The bpffs hint added for the perf_event_attr map compares st.f_type with
BPF_FS_MAGIC. On 32-bit glibc __fsword_t is int while BPF_FS_MAGIC is
unsigned int, so the comparison is a sign-compare warning:
util/bpf_counter.c:394:43: error: comparison of integer expressions of
different signedness: '__fsword_t' {aka 'int'} and 'unsigned int'
[-Werror=sign-compare]
It is fatal where perf builds with WERROR=1, as the almalinux i386
images do; Debian builds with WERROR=0 and only warns, and Alpine's musl
defines f_type as unsigned long, so it does not warn at all.
Cast f_type to unsigned long, the form tools/bpf/bpftool/common.c uses,
which is warning-free on both 32 and 64-bit.
Fixes: 2ea09b93b4ca61c1 ("perf bpf_counter: Say why the perf_event_attr map can't be used")
Cc: Hang Zhengyang <hang.zhengyang1010@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/bpf_counter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
index 9a463eb9d51d9b2f..6a1d9081f0db5b80 100644
--- a/tools/perf/util/bpf_counter.c
+++ b/tools/perf/util/bpf_counter.c
@@ -391,7 +391,7 @@ static void bperf_pin_hint(struct target *target, const char *path)
scnprintf(buf, sizeof(buf), "%s", path);
dir = dirname(buf);
- if (statfs(dir, &st) || st.f_type == BPF_FS_MAGIC)
+ if (statfs(dir, &st) || (unsigned long)st.f_type == BPF_FS_MAGIC)
return;
if (target->attr_map)
pr_err("--bpf-attr-map: %s is not on bpffs\n", dir);
--
2.56.0
next reply other threads:[~2026-11-28 1:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 1:31 Arnaldo Carvalho de Melo [this message]
2026-11-28 1:36 ` [PATCH] perf bpf_counter: Fix the 32-bit build 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=20261128013144.16600-1-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=hang.zhengyang1010@gmail.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.com \
/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