[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <685d75ceb113c_2e676c294d1@willemb.c.googlers.com.notmuch>
Date: Thu, 26 Jun 2025 12:31:10 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Breno Leitao <leitao@...ian.org>,
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>
Cc: linux-kernel@...r.kernel.org,
netdev@...r.kernel.org,
linux-kselftest@...r.kernel.org,
Willem de Bruijn <willemdebruijn.kernel@...il.com>,
bpf@...r.kernel.org,
gustavold@...il.com,
Breno Leitao <leitao@...ian.org>
Subject: Re: [PATCH net-next v2 4/4] selftests: net: add netpoll basic
functionality test
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().
> +
> + 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.
> + global BPF_THREAD # pylint: disable=W0603
> +
> + BPF_THREAD = threading.Thread(target=bpftrace_call)
> + BPF_THREAD.start()
> + if not BPF_THREAD.is_alive():
> + raise KsftSkipEx("BPFtrace thread is not alive. Skipping test")
> +
> +
Powered by blists - more mailing lists