Commit 1e20324
committed
virtio-net: don't re-enable refill work too early when NAPI is disabled
Commit 4bc1281 ("virtio-net: disable delayed refill when pausing rx")
fixed a deadlock between reconfig paths and refill work trying to disable
the same NAPI instance. The refill work can't run in parallel with reconfig
because trying to double-disable a NAPI instance causes a stall under the
instance lock, which the reconfig path needs to re-enable the NAPI and
therefore unblock the stalled thread.
There are two cases where we re-enable refill too early. One is in the
virtnet_set_queues() handler. We call it when installing XDP:
virtnet_rx_pause_all(vi);
...
virtnet_napi_tx_disable(..);
...
virtnet_set_queues(..);
...
virtnet_rx_resume_all(..);
We want the work to be disabled until we call virtnet_rx_resume_all(),
but virtnet_set_queues() kicks it before NAPIs were re-enabled.
The other case is a more trivial case of mis-ordering in
__virtnet_rx_resume() found by code inspection.
Taking the spin lock in virtnet_set_queues() (requested during review)
may be unnecessary as we are under rtnl_lock and so are all paths writing
to ->refill_enabled.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Bui Quang Minh <minhquangbui99@gmail.com>
Fixes: 4bc1281 ("virtio-net: disable delayed refill when pausing rx")
Fixes: 413f027 ("net: protect NAPI enablement with netdev_lock()")
Link: https://patch.msgid.link/20250430163758.3029367-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 75dbdaa commit 1e20324
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3383 | 3383 | | |
3384 | 3384 | | |
3385 | 3385 | | |
| 3386 | + | |
3386 | 3387 | | |
3387 | 3388 | | |
3388 | | - | |
3389 | | - | |
| 3389 | + | |
3390 | 3390 | | |
3391 | 3391 | | |
| 3392 | + | |
| 3393 | + | |
| 3394 | + | |
3392 | 3395 | | |
3393 | 3396 | | |
3394 | 3397 | | |
| |||
3728 | 3731 | | |
3729 | 3732 | | |
3730 | 3733 | | |
3731 | | - | |
| 3734 | + | |
| 3735 | + | |
3732 | 3736 | | |
| 3737 | + | |
3733 | 3738 | | |
3734 | 3739 | | |
3735 | 3740 | | |
| |||
0 commit comments