mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Huan Yang <link@vivo.com>
To: "Christoph Hellwig" <hch@infradead.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
	"Brian Starkey" <Brian.Starkey@arm.com>,
	"John Stultz" <jstultz@google.com>,
	"T.J. Mercier" <tjmercier@google.com>,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org,
	opensource.kernel@vivo.com
Subject: Re: [PATCH 1/2] dma-buf: heaps: DMA_HEAP_IOCTL_ALLOC_READ_FILE framework
Date: Thu, 18 Jul 2024 09:51:39 +0800	[thread overview]
Message-ID: <7140a145-7dd5-43b0-8b2a-0fd12bb9e62d@vivo.com> (raw)
In-Reply-To: <Zpf5R7fRZZmEwVuR@infradead.org>


在 2024/7/18 1:03, Christoph Hellwig 写道:
> [Some people who received this message don't often get email from hch@infradead.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> 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.

Yes, actually, if dma-buf want's to copy_file_range from a file, it need 
change something in vfs_copy_file_range:

1. in generic_file_rw_checks, dma-buf file is not a normal file, but 
inode_out check it.  need bypass

2. file in and out need in the same file system which you point it. So, 
need bypass it

3. if dma-buf above 2G, need bypass generic_write_check_limits's file 
O_LARGEFILE check, it only allow copy range below 2G.

I feel that the above limitations indicate that copy_file_range is not 
really suitable for copying between different file systems or 
unconventional file types.(both shmemfs and other's)

Perhaps enabling dma-buf to support copy_file_range is not a good idea? :)

>
> 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
OK, I'll research it also.
> 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.
>

  reply	other threads:[~2024-07-18  1:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11  7:42 [PATCH 0/2] Introduce DMA_HEAP_IOCTL_ALLOC_AND_READ Huan Yang
2024-07-11  7:42 ` [PATCH 1/2] dma-buf: heaps: DMA_HEAP_IOCTL_ALLOC_READ_FILE framework Huan Yang
2024-07-11  9:00   ` Christian König
2024-07-11  9:18     ` Huan Yang
2024-07-11 11:39       ` Christian König
2024-07-12  1:59         ` Huan Yang
2024-07-12  2:14           ` Huan Yang
2024-07-12  7:10             ` Christian König
2024-07-12  7:29               ` Huan Yang
2024-07-12  7:41                 ` Christian König
2024-07-12  7:52                   ` Huan Yang
2024-07-12 10:59                     ` Christian König
2024-07-12 11:12                       ` Huan Yang
2024-07-15  9:11     ` Daniel Vetter
2024-07-15 12:32       ` Christian König
2024-07-16  2:48         ` Huan Yang
2024-07-16  9:31           ` Daniel Vetter
2024-07-16 10:14             ` Huan Yang
2024-07-17 15:15               ` Daniel Vetter
2024-07-17 17:03                 ` Christoph Hellwig
2024-07-18  1:51                   ` Huan Yang [this message]
2024-07-18  3:08                     ` Christoph Hellwig
2024-07-18  3:12                       ` Huan Yang
2024-07-24  7:12                   ` Huan Yang
     [not found]             ` <d3ad46ea-df7f-4402-b48a-349e957f198b@amd.com>
2024-07-17  7:33               ` Huan Yang
2024-07-17 15:23               ` Daniel Vetter
2024-07-13 10:33   ` kernel test robot
2024-07-11  7:42 ` [PATCH 2/2] dma-buf: heaps: system_heap support DMA_HEAP_IOCTL_ALLOC_AND_READ Huan Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7140a145-7dd5-43b0-8b2a-0fd12bb9e62d@vivo.com \
    --to=link@vivo.com \
    --cc=Brian.Starkey@arm.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@infradead.org \
    --cc=jstultz@google.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=opensource.kernel@vivo.com \
    --cc=sumit.semwal@linaro.org \
    --cc=tjmercier@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®