[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c8d945a3-4b12-4c04-9c68-4c5ad6173af5@davidwei.uk>
Date: Mon, 3 Nov 2025 09:47:28 -0800
From: David Wei <dw@...idwei.uk>
To: Pavel Begunkov <asml.silence@...il.com>, io-uring@...r.kernel.org,
netdev@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>
Subject: Re: [PATCH v3 2/2] net: io_uring/zcrx: call
netdev_queue_get_dma_dev() under instance lock
On 2025-11-03 05:51, Pavel Begunkov wrote:
> On 11/1/25 02:24, David Wei wrote:
>> netdev ops must be called under instance lock or rtnl_lock, but
>> io_register_zcrx_ifq() isn't doing this for netdev_queue_get_dma_dev().
>> Fix this by taking the instance lock using netdev_get_by_index_lock().
>>
>> Extended the instance lock section to include attaching a memory
>> provider. Could not move io_zcrx_create_area() outside, since the dmabuf
>> codepath IORING_ZCRX_AREA_DMABUF requires ifq->dev.
>
> It's probably fine for now, but this nested waiting feels
> uncomfortable considering that it could be waiting for other
> devices to finish IO via dmabuf fences.
>
Only the dmabuf path requires ifq->dev in io_zcrx_create_area(); I could
split this into two and then unlock netdev instance lock between holding
a ref and calling net_mp_open_rxq().
So the new ordering would be:
1. io_zcrx_create_area() for !IORING_ZCRX_AREA_DMABUF
2. netdev_get_by_index_lock(), hold netdev ref, unlock netdev
3. io_zcrx_create_area() for IORING_ZCRX_AREA_DMABUF
4. net_mp_open_rxq()
Jakub, do you see any problems in relocking?
Powered by blists - more mailing lists