io_uring/zcrx: don't sync dma-bufs
Subsystems (4)
Pavel Begunkov
maintainerPATCH v2 1/1 io_uring/zcrx: don't sync dma-bufs
dma-bufs follow different synchronisation rules comparing to normal memory, the user accessing it must use proper API like DMA_BUF_IOCTL_SYNC. Don't sync dma-buf backed buffers with the dma_sync_*() family of helpers.
Fixes a5c98e9424573 ("io_uring/zcrx: dmabuf backed zerocopy receive")
Signed-off-by Pavel Begunkov <[email protected]>
--- io_uring/zcrx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
io_uring/zcrx.c +5 -1
@@ -354,7 +354,7 @@ static void zcrx_sync_for_device(struct page_pool *pp, struct io_zcrx_ifq *zcrx,unsigned i, niov_size;dma_addr_t dma_addr; -if (!dma_dev_need_sync (dev)) +if (!zcrx->kern_readable || !dma_dev_need_sync (dev))return ; niov_size =1U << zcrx->niov_shift;
@@ -1425,6 +1425,10 @@ 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; + pp->dma_sync = false; + }refcount_inc (&ifq->refs);return 0 ; }
Signature · 1 line
2.56.1