diff options
author | Jakub Kicinski <kuba@kernel.org> | 2025-08-08 17:12:05 -0700 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2025-08-12 14:43:05 +0200 |
commit | b3fc08ab9a565efb42fe08be046a0d203b82cdb8 (patch) | |
tree | dc9a380c7e7a58f7e8e720d91efe752f933f6afa /scripts/lib/kdoc/kdoc_files.py | |
parent | ccba9f6baa900e31ad1a4c36e6f3c176694f9eac (diff) |
net: prevent deadlocks when enabling NAPIs with mixed kthread config
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>
Reviewed-by: Joe Damato <joe@dama.to>
Link: https://patch.msgid.link/20250809001205.1147153-4-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'scripts/lib/kdoc/kdoc_files.py')
0 files changed, 0 insertions, 0 deletions