From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Jakub Kicinski" <kuba@kernel.org>
Cc: "Mahe Tardy" <mahe.tardy@gmail.com>, <bpf@vger.kernel.org>,
<andrew+netdev@lunn.ch>, <andrii@kernel.org>, <ast@kernel.org>,
<daniel@iogearbox.net>, <davem@davemloft.net>,
<eddyz87@gmail.com>, <edumazet@google.com>,
<john.fastabend@gmail.com>, <martin.lau@linux.dev>,
<pabeni@redhat.com>, <song@kernel.org>, <liamwisehart@meta.com>
Subject: Re: [PATCH v1 1/4] bpf: Add netpoll kfuncs for sending UDP packets
Date: Tue, 12 May 2026 13:25:04 -0700 [thread overview]
Message-ID: <DIGZA9DICBXO.2QQ1V7T186JW2@gmail.com> (raw)
In-Reply-To: <20260512065335.50647ee9@kernel.org>
On Tue May 12, 2026 at 6:53 AM PDT, Jakub Kicinski wrote:
>> >> I like this netpoll approach way more then creating and keeping proper socket
>> >> within bpf and all head aches of keeping it around and doing send from
>> >> good context. With netpoll all of these issues are gone.
>> >> Just bpf_netpoll_send_udp() from anywhere and it works just like it does
>> >> for dmesg.
>> >
>> > No, netpoll is high risk / brittle and tightly integrated with NAPI.
>> >
>> > "I don't want to run a tiny user space program" is nowhere near strong
>> > enough justification to expose this API. SMH.
>>
>> No. Nothing to do with 'user space prog'.
>
> I'm sorry, are you saying that the motivation in the cover letter is
> not the motivation? It'd be great if someone could reveal the real
> motivation then.
AI makes commit logs sound very convincing, so I don't read them anymore
to avoid bias. Only looking at the code.
And what I see in this set is a facility for emergency notifications
that is safe to use in any context.
If people bolt crypto on top and make a toy prototype out of it
it doesn't take away from usefulness of sending UDP packets out.
I want to use it out of bpf core to notify of things like divide by zero,
arena fault, etc. Currently they are sent via bpf_stream, but
user space has to be there to pick up from the stream.
We cannot use printk, since it's not safe.
So netcons is the only option available today for 'bad things happen'
notifications.
Theoretically con->write_atomic() can be wrapped in such helper/kfunc
that both bpf core and bpf progs can call.
progs also need emergency notifications.
Like sched-ext might detect something bad and notify.
But at the end netconsole_write() is netpoll_send_udp(),
so more natural and simpler to just use that.
> In kernel sockets are used broadly. I accept that it's more work
> for you but it's also the correct way to go about this if you want
> to send traffic from BPF.
proper sockets and full TCP/UDP back and forth is a different use case.
Maybe it will work for Mahe/Liam. I don't know.
I'm arguing that emergency UDP is necessary too.
We can skip netpoll_send_udp() and let bpf core prepare skb
earlier in a good context, then at div-by-0 time populate it
with a message and call netpoll_send_skb().
Looks like netcons, bridge, vlan are using it, so why not let
bpf core use it too?
__netpoll_send_skb() is the main value here because
it's all trylock based at every step.
The div-by-0 notification using normal sockets would have to be
done async and that's the main downside.
We'd need to irq_work, then schedule_work and then send it via socket.
Way too many steps to do in emergency. If sched-ext messed it up
kthread may or may not wakeup.
next prev parent reply other threads:[~2026-05-12 20:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 8:53 [PATCH v1 0/4] bpf: Introduce bpf_netpoll Mahe Tardy
2026-05-11 8:53 ` [PATCH v1 1/4] bpf: Add netpoll kfuncs for sending UDP packets Mahe Tardy
2026-05-11 9:40 ` bot+bpf-ci
2026-05-11 9:51 ` Mahe Tardy
2026-05-11 12:05 ` Daniel Borkmann
2026-05-12 8:51 ` Mahe Tardy
2026-05-12 1:20 ` Jakub Kicinski
2026-05-12 1:59 ` Alexei Starovoitov
2026-05-12 2:36 ` Jakub Kicinski
2026-05-12 2:59 ` Alexei Starovoitov
2026-05-12 13:53 ` Jakub Kicinski
2026-05-12 20:25 ` Alexei Starovoitov [this message]
2026-05-12 23:32 ` Jakub Kicinski
2026-05-13 1:16 ` Alexei Starovoitov
2026-05-13 1:31 ` Song Liu
2026-05-11 8:53 ` [PATCH v1 2/4] selftests/bpf: Add netpoll kfunc sanity test Mahe Tardy
2026-05-11 8:53 ` [PATCH v1 3/4] selftests/bpf: Add netpoll kfunc IPv6 variant test Mahe Tardy
2026-05-11 8:53 ` [PATCH v1 4/4] selftests/bpf: Add netpoll setup basic tests Mahe Tardy
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=DIGZA9DICBXO.2QQ1V7T186JW2@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=liamwisehart@meta.com \
--cc=mahe.tardy@gmail.com \
--cc=martin.lau@linux.dev \
--cc=pabeni@redhat.com \
--cc=song@kernel.org \
/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