From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Jason Xing <kerneljasonxing@gmail.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <bjorn@kernel.org>,
<magnus.karlsson@intel.com>, <jonathan.lemon@gmail.com>,
<sdf@fomichev.me>, <ast@kernel.org>, <daniel@iogearbox.net>,
<hawk@kernel.org>, <john.fastabend@gmail.com>, <horms@kernel.org>,
<andrew+netdev@lunn.ch>, <bpf@vger.kernel.org>,
<netdev@vger.kernel.org>, Jason Xing <kernelxing@tencent.com>
Subject: Re: [PATCH net-next v2 1/2] xsk: do not enable/disable irq when grabbing/releasing xsk_tx_list_lock
Date: Mon, 3 Nov 2025 15:42:45 +0100 [thread overview]
Message-ID: <aQi/ZbAoVwBX9VCi@boxer> (raw)
In-Reply-To: <20251030000646.18859-2-kerneljasonxing@gmail.com>
On Thu, Oct 30, 2025 at 08:06:45AM +0800, Jason Xing wrote:
> From: Jason Xing <kernelxing@tencent.com>
>
> 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>
> ---
> net/xdp/xsk_buff_pool.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
> index aa9788f20d0d..309075050b2a 100644
> --- a/net/xdp/xsk_buff_pool.c
> +++ b/net/xdp/xsk_buff_pool.c
> @@ -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)
> --
> 2.41.3
>
next prev parent reply other threads:[~2025-11-03 14:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 0:06 [PATCH net-next v2 0/2] xsk: minor optimizations around locks Jason Xing
2025-10-30 0:06 ` [PATCH net-next v2 1/2] xsk: do not enable/disable irq when grabbing/releasing xsk_tx_list_lock Jason Xing
2025-11-03 14:42 ` Maciej Fijalkowski [this message]
2025-10-30 0:06 ` [PATCH net-next v2 2/2] xsk: use a smaller new lock for shared pool case Jason Xing
2025-11-03 14:58 ` Maciej Fijalkowski
2025-11-03 23:26 ` Jason Xing
2025-11-04 15:20 ` [PATCH net-next v2 0/2] xsk: minor optimizations around locks patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aQi/ZbAoVwBX9VCi@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jonathan.lemon@gmail.com \
--cc=kerneljasonxing@gmail.com \
--cc=kernelxing@tencent.com \
--cc=kuba@kernel.org \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).