public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Ihor Solodrai <ihor.solodrai@linux.dev>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Eduard Zingerman <eddyz87@gmail.com>,
	bpf@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH bpf-next v3 1/2] bpf: Support struct btf_struct_meta via KF_IMPLICIT_ARGS
Date: Thu, 19 Mar 2026 13:25:36 +0100	[thread overview]
Message-ID: <abvrQATstf5nuOpK@krava> (raw)
In-Reply-To: <20260318234210.1840295-1-ihor.solodrai@linux.dev>

On Wed, Mar 18, 2026 at 04:42:09PM -0700, Ihor Solodrai wrote:

SNIP

>  
> +/*
> + * A kfunc with KF_IMPLICIT_ARGS has two prototypes in BTF:
> + *   - the _impl prototype with full arg list (this is meta->func_proto)
> + *   - the BPF API prototype w/o implicit args (func->type in BTF)
> + * To determine whether an argument is implicit, we compare its position
> + * against the number of arguments of both prototypes.
> + */
> +static bool is_kfunc_arg_implicit(const struct bpf_kfunc_call_arg_meta *meta, u32 arg_idx)
> +{
> +	const struct btf_type *func, *func_proto;
> +	u32 argn, full_argn;
> +
> +	if (!(meta->kfunc_flags & KF_IMPLICIT_ARGS))
> +		return false;
> +
> +	full_argn = btf_type_vlen(meta->func_proto);
> +
> +	func = btf_type_by_id(meta->btf, meta->func_id);
> +	func_proto = btf_type_by_id(meta->btf, func->type);
> +	argn = btf_type_vlen(func_proto);
> +
> +	return argn <= arg_idx && arg_idx < full_argn;

hi,
I understand above is faster, but should we rather check for exact
types with something like:

__is_kfunc_ptr_arg_type(btf, arg, KF_ARG_PROG_AUX_ID ||
__is_kfunc_ptr_arg_type(btf, arg, KF_ARG_BTF_STRUCT_META

jirka

  parent reply	other threads:[~2026-03-19 12:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 23:42 [PATCH bpf-next v3 1/2] bpf: Support struct btf_struct_meta via KF_IMPLICIT_ARGS Ihor Solodrai
2026-03-18 23:42 ` [PATCH bpf-next v3 2/2] selftests/bpf: Update kfuncs using btf_struct_meta to new variants Ihor Solodrai
2026-03-19 12:30   ` Jiri Olsa
2026-03-19 20:43     ` Ihor Solodrai
2026-03-20 11:06       ` Jiri Olsa
2026-03-20 14:50   ` Mykyta Yatsenko
2026-03-19 12:25 ` Jiri Olsa [this message]
2026-03-19 20:37   ` [PATCH bpf-next v3 1/2] bpf: Support struct btf_struct_meta via KF_IMPLICIT_ARGS Ihor Solodrai
2026-03-20 15:49 ` Mykyta Yatsenko
2026-03-27  0:16   ` Ihor Solodrai
2026-03-27 19:19     ` Mykyta Yatsenko
2026-03-21 20:27 ` Alexei Starovoitov
2026-03-23 19:58   ` Ihor Solodrai
2026-03-24 17:22     ` Alexei Starovoitov
2026-03-26 19:13       ` Ihor Solodrai
2026-03-27 20:48         ` Alexei Starovoitov
2026-03-27 20:55           ` Ihor Solodrai
2026-03-27 21:00             ` Alexei Starovoitov
2026-03-27 21:08               ` Ihor Solodrai
2026-03-27 21:47                 ` Alexei Starovoitov
2026-03-27 22:06                   ` Ihor Solodrai

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=abvrQATstf5nuOpK@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@meta.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