From: Christoph Hellwig <hch@lst.de>
To: Tomasz Figa <tfiga@chromium.org>
Cc: Christoph Hellwig <hch@lst.de>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Ricardo Ribalda <ribalda@chromium.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Linux Media Mailing List <linux-media@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCHv2 8/8] videobuf2: handle non-contiguous DMA allocations
Date: Fri, 18 Jun 2021 06:25:26 +0200 [thread overview]
Message-ID: <20210618042526.GA17794@lst.de> (raw)
In-Reply-To: <CAAFQd5CgLDkJ3t1aU2PRcGu6cGFjLXOnvMqDg62Z7Zuc8ABVHg@mail.gmail.com>
On Fri, Jun 18, 2021 at 12:21:33PM +0900, Tomasz Figa wrote:
> > On Thu, Jun 17, 2021 at 06:40:58PM +0900, Tomasz Figa wrote:
> > > Sorry, I meant dma_alloc_attrs() and yes, it's indeed a misnomer. Our
> > > use case basically has no need for the additional coherent mapping, so
> > > creation of it can be skipped to save some vmalloc space. (Yes, it
> > > probably only matters for 32-bit architectures.)
> >
> > Yes, that is the normal use case, and it is solved by using
> > dma_alloc_noncoherent or dma_alloc_noncontigous without the vmap
> > step.
>
> True, silly me. Probably not enough coffee at the time I was looking at it.
>
> With that, wouldn't it be possible to completely get rid of
> dma_alloc_{coherent,attrs}() and use dma_alloc_noncontiguous() +
> optional kernel and/or userspace mapping helper everywhere? (Possibly
> renaming it to something as simple as dma_alloc().
Well, dma_alloc_coherent users want a non-cached mapping. And while
some architectures provide that using a vmap with "uncached" bits in the
PTE to provide that, this:
a) is not possibly everywhere
b) even where possible is not always the best idea as it creates mappings
with differnet cachability bets
And even without that dma_alloc_noncoherent causes less overhead than
dma_alloc_noncontigious if you only need a single contiguous range.
So while I'm happy we have something useful for more complex drivers like
v4l I think the simple dma_alloc_coherent API, including some of the less
crazy flags for dma_alloc_attrs is the right thing to use for more than
90% of the use cases.
next prev parent reply other threads:[~2021-06-18 4:25 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 13:13 [PATCHv2 0/8] videobuf2: support new noncontiguous DMA API Sergey Senozhatsky
2021-04-27 13:13 ` [PATCHv2 1/8] videobuf2: rework vb2_mem_ops API Sergey Senozhatsky
2021-04-27 13:13 ` [PATCHv2 2/8] videobuf2: inverse buffer cache_hints flags Sergey Senozhatsky
2021-04-27 13:13 ` [PATCHv2 3/8] videobuf2: split buffer cache_hints initialisation Sergey Senozhatsky
2021-04-27 13:13 ` [PATCHv2 4/8] videobuf2: move cache_hints handling to allocators Sergey Senozhatsky
2021-04-27 13:13 ` [PATCHv2 5/8] videobuf2: add V4L2_MEMORY_FLAG_NON_COHERENT flag Sergey Senozhatsky
2021-04-27 13:13 ` [PATCHv2 6/8] videobuf2: add queue memory coherency parameter Sergey Senozhatsky
2021-04-27 13:13 ` [PATCHv2 7/8] videobuf2: handle V4L2_MEMORY_FLAG_NON_COHERENT flag Sergey Senozhatsky
2021-05-01 3:48 ` Sergey Senozhatsky
2021-06-03 11:32 ` Hans Verkuil
2021-06-17 1:46 ` Sergey Senozhatsky
2021-04-27 13:13 ` [PATCHv2 8/8] videobuf2: handle non-contiguous DMA allocations Sergey Senozhatsky
2021-04-28 6:14 ` Christoph Hellwig
2021-06-03 11:59 ` Hans Verkuil
2021-06-17 7:56 ` Sergey Senozhatsky
2021-06-17 8:01 ` Christoph Hellwig
2021-06-17 8:30 ` Tomasz Figa
2021-06-17 8:52 ` Christoph Hellwig
2021-06-17 9:40 ` Tomasz Figa
2021-06-17 10:06 ` Christoph Hellwig
2021-06-18 3:21 ` Tomasz Figa
2021-06-18 4:25 ` Christoph Hellwig [this message]
2021-06-18 4:44 ` Tomasz Figa
2021-06-22 7:33 ` Christoph Hellwig
2021-07-07 12:42 ` Tomasz Figa
2021-06-25 3:10 ` Sergey Senozhatsky
2021-07-07 12:48 ` Tomasz Figa
2021-07-07 13:29 ` Sergey Senozhatsky
2021-07-07 14:10 ` Tomasz Figa
2021-07-09 7:20 ` Sergey Senozhatsky
2021-06-17 7:56 ` Sergey Senozhatsky
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=20210618042526.GA17794@lst.de \
--to=hch@lst.de \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.org \
--cc=senozhatsky@chromium.org \
--cc=tfiga@chromium.org \
/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;
as well as URLs for NNTP newsgroup(s).