Re: [PATCH] netdevsim: fix deadlock in nsim_bus_dev_max_vfs_write()
From: Jakub Kicinski
Date: Fri Aug 07 2026 - 17:48:10 EST
On Fri, 7 Aug 2026 09:31:20 +0200 Slawomir Stepien wrote:
> That's true, but is netdevsim used *just* by the selftests (or was
> designed with only selftests in mind)? What if someone is using it
> without selftests?
Quoting documentation:
netdevsim
~~~~~~~~~
``netdevsim`` is a test driver which can be used to exercise driver
configuration APIs without requiring capable hardware.
Mock-ups and tests based on ``netdevsim`` are encouraged when
adding new APIs with complex logic in the stack. The tests should
be written so that they can run both against ``netdevsim`` and a real
device (see ``tools/testing/selftests/drivers/net/README.rst``).
``netdevsim``-only tests should focus on testing corner cases
and failure paths in the core which are hard to exercise with a real driver.
``netdevsim`` in itself is **not** considered
a use case/user. You must also implement the new APIs in a real driver.
We give no guarantees that ``netdevsim`` won't change in the future
in a way which would break what would normally be considered uAPI.
``netdevsim`` is reserved for use by upstream tests only, so any
new ``netdevsim`` features must be accompanied by selftests under
``tools/testing/selftests/``.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#netdevsim
> On the other hand: what sashiko found:
> https://netdev-ai.bots.linux.dev/sashiko/#/patchset/b7bf56ea-7522-4163-acd5-aaa69ad03b3a%40mail.kernel.org
> is true: the same issue will be with e.g. break_health. So it seems
> to me that a better approach would be to change when the debugfs
> files are removed.
I seem to recall being annoyed at the fact that the health API takes
devlink lock. It should be callable from IRQ even. Forcing drivers
to worry about calling context is annoying for real drivers too.
> It seems to me that change in nsim_drv_remove() might be easy, but
> what about nsim_dev_reload_down()...it seems it will have the same
> deadlock. Or am I missing something for this case?
netdevsim is just a test mock. Fixing it for the sake of fixing
netdevsim is a waste of everyone's time. The first question you should
be asking yourself is "do I understand what this code was *designed
for*"..