Netdev List
 help / color / mirror / Atom feed
* [PATCH io_uring] io_uring/zcrx: don't sync for cpu dma-bufs
@ 2026-11-04  0:11 Pavel Begunkov
  2026-11-04 16:14 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Begunkov @ 2026-11-04  0:11 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence, netdev

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH io_uring] io_uring/zcrx: don't sync for cpu dma-bufs
  2026-11-04  0:11 [PATCH io_uring] io_uring/zcrx: don't sync for cpu dma-bufs Pavel Begunkov
@ 2026-11-04 16:14 ` Jens Axboe
  2026-11-26 13:31   ` Pavel Begunkov
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2026-11-04 16:14 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring; +Cc: netdev

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH io_uring] io_uring/zcrx: don't sync for cpu dma-bufs
  2026-11-04 16:14 ` Jens Axboe
@ 2026-11-26 13:31   ` Pavel Begunkov
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Begunkov @ 2026-11-26 13:31 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: netdev

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-26 13:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  0:11 [PATCH io_uring] io_uring/zcrx: don't sync for cpu dma-bufs Pavel Begunkov
2026-11-04 16:14 ` Jens Axboe
2026-11-26 13:31   ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox