[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e8bfe5ed-130a-4f32-a95a-01477cdd98ca@vivo.com>
Date: Wed, 10 Jul 2024 23:06:54 +0800
From: Lei Liu <liulei.rjpt@...o.com>
To: Christian König <christian.koenig@....com>,
Sumit Semwal <sumit.semwal@...aro.org>,
Benjamin Gaignard <benjamin.gaignard@...labora.com>,
Brian Starkey <Brian.Starkey@....com>, John Stultz <jstultz@...gle.com>,
"T.J. Mercier" <tjmercier@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>, Matthew Wilcox <willy@...radead.org>,
Muhammad Usama Anjum <usama.anjum@...labora.com>,
Andrei Vagin <avagin@...gle.com>, Ryan Roberts <ryan.roberts@....com>,
Kefeng Wang <wangkefeng.wang@...wei.com>, linux-media@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, Daniel Vetter <daniel@...ll.ch>,
"Vetter, Daniel" <daniel.vetter@...el.com>
Cc: opensource.kernel@...o.com
Subject: Re: [PATCH 0/2] Support direct I/O read and write for memory
allocated by dmabuf
on 2024/7/10 22:48, Christian König wrote:
> Am 10.07.24 um 16:35 schrieb Lei Liu:
>>
>> on 2024/7/10 22:14, Christian König wrote:
>>> Am 10.07.24 um 15:57 schrieb Lei Liu:
>>>> Use vm_insert_page to establish a mapping for the memory allocated
>>>> by dmabuf, thus supporting direct I/O read and write; and fix the
>>>> issue of incorrect memory statistics after mapping dmabuf memory.
>>>
>>> Well big NAK to that! Direct I/O is intentionally disabled on DMA-bufs.
>>
>> Hello! Could you explain why direct_io is disabled on DMABUF? Is
>> there any historical reason for this?
>
> It's basically one of the most fundamental design decision of DMA-Buf.
> The attachment/map/fence model DMA-buf uses is not really compatible
> with direct I/O on the underlying pages.
Thank you! Is there any related documentation on this? I would like to
understand and learn more about the fundamental reasons for the lack of
support.
>
>>>
>>> We already discussed enforcing that in the DMA-buf framework and
>>> this patch probably means that we should really do that.
>>>
>>> Regards,
>>> Christian.
>>
>> Thank you for your response. With the application of AI large model
>> edgeification, we urgently need support for direct_io on DMABUF to
>> read some very large files. Do you have any new solutions or plans
>> for this?
>
> We have seen similar projects over the years and all of those turned
> out to be complete shipwrecks.
>
> There is currently a patch set under discussion to give the network
> subsystem DMA-buf support. If you are interest in network direct I/O
> that could help.
Is there a related introduction link for this patch?
>
> Additional to that a lot of GPU drivers support userptr usages, e.g.
> to import malloced memory into the GPU driver. You can then also do
> direct I/O on that malloced memory and the kernel will enforce correct
> handling with the GPU driver through MMU notifiers.
>
> But as far as I know a general DMA-buf based solution isn't possible.
1.The reason we need to use DMABUF memory here is that we need to share
memory between the CPU and APU. Currently, only DMABUF memory is
suitable for this purpose. Additionally, we need to read very large files.
2. Are there any other solutions for this? Also, do you have any plans
to support direct_io for DMABUF memory in the future?
>
> Regards,
> Christian.
>
>>
>> Regards,
>> Lei Liu.
>>
>>>
>>>>
>>>> Lei Liu (2):
>>>> mm: dmabuf_direct_io: Support direct_io for memory allocated by
>>>> dmabuf
>>>> mm: dmabuf_direct_io: Fix memory statistics error for dmabuf
>>>> allocated
>>>> memory with direct_io support
>>>>
>>>> drivers/dma-buf/heaps/system_heap.c | 5 +++--
>>>> fs/proc/task_mmu.c | 8 +++++++-
>>>> include/linux/mm.h | 1 +
>>>> mm/memory.c | 15 ++++++++++-----
>>>> mm/rmap.c | 9 +++++----
>>>> 5 files changed, 26 insertions(+), 12 deletions(-)
>>>>
>>>
>
Powered by blists - more mailing lists