diff options
| author | James Hilliard <james.hilliard1@gmail.com> | 2026-10-14 12:33:48 -0600 |
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2026-10-20 12:38:34 +0200 |
| commit | fece8420e76fe53ee84f0439f18d026b4c7641da (patch) | |
| tree | fe14f7564e9be7484249211a0eb0332ba008ac98 /include/linux | |
| parent | 42a91cbfc7a3ab99d05cb2ed0de5a24b9652cfed (diff) | |
| download | linux-fece8420e76fe53ee84f0439f18d026b4c7641da.tar.gz linux-fece8420e76fe53ee84f0439f18d026b4c7641da.zip | |
xsk: freeze deferred pool teardown without blocking unregister
Deferred pool destruction calls ndo_bpf() under RTNL. system_wq is
not frozen during system sleep, so that callback can run after a
device has suspended and gated its clocks. Use system_freezable_wq
so running destruction finishes before device suspend and new work
waits until process thaw.
Keep assigned pools visible to NETDEV_UNREGISTER independently of
the socket list. A released socket has already left that list, but
its final pool put can queue destruction after workqueues freeze.
A resume-time unregister would then wait for a device reference
whose release cannot run until the resume completes.
Track assigned pools per netdev with netdev operations locking and detach
remaining pools after the notifier socket walk, including copy-mode pools.
This also covers leased queues without scanning pools from unrelated
devices or network namespaces. Remove the entry on assignment failure and
normal teardown. The deferred worker still owns the pool and later observes
the cleared device pointer, avoiding a second driver detach or put.
The lifetime problem was identified by code inspection of the deferred
release and system-sleep paths.
Fixes: 1c1efc2af158 ("xsk: Create and free buffer pool independently from umem")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20261014-xsk-suspend-teardown-v4-1-27795582e4a3@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/netdevice.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3cff2174dc03..ac257221c7c5 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2545,6 +2545,11 @@ struct net_device { /* protected by rtnl_lock */ struct bpf_xdp_entity xdp_state[__MAX_XDP_MODE]; +#ifdef CONFIG_XDP_SOCKETS + /** @xsk_pools: assigned AF_XDP pools, ops protected */ + struct hlist_head xsk_pools; +#endif + u8 dev_addr_shadow[MAX_ADDR_LEN]; netdevice_tracker linkwatch_dev_tracker; netdevice_tracker watchdog_dev_tracker; |
