[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aF1+9YlFUF8vWH4P@gmail.com>
Date: Thu, 26 Jun 2025 10:10:13 -0700
From: Breno Leitao <leitao@...ian.org>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Shuah Khan <shuah@...nel.org>, Simon Horman <horms@...nel.org>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
linux-kselftest@...r.kernel.org, bpf@...r.kernel.org,
gustavold@...il.com
Subject: Re: [PATCH net-next v2 4/4] selftests: net: add netpoll basic
functionality test
On Thu, Jun 26, 2025 at 12:31:10PM -0400, Willem de Bruijn wrote:
> Breno Leitao wrote:
> > Add a basic selftest for the netpoll polling mechanism, specifically
> > targeting the netpoll poll() side.
> >
> > The test creates a scenario where network transmission is running at
> > maximum speed, and netpoll needs to poll the NIC. This is achieved by:
> >
> > 1. Configuring a single RX/TX queue to create contention
> > 2. Generating background traffic to saturate the interface
> > 3. Sending netconsole messages to trigger netpoll polling
> > 4. Using dynamic netconsole targets via configfs
> > 5. Delete and create new netconsole targets after some messages
> > 6. Start a bpftrace in parallel to make sure netpoll_poll_dev() is
> > called
> > 7. If bpftrace exists and netpoll_poll_dev() was called, stop.
> >
> > The test validates a critical netpoll code path by monitoring traffic
> > flow and ensuring netpoll_poll_dev() is called when the normal TX path
> > is blocked.
> >
> > This addresses a gap in netpoll test coverage for a path that is
> > tricky for the network stack.
> >
> > Signed-off-by: Breno Leitao <leitao@...ian.org>
>
> > +def bpftrace_call() -> None:
> > + """Call bpftrace to find how many times netpoll_poll_dev() is called.
> > + Output is saved in the global variable `maps`"""
> > +
> > + # This is going to update the global variable, that will be seen by the
> > + # main function
> > + global MAPS # pylint: disable=W0603
> > +
> > + # This will be passed to bpftrace as in bpftrace -e "expr"
> > + expr = "BEGIN{ @hits = 0;} kprobe:netpoll_poll_dev { @hits += 1; }"
>
> Is that BEGIN statement needed? I generally just use count().
If I use `hits += 1` then yes, but, I've learned that I don't need it if
I use `count()`. So, I will see something like:
kprobe:netpoll_poll_dev { @hits = count(); }
> > +
> > + MAPS = bpftrace(expr, timeout=BPFTRACE_TIMEOUT, json=True)
> > + logging.debug("BPFtrace output: %s", MAPS)
> > +
> > +
> > +def bpftrace_start():
> > + """Start a thread to call `call_bpf` in parallel for 2 seconds."""
>
> Stale comment? BPFTRACE_TIMEOUT is set to 15.
Yes. I will remove it.
Thanks for the review,
--breno
Powered by blists - more mailing lists