Re: [PATCH 1/2] dma-buf: heaps: DMA_HEAP_IOCTL_ALLOC_READ_FILE framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 17, 2024 at 05:15:07PM +0200, Daniel Vetter wrote:
> I'm talking about memfd, not dma-buf here. I think copy_file_range to
> dma-buf is as architecturally unsound as allowing O_DIRECT on the dma-buf
> mmap.

copy_file_range only work inside the same file system anyway, so
it is completely irrelevant here.

What should work just fine is using sendfile (or splice if you like it
complicated) to write TO the dma buf.  That just iterates over the page
cache on the source file and calls ->write_iter from the page cache
pages.  Of course that requires that you actually implement
->write_iter, but given that dmabufs support mmaping there I can't
see why you should not be able to write to it.

Reading FROM the dma buf in that fashion should also work if you provide
a ->read_iter wire up ->splice_read to copy_splice_read so that it
doesn't require any page cache.





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux