Commit 4bc1281
virtio-net: disable delayed refill when pausing rx
When pausing rx (e.g. set up xdp, xsk pool, rx resize), we call
napi_disable() on the receive queue's napi. In delayed refill_work, it
also calls napi_disable() on the receive queue's napi. When
napi_disable() is called on an already disabled napi, it will sleep in
napi_disable_locked while still holding the netdev_lock. As a result,
later napi_enable gets stuck too as it cannot acquire the netdev_lock.
This leads to refill_work and the pause-then-resume tx are stuck
altogether.
This scenario can be reproducible by binding a XDP socket to virtio-net
interface without setting up the fill ring. As a result, try_fill_recv
will fail until the fill ring is set up and refill_work is scheduled.
This commit adds virtnet_rx_(pause/resume)_all helpers and fixes up the
virtnet_rx_resume to disable future and cancel all inflights delayed
refill_work before calling napi_disable() to pause the rx.
Fixes: 413f027 ("net: protect NAPI enablement with netdev_lock()")
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://patch.msgid.link/20250417072806.18660-2-minhquangbui99@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent b7f0ee9 commit 4bc1281
1 file changed
+57
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3342 | 3342 | | |
3343 | 3343 | | |
3344 | 3344 | | |
3345 | | - | |
| 3345 | + | |
| 3346 | + | |
3346 | 3347 | | |
3347 | 3348 | | |
3348 | 3349 | | |
| |||
3352 | 3353 | | |
3353 | 3354 | | |
3354 | 3355 | | |
3355 | | - | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
| 3383 | + | |
3356 | 3384 | | |
3357 | 3385 | | |
3358 | 3386 | | |
3359 | | - | |
| 3387 | + | |
3360 | 3388 | | |
3361 | 3389 | | |
3362 | 3390 | | |
3363 | 3391 | | |
3364 | 3392 | | |
3365 | 3393 | | |
| 3394 | + | |
| 3395 | + | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
| 3403 | + | |
| 3404 | + | |
| 3405 | + | |
| 3406 | + | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
3366 | 3413 | | |
3367 | 3414 | | |
3368 | 3415 | | |
| |||
5959 | 6006 | | |
5960 | 6007 | | |
5961 | 6008 | | |
| 6009 | + | |
| 6010 | + | |
5962 | 6011 | | |
5963 | 6012 | | |
5964 | | - | |
5965 | | - | |
| 6013 | + | |
5966 | 6014 | | |
5967 | | - | |
5968 | 6015 | | |
5969 | 6016 | | |
5970 | 6017 | | |
| |||
5996 | 6043 | | |
5997 | 6044 | | |
5998 | 6045 | | |
| 6046 | + | |
5999 | 6047 | | |
6000 | 6048 | | |
6001 | 6049 | | |
6002 | | - | |
6003 | | - | |
| 6050 | + | |
6004 | 6051 | | |
6005 | | - | |
6006 | 6052 | | |
6007 | 6053 | | |
6008 | 6054 | | |
| |||
6014 | 6060 | | |
6015 | 6061 | | |
6016 | 6062 | | |
| 6063 | + | |
6017 | 6064 | | |
6018 | | - | |
6019 | | - | |
| 6065 | + | |
6020 | 6066 | | |
6021 | | - | |
6022 | 6067 | | |
6023 | 6068 | | |
6024 | 6069 | | |
| |||
0 commit comments