Re: [PATCH v1 07/15] io_uring: Allocate zctap device buffers and dma map them.

Jonathan Lemon
2022-11-17T20:51:53Z

On 16 Nov 2022, at 0:15, Christoph Hellwig wrote:

>> + dma_unmap_page_attrs(device, buf->dma, PAGE_SIZE,
>> + DMA_BIDIRECTIONAL,
>> + DMA_ATTR_SKIP_CPU_SYNC);
>
>> + addr = dma_map_page_attrs(device, page, 0, PAGE_SIZE,
>> + DMA_BIDIRECTIONAL,
>> + DMA_ATTR_SKIP_CPU_SYNC);
>
> You can't just magically skip cpu syncs. The flag is only valid
> for mappings of already mapped memory when following a very careful
> protocol. I can't see any indications of that beeing true here,
> but maybe I'm just missing something.

This was copied from page_pool_dma_map(). The same logic applies -
io_uring pins the memory, zctap creates a pool that is dma mapped, and
the driver performs dma_sync_single_*() when receiving the packet.
—
Jonathan