From: Yonghong Song <yhs@fb.com>
To: Kuniyuki Iwashima <kuniyu@amazon.co.jp>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>
Cc: Benjamin Herrenschmidt <benh@amazon.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>, <bpf@vger.kernel.org>,
<netdev@vger.kernel.org>
Subject: Re: [PATCH v3 bpf-next 1/2] bpf: af_unix: Implement BPF iterator for UNIX domain socket.
Date: Thu, 5 Aug 2021 09:53:40 -0700 [thread overview]
Message-ID: <442b59b1-f7db-6bce-8fd8-d411ddec0956@fb.com> (raw)
In-Reply-To: <20210804070851.97834-2-kuniyu@amazon.co.jp>
On 8/4/21 12:08 AM, Kuniyuki Iwashima wrote:
> This patch implements the BPF iterator for the UNIX domain socket and
> exports some functions under GPL for the CONFIG_UNIX=m case.
>
> Currently, the batch optimization introduced for the TCP iterator in the
> commit 04c7820b776f ("bpf: tcp: Bpf iter batching and lock_sock") is not
> applied. It will require replacing the big lock for the hash table with
> small locks for each hash list not to block other processes.
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
> ---
> fs/proc/proc_net.c | 2 +
> include/linux/btf_ids.h | 3 +-
> kernel/bpf/bpf_iter.c | 3 ++
> net/core/filter.c | 1 +
> net/unix/af_unix.c | 93 +++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 101 insertions(+), 1 deletion(-)
>
> diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
> index 15c2e55d2ed2..887a8102da9f 100644
> --- a/fs/proc/proc_net.c
> +++ b/fs/proc/proc_net.c
> @@ -91,6 +91,7 @@ int bpf_iter_init_seq_net(void *priv_data, struct bpf_iter_aux_info *aux)
> #endif
> return 0;
> }
> +EXPORT_SYMBOL_GPL(bpf_iter_init_seq_net);
bpf_iter does not support modules for now as it is implemented before
module btf support. It needs some changes.
For example, currently bpf_iter only caches/uses the vmlinux btf_id
and module obj_id and module btf_id is not used.
One example is ipv6 and bpf_iter is guarded with IS_BUILTIN(CONFIG_IPV6).
So you could (1) add btf_iter support module btf in this patch set, or
(2). check IS_BUILTIN(CONFIG_UNIX). (2) might be easier and you can have
a subsequent patch set to add module support for bpf_iter. But it is
up to you.
>
> void bpf_iter_fini_seq_net(void *priv_data)
> {
> @@ -100,6 +101,7 @@ void bpf_iter_fini_seq_net(void *priv_data)
> put_net(p->net);
> #endif
[...]
next prev parent reply other threads:[~2021-08-05 16:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-04 7:08 [PATCH v3 bpf-next 0/2] BPF iterator for UNIX domain socket Kuniyuki Iwashima
2021-08-04 7:08 ` [PATCH v3 bpf-next 1/2] bpf: af_unix: Implement " Kuniyuki Iwashima
2021-08-05 16:53 ` Yonghong Song [this message]
2021-08-06 0:21 ` Kuniyuki Iwashima
2021-08-06 0:41 ` Martin KaFai Lau
2021-08-06 1:05 ` Kuniyuki Iwashima
2021-08-04 7:08 ` [PATCH v3 bpf-next 2/2] selftest/bpf: Implement sample UNIX domain socket iterator program Kuniyuki Iwashima
2021-08-05 16:59 ` Yonghong Song
2021-08-06 0:24 ` Kuniyuki Iwashima
2021-08-06 23:33 ` Andrii Nakryiko
2021-08-07 0:09 ` Kuniyuki Iwashima
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=442b59b1-f7db-6bce-8fd8-d411ddec0956@fb.com \
--to=yhs@fb.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=benh@amazon.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=kuniyu@amazon.co.jp \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.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;
as well as URLs for NNTP newsgroup(s).