Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xsk: do not enable/disable irq when grabbing/releasing xsk_tx_list_lock

The commit ac98d8aab61b ("xsk: wire upp Tx zero-copy functions")
originally introducing this lock put the deletion process in the
sk_destruct which can run in irq context obviously, so the
xxx_irqsave()/xxx_irqrestore() pair was used. But later another
commit 541d7fdd7694 ("xsk: proper AF_XDP socket teardown ordering")
moved the deletion into xsk_release() that only happens in process
context. It means that since this commit, it doesn't necessarily
need that pair.

Now, there are two places that use this xsk_tx_list_lock and only
run in the process context. So avoid manipulating the irq then.

Signed-off-by: Jason Xing <kernelxing@tencent.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://patch.msgid.link/20251030000646.18859-2-kerneljasonxing@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Jason Xing and committed by
Paolo Abeni
46228004 27cb3de7

+4 -8
+4 -8
net/xdp/xsk_buff_pool.c
··· 12 12 13 13 void xp_add_xsk(struct xsk_buff_pool *pool, struct xdp_sock *xs) 14 14 { 15 - unsigned long flags; 16 - 17 15 if (!xs->tx) 18 16 return; 19 17 20 - spin_lock_irqsave(&pool->xsk_tx_list_lock, flags); 18 + spin_lock(&pool->xsk_tx_list_lock); 21 19 list_add_rcu(&xs->tx_list, &pool->xsk_tx_list); 22 - spin_unlock_irqrestore(&pool->xsk_tx_list_lock, flags); 20 + spin_unlock(&pool->xsk_tx_list_lock); 23 21 } 24 22 25 23 void xp_del_xsk(struct xsk_buff_pool *pool, struct xdp_sock *xs) 26 24 { 27 - unsigned long flags; 28 - 29 25 if (!xs->tx) 30 26 return; 31 27 32 - spin_lock_irqsave(&pool->xsk_tx_list_lock, flags); 28 + spin_lock(&pool->xsk_tx_list_lock); 33 29 list_del_rcu(&xs->tx_list); 34 - spin_unlock_irqrestore(&pool->xsk_tx_list_lock, flags); 30 + spin_unlock(&pool->xsk_tx_list_lock); 35 31 } 36 32 37 33 void xp_destroy(struct xsk_buff_pool *pool)