Commit 46228004 authored by Jason Xing's avatar Jason Xing Committed by Paolo Abeni
Browse files

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



The commit ac98d8aa ("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 541d7fdd ("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: default avatarJason Xing <kernelxing@tencent.com>
Acked-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://patch.msgid.link/20251030000646.18859-2-kerneljasonxing@gmail.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 27cb3de7
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -12,26 +12,22 @@

void xp_add_xsk(struct xsk_buff_pool *pool, struct xdp_sock *xs)
{
	unsigned long flags;

	if (!xs->tx)
		return;

	spin_lock_irqsave(&pool->xsk_tx_list_lock, flags);
	spin_lock(&pool->xsk_tx_list_lock);
	list_add_rcu(&xs->tx_list, &pool->xsk_tx_list);
	spin_unlock_irqrestore(&pool->xsk_tx_list_lock, flags);
	spin_unlock(&pool->xsk_tx_list_lock);
}

void xp_del_xsk(struct xsk_buff_pool *pool, struct xdp_sock *xs)
{
	unsigned long flags;

	if (!xs->tx)
		return;

	spin_lock_irqsave(&pool->xsk_tx_list_lock, flags);
	spin_lock(&pool->xsk_tx_list_lock);
	list_del_rcu(&xs->tx_list);
	spin_unlock_irqrestore(&pool->xsk_tx_list_lock, flags);
	spin_unlock(&pool->xsk_tx_list_lock);
}

void xp_destroy(struct xsk_buff_pool *pool)