All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leon Hwang" <leon.hwang@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v9 3/9] libbpf: Probe percpu data feature
Date: Mon, 13 Jul 2026 16:17:26 +0000	[thread overview]
Message-ID: <20260713161726.C4B491F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713154024.30851-4-leon.hwang@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The capability probe for percpu data incorrectly emits warnings and returns a negative error code when map creation fails on older kernels, breaking the silent probing expectation and causing double warnings.
--

--- Patch [3]: [PATCH bpf-next v9 3/9] libbpf: Probe percpu data feature ---
commit 4bf6930d4ace160491d05ec9880c9cadc9f81bc7
Author: Leon Hwang <leon.hwang@linux.dev>

libbpf: Probe percpu data feature

This commit adds a dedicated feature probe to libbpf for detecting whether
the kernel supports global percpu data. It checks this capability by
attempting to create a simple percpu array map and loading a basic socket
filter program that accesses it.

> diff --git a/tools/lib/bpf/features.c b/tools/lib/bpf/features.c
> index b7e388f99d0bb..ef9581c113035 100644
> --- a/tools/lib/bpf/features.c
> +++ b/tools/lib/bpf/features.c

[ ... ]

> @@ -620,6 +620,38 @@ static int probe_bpf_syscall_common_attrs(int token_fd)

[ ... ]

> +static int probe_kern_percpu_data(int token_fd)
> +{

[ ... ]

> +	map = bpf_map_create(BPF_MAP_TYPE_PERCPU_ARRAY, "libbpf_percpu", sizeof(int), 8, 1,
> +			     &map_opts);
> +	if (map < 0) {
> +		pr_warn("Error in %s(): %s. Couldn't create simple percpu_array map.\n",
> +			__func__, errstr(map));
> +		return map;
> +	}

[Severity: Medium]
Should this probe silently return 0 instead of propagating the negative error
code and printing a warning when bpf_map_create() fails?

When running on older kernels that genuinely lack BPF_MAP_TYPE_PERCPU_ARRAY
support, this code will print the pr_warn() above and return a negative error
code.

Because the caller feat_supported() expects 0 to cleanly indicate a missing
feature, returning a negative value causes feat_supported() to print a second
warning: "Detection of kernel kernel supports percpu data support failed".

Does this unintentionally pollute the logs with double warnings when apps are
safely falling back on older kernels?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260713154024.30851-1-leon.hwang@linux.dev?part=3

  reply	other threads:[~2026-07-13 16:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 15:40 [PATCH bpf-next v9 0/9] bpf: Introduce global percpu data Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 1/9] bpf: Drop duplicate blank lines in verifier Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 2/9] bpf: Introduce global percpu data Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 3/9] libbpf: Probe percpu data feature Leon Hwang
2026-07-13 16:17   ` sashiko-bot [this message]
2026-07-14  1:42     ` Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 4/9] libbpf: Add support for global percpu data Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 5/9] bpftool: Generate skeleton " Leon Hwang
2026-07-13 16:48   ` sashiko-bot
2026-07-14  5:45     ` Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 6/9] selftests/bpf: Add tests to verify " Leon Hwang
2026-07-13 17:13   ` sashiko-bot
2026-07-14  1:51     ` Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 7/9] selftests/bpf: Test direct reading/writing read-only percpu_array map Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 8/9] selftests/bpf: Test verifier log for global percpu data Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 9/9] selftests/bpf: Verify bpf_iter " Leon Hwang

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=20260713161726.C4B491F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=leon.hwang@linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.