From: Jakub Kicinski <kuba@kernel.org>
To: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
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 16:32:55 -0700 [thread overview]
Message-ID: <20260512163255.34162f1a@kernel.org> (raw)
In-Reply-To: <DIGZA9DICBXO.2QQ1V7T186JW2@gmail.com>
On Tue, 12 May 2026 13:25:04 -0700 Alexei Starovoitov wrote:
> On Tue May 12, 2026 at 6:53 AM PDT, Jakub Kicinski wrote:
> >> 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.
True, but I hope a real use case does exist for this given it's posted?
> 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.
printk is unsafe but netconsole is 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.
This sounds very scary. I mean it sounds exacting and technically
challenging, but I really don't want this to hinge on netpoll.
netpoll is not a good solution to synchronization problems.
> > 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?
Those drivers are not really using it, they are just trying to pass thru
the skb to the lower dev. And I'd be surprised if most of that stuff
even works, don't think it has any users. Most people try to pipe
netcons to eth0.
> __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.
I think you may be overly optimistic on the dependability of netpoll.
Rik has added support for serial scraping at Meta because netconsole
misses a lot of crucial alerts. And I can confirm there's a bunch of
errors that appear in that dataset that are missed by netcons.
Then there are little nuggets like some generations of bnxt NICs
having to discard all Rx frames when netcons is trying to send
and Tx is full (bnxt_force_rx_discard()). netpoll is really meant
for very narrow use cases, please trust me, opening it up for broader
use is not going to end well.
next prev parent reply other threads:[~2026-05-12 23:32 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
2026-05-12 23:32 ` Jakub Kicinski [this message]
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=20260512163255.34162f1a@kernel.org \
--to=kuba@kernel.org \
--cc=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=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