On Fri, Aug 08, 2025 at 05:12:05PM -0700, Jakub Kicinski wrote:
The following order of calls currently deadlocks if:
- device has threaded=1; and
- NAPI has persistent config with threaded=0.
netif_napi_add_weight_config() dev->threaded == 1 napi_kthread_create()
napi_enable() napi_restore_config() napi_set_threaded(0) napi_stop_kthread() while (NAPIF_STATE_SCHED) msleep(20)
We deadlock because disabled NAPI has STATE_SCHED set. Creating a thread in netif_napi_add() just to destroy it in napi_disable() is fairly ugly in the first place. Let's read both the device config and the NAPI config in netif_napi_add().
Fixes: e6d76268813d ("net: Update threaded state in napi config in netif_set_threaded") Signed-off-by: Jakub Kicinski kuba@kernel.org
net/core/dev.h | 8 ++++++++ net/core/dev.c | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-)
Reviewed-by: Joe Damato joe@dama.to