Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Pavel Begunkov
Wed, 04 Nov 2026 00:11
[PATCH io_uring] io_uring/zcrx: don't sync for cpu dma-bufs
Author: Pavel Begunkov
Date: Wed, 04 Nov 2026 00:11
Date: Wed, 04 Nov 2026 00:11
27 lines
11353 bytes
11353 bytes
dma-bufs follow different from normal memory rules, we don't need to
sync it for the user. If the user space wants to directly access it, it
should use proper primitives like DMA_BUF_IOCTL_SYNC.
Fixes: a5c98e9424573 ("io_uring/zcrx: dmabuf backed zerocopy receive")
Cc: stable@vger.kernel.org
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/zcrx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index 6d7abb1636e7..17e554bb774f 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -1425,6 +1425,8 @@ static int io_pp_zc_init(struct page_pool *pp)
if (pp->p.dma_dir != DMA_FROM_DEVICE)
return -EOPNOTSUPP;
+ if (!ifq->kern_readable)
+ pp->dma_sync_for_cpu = false;
refcount_inc(&ifq->refs);
return 0;
}
--
2.54.0
Re: [PATCH io_uring] io_uring/zcrx: don't sync for cpu dma-bufs
Author: Jens Axboe
Date: Wed, 04 Nov 2026 16:14
Date: Wed, 04 Nov 2026 16:14
29 lines
11880 bytes
11880 bytes
On 11/3/26 5:11 PM, Pavel Begunkov wrote:
> dma-bufs follow different from normal memory rules, we don't need to
> sync it for the user. If the user space wants to directly access it, it
> should use proper primitives like DMA_BUF_IOCTL_SYNC.
>
> Fixes: a5c98e9424573 ("io_uring/zcrx: dmabuf backed zerocopy receive")
> Cc: stable@vger.kernel.org
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> ---
> io_uring/zcrx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
> index 6d7abb1636e7..17e554bb774f 100644
> --- a/io_uring/zcrx.c
> +++ b/io_uring/zcrx.c
> @@ -1425,6 +1425,8 @@ static int io_pp_zc_init(struct page_pool *pp)
> if (pp->p.dma_dir != DMA_FROM_DEVICE)
> return -EOPNOTSUPP;
>
> + if (!ifq->kern_readable)
> + pp->dma_sync_for_cpu = false;
Should this clear ->dma_sync as well for this? That'd bring it
closer to what devmem does.
--
Jens Axboe
Re: [PATCH io_uring] io_uring/zcrx: don't sync for cpu dma-bufs
Author: Pavel Begunkov
Date: Thu, 26 Nov 2026 13:31
Date: Thu, 26 Nov 2026 13:31
33 lines
11828 bytes
11828 bytes
On 11/4/26 16:14, Jens Axboe wrote:
> On 11/3/26 5:11 PM, Pavel Begunkov wrote:
>> dma-bufs follow different from normal memory rules, we don't need to
>> sync it for the user. If the user space wants to directly access it, it
>> should use proper primitives like DMA_BUF_IOCTL_SYNC.
>>
>> Fixes: a5c98e9424573 ("io_uring/zcrx: dmabuf backed zerocopy receive")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
>> ---
>> io_uring/zcrx.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
>> index 6d7abb1636e7..17e554bb774f 100644
>> --- a/io_uring/zcrx.c
>> +++ b/io_uring/zcrx.c
>> @@ -1425,6 +1425,8 @@ static int io_pp_zc_init(struct page_pool *pp)
>> if (pp->p.dma_dir != DMA_FROM_DEVICE)
>> return -EOPNOTSUPP;
>>
>> + if (!ifq->kern_readable)
>> + pp->dma_sync_for_cpu = false;
>
> Should this clear ->dma_sync as well for this? That'd bring it
> closer to what devmem does.
It can as well be that, but IIRC it needs some extra apart from
just setting the flag. I'll resend.
--
Pavel Begunkov
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads