From: Bobby Eshleman <bobbyeshleman@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v4 8/8] selftests: drv-net: add netkit devmem tests
Date: Wed, 13 May 2026 19:29:25 -0700 [thread overview]
Message-ID: <agUzhWhoadL/TMiI@devvm29614.prn0.facebook.com> (raw)
In-Reply-To: <20260513190709.6693CC19425@smtp.kernel.org>
On Wed, May 13, 2026 at 07:07:07PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
> - [High] Uncaught `KsftSkipEx` exceptions in `main()` cause the test to fail instead of reporting as skipped.
> - [High] Global NIC configuration changes are leaked if the setup phase fails, breaking exception safety and corrupting the host NIC state.
> - [Medium] The commit message incorrectly claims that `nk_qlease.py` configures the NIC once in `main()` to avoid re-toggling settings.
> --
>
> commit daf9f495f84bddbf201c5b6c6297e5e878d7ea77
> Author: Bobby Eshleman <bobbyeshleman@meta.com>
>
> selftests: drv-net: add netkit devmem tests
>
> Add nk_devmem.py with four tests for TCP devmem through a netkit device.
>
> > The NIC (HDS, RSS, queue lease) is configured once in main() before
> > ksft_run() and torn down in a finally block via cleanup_nic(), mirroring
> > the nk_qlease.py pattern.
>
> Is this description accurate? Looking at nk_qlease.py, it does not configure
> NIC settings in main(). Instead, it configures and re-toggles settings like
> rings and RSS within individual test cases using defer() for cleanup.
>
> Could the commit message be updated to reflect this accurately?
>
> > diff --git a/tools/testing/selftests/drivers/net/hw/nk_devmem.py b/tools/testing/selftests/drivers/net/hw/nk_devmem.py
> > new file mode 100755
> > index 0000000000000..0e36a0fa96888
> > --- /dev/null
> > +++ b/tools/testing/selftests/drivers/net/hw/nk_devmem.py
> > @@ -0,0 +1,55 @@
> [ ... ]
> > +def main() -> None:
> > + """Configure the NIC once, then run the netkit devmem test cases."""
> > + with NetDrvContEnv(__file__, rxqueues=2, primary_rx_redirect=True) as cfg:
> > + setup_test(cfg,
> > + os.path.join(os.path.dirname(os.path.abspath(__file__)),
> > + "ncdevmem"))
> > +
> > + require_devmem(cfg)
> > + configure_nic(cfg)
>
> If require_devmem() or configure_nic() raises KsftSkipEx because the
> environment lacks devmem support or sufficient NIC channels, will this cause
> the Python script to crash with an unhandled exception instead of cleanly
> skipping?
>
> Because these functions are called outside the ksft_run() test runner loop,
> it appears KsftSkipEx won't be caught, resulting in a non-zero exit code
> instead of Kselftest's expected SKIP exit code (4).
>
> Furthermore, if configure_nic() raises an exception halfway through its
> modifications (for example, if an ethtool command fails after initial ring
> modifications), will this leak global NIC configuration changes?
>
> Since configure_nic() is called before the try...finally block, an exception
> here would cause the script to terminate immediately. This bypasses
> cleanup_nic() and leaves the host NIC permanently modified.
>
> Should configure_nic() be moved inside the try block to ensure cleanup_nic()
> is always executed?
>
> > + try:
> > + ksft_run([check_nk_rx, check_nk_tx, check_nk_tx_chunks,
> > + check_nk_rx_hds], args=(cfg,))
> > + finally:
> > + cleanup_nic(cfg)
>
Will address all of this in next rev.
Best,
Bobby
prev parent reply other threads:[~2026-05-14 2:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 1:17 [PATCH net-next v4 0/8] net: devmem: support devmem with netkit devices Bobby Eshleman
2026-05-12 1:17 ` [PATCH net-next v4 1/8] net: convert netmem_tx flag to enum Bobby Eshleman
2026-05-12 1:17 ` [PATCH net-next v4 2/8] net: netkit: declare NETMEM_TX_NO_DMA mode Bobby Eshleman
2026-05-12 1:17 ` [PATCH net-next v4 3/8] net: devmem: support TX over NETMEM_TX_NO_DMA devices Bobby Eshleman
2026-05-13 4:05 ` sashiko-bot
2026-05-12 1:17 ` [PATCH net-next v4 4/8] selftests: drv-net: ncdevmem: add -n flag to skip NIC configuration Bobby Eshleman
2026-05-12 1:17 ` [PATCH net-next v4 5/8] selftests: drv-net: make attr _nk_guest_ifname public Bobby Eshleman
2026-05-12 1:18 ` [PATCH net-next v4 6/8] selftests: drv-net: refactor devmem command builders into lib module Bobby Eshleman
2026-05-13 5:12 ` sashiko-bot
2026-05-14 2:21 ` Jakub Kicinski
2026-05-14 2:28 ` Bobby Eshleman
2026-05-14 2:38 ` Jakub Kicinski
2026-05-12 1:18 ` [PATCH net-next v4 7/8] selftests: drv-net: add primary_rx_redirect support to NetDrvContEnv Bobby Eshleman
2026-05-13 5:42 ` sashiko-bot
2026-05-12 1:18 ` [PATCH net-next v4 8/8] selftests: drv-net: add netkit devmem tests Bobby Eshleman
2026-05-13 19:07 ` sashiko-bot
2026-05-14 2:29 ` Bobby Eshleman [this message]
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=agUzhWhoadL/TMiI@devvm29614.prn0.facebook.com \
--to=bobbyeshleman@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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