mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Tao Chen <chen.dylane@linux.dev>,
	razor@blackwall.org, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	ast@kernel.org, andrii@kernel.org, martin.lau@linux.dev,
	eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
	haoluo@google.com, jolsa@kernel.org, mattbobrowski@google.com,
	rostedt@goodmis.org, mhiramat@kernel.org,
	mathieu.desnoyers@efficios.com, horms@kernel.org,
	willemb@google.com, jakub@cloudflare.com, pablo@netfilter.org,
	kadlec@netfilter.org, hawk@kernel.org
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org
Subject: Re: [PATCH bpf-next v3 1/7] bpf: Add attach_type in bpf_link
Date: Wed, 9 Jul 2025 15:15:40 +0200	[thread overview]
Message-ID: <9393fab5-2b8a-4e56-aa5a-5f601d570b47@iogearbox.net> (raw)
In-Reply-To: <20250709030802.850175-2-chen.dylane@linux.dev>

On 7/9/25 5:07 AM, Tao Chen wrote:
> Attach_type will be set when link created from user, it is better
> to record attach_type in bpf_link directly suggested by Andrii. So
> add the attach_type field in bpf_link and move the sleepable field to
> the end just to fill the byte hole.
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>
> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
> ---
>   drivers/net/netkit.c           |  2 +-
>   include/linux/bpf.h            | 28 ++++++++++++++++-----------
>   kernel/bpf/bpf_iter.c          |  3 ++-
>   kernel/bpf/bpf_struct_ops.c    |  5 +++--
>   kernel/bpf/cgroup.c            |  4 ++--
>   kernel/bpf/net_namespace.c     |  2 +-
>   kernel/bpf/syscall.c           | 35 +++++++++++++++++++++-------------
>   kernel/bpf/tcx.c               |  3 ++-
>   kernel/bpf/trampoline.c        | 10 ++++++----
>   kernel/trace/bpf_trace.c       |  4 ++--
>   net/bpf/bpf_dummy_struct_ops.c |  3 ++-
>   net/core/dev.c                 |  3 ++-
>   net/core/sock_map.c            |  3 ++-
>   net/netfilter/nf_bpf_link.c    |  3 ++-
>   14 files changed, 66 insertions(+), 42 deletions(-)
[...]

> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 34dd90ec7fa..dd5070039de 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -1729,12 +1729,10 @@ struct bpf_link {
>   	enum bpf_link_type type;
>   	const struct bpf_link_ops *ops;
>   	struct bpf_prog *prog;
> -	/* whether BPF link itself has "sleepable" semantics, which can differ
> -	 * from underlying BPF program having a "sleepable" semantics, as BPF
> -	 * link's semantics is determined by target attach hook
> -	 */
> -	bool sleepable;
> +
>   	u32 flags;
> +	enum bpf_attach_type attach_type;
> +
>   	/* rcu is used before freeing, work can be used to schedule that
>   	 * RCU-based freeing before that, so they never overlap
>   	 */
> @@ -1742,6 +1740,11 @@ struct bpf_link {
>   		struct rcu_head rcu;
>   		struct work_struct work;
>   	};
> +	/* whether BPF link itself has "sleepable" semantics, which can differ
> +	 * from underlying BPF program having a "sleepable" semantics, as BPF
> +	 * link's semantics is determined by target attach hook
> +	 */
> +	bool sleepable;
>   };

lgtm, it looks a bit weird at the end here after rcu/work but in future if other
attributes get added to the link obj and a new hole frees up we can move it up
again. Definitely good the rationale for the move is documented in the commit msg.

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

  reply	other threads:[~2025-07-09 13:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09  3:07 [PATCH bpf-next v3 0/7] " Tao Chen
2025-07-09  3:07 ` [PATCH bpf-next v3 1/7] bpf: " Tao Chen
2025-07-09 13:15   ` Daniel Borkmann [this message]
2025-07-09  3:07 ` [PATCH bpf-next v3 2/7] bpf: Remove attach_type in bpf_cgroup_link Tao Chen
2025-07-09 13:07   ` Daniel Borkmann
2025-07-09  3:07 ` [PATCH bpf-next v3 3/7] bpf: Remove attach_type in sockmap_link Tao Chen
2025-07-09 13:07   ` Daniel Borkmann
2025-07-09  3:07 ` [PATCH bpf-next v3 4/7] bpf: Remove location field in tcx_link Tao Chen
2025-07-09 10:39   ` Daniel Borkmann
2025-07-09  3:08 ` [PATCH bpf-next v3 5/7] bpf: Remove attach_type in bpf_netns_link Tao Chen
2025-07-09  8:21   ` Jakub Sitnicki
2025-07-09  8:58     ` Tao Chen
2025-07-09  3:08 ` [PATCH bpf-next v3 6/7] bpf: Remove attach_type in bpf_tracing_link Tao Chen
2025-07-09  3:08 ` [PATCH bpf-next v3 7/7] netkit: Remove location field in netkit_link Tao Chen
2025-07-09  7:37   ` Nikolay Aleksandrov
2025-07-09 10:39   ` Daniel Borkmann
2025-07-09  8:22 ` [PATCH bpf-next v3 0/7] Add attach_type in bpf_link Jakub Sitnicki

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=9393fab5-2b8a-4e56-aa5a-5f601d570b47@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chen.dylane@linux.dev \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=haoluo@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kadlec@netfilter.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mattbobrowski@google.com \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=razor@blackwall.org \
    --cc=rostedt@goodmis.org \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=willemb@google.com \
    --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®