linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Shuah Khan <shuah@kernel.org>, Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-kselftest@vger.kernel.org, bpf@vger.kernel.org,
	gustavold@gmail.com
Subject: Re: [PATCH net-next v2 4/4] selftests: net: add netpoll basic functionality test
Date: Thu, 26 Jun 2025 10:10:13 -0700	[thread overview]
Message-ID: <aF1+9YlFUF8vWH4P@gmail.com> (raw)
In-Reply-To: <685d75ceb113c_2e676c294d1@willemb.c.googlers.com.notmuch>

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@debian.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

  reply	other threads:[~2025-06-26 17:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25 11:39 [PATCH net-next v2 0/4] selftest: net: Add selftest for netpoll Breno Leitao
2025-06-25 11:39 ` [PATCH net-next v2 1/4] selftests: drv-net: add helper/wrapper for bpftrace Breno Leitao
2025-06-25 22:12   ` Jakub Kicinski
2025-06-25 11:39 ` [PATCH net-next v2 2/4] selftests: drv-net: Improve bpftrace utility error handling Breno Leitao
2025-06-25 21:48   ` Jakub Kicinski
2025-06-26 13:11     ` Breno Leitao
2025-06-25 11:39 ` [PATCH net-next v2 3/4] selftests: drv-net: Strip '@' prefix from bpftrace map keys Breno Leitao
2025-06-25 22:07   ` Jakub Kicinski
2025-06-26 13:04     ` Breno Leitao
2025-06-25 11:39 ` [PATCH net-next v2 4/4] selftests: net: add netpoll basic functionality test Breno Leitao
2025-06-25 22:09   ` Jakub Kicinski
2025-06-26 10:31     ` Breno Leitao
2025-06-26  8:25   ` Simon Horman
2025-06-27 15:18     ` Breno Leitao
2025-06-26 16:31   ` Willem de Bruijn
2025-06-26 17:10     ` Breno Leitao [this message]
2025-06-25 18:43 ` [PATCH net-next v2 0/4] selftest: net: Add selftest for netpoll Simon Horman
2025-06-25 21:46   ` Jakub Kicinski
2025-06-26  8:17     ` Simon Horman

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=aF1+9YlFUF8vWH4P@gmail.com \
    --to=leitao@debian.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gustavold@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=willemdebruijn.kernel@gmail.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).