[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250602155856eucms1p3af8567bd024a17e200ef28a6b492fff2@eucms1p3>
Date: Mon, 02 Jun 2025 17:58:56 +0200
From: Eryk Kubanski <e.kubanski@...tner.samsung.com>
To: Stanislav Fomichev <stfomichev@...il.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"bjorn@...nel.org" <bjorn@...nel.org>, "magnus.karlsson@...el.com"
<magnus.karlsson@...el.com>, "maciej.fijalkowski@...el.com"
<maciej.fijalkowski@...el.com>, "jonathan.lemon@...il.com"
<jonathan.lemon@...il.com>
Subject: RE: Re: Re: [PATCH bpf v2] xsk: Fix out of order segment free in
__xsk_generic_xmit()
> XSK represents a single queue and each queue is single producer single
> consumer. The fact that you can dup a socket and call sendmsg from
> different threads/processes does not lift that restriction. I think
> if you add synchronization on the userspace (lock(); sendmsg();
> unlock();), that should help, right?
It's not dup() of fd, It's perfectly legal AF_XDP setup.
You can share single device queue between multiple AF_XDP sockets.
Then RX and TX queue are per socket, while FILL / COMP are per
queue id of device. Access to FILL and COMP must be synchronized
on both user-space and kernel-space side.
https://docs.kernel.org/networking/af_xdp.html
> XDP_SHARED_UMEM bind flag
> This flag enables you to bind multiple sockets to the same UMEM.
> It works on the same queue id, between queue ids and between netdevs/devices.
> In this mode, each socket has their own RX and TX rings as usual, but you are going
> to have one or more FILL and COMPLETION ring pairs. You have to create one of these
> pairs per unique netdev and queue id tuple that you bind to.
Im not using sendmsg on dupped socket descriptor. It's just
another socket bound to the same netdev, queue id pair.
Even if that was the case, calling sendmsg on multiple
threads should be perfectly legal in this situation.
But i don't do that, each socket is handled exclusively
by single thread.
This is simply one of available AF_XDP deployments.
It should just work.
I don't need to introduce any locking scheme on my own
except FILL/COMP queue locking, which I did.
Definetly holding single netdevice-wide lock for any
RX/TX operation isn't an option. It should just work.
This problem is definetly in kernel. Provided explanation
clearly proves It. It's caught red handed. Please analyze
the code and see it for yourself.
Powered by blists - more mailing lists