linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Figa <tfiga@chromium.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	"Matwey V. Kornilov" <matwey@sai.msu.ru>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Matwey V. Kornilov" <matwey.kornilov@gmail.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Ezequiel Garcia <ezequiel@collabora.com>,
	hdegoede@redhat.com, Hans Verkuil <hverkuil@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	rostedt@goodmis.org, mingo@redhat.com,
	Mike Isely <isely@pobox.com>, Bhumika Goyal <bhumirks@gmail.com>,
	Colin King <colin.king@canonical.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	keiichiw@chromium.org
Subject: Re: [PATCH v5 2/2] media: usb: pwc: Don't use coherent DMA buffers for ISO transfer
Date: Thu, 13 Dec 2018 12:13:29 +0900	[thread overview]
Message-ID: <CAAFQd5C4RbMxRP+ox+BDuApMusTD=WUD9Vs6aWL3u=HovuWUig@mail.gmail.com> (raw)
In-Reply-To: <20181212135440.GA6137@infradead.org>

On Wed, Dec 12, 2018 at 10:54 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Wed, Dec 12, 2018 at 06:34:25PM +0900, Tomasz Figa wrote:
> > The typical DMA-buf import/export flow is as follows:
> > 1) Driver X allocates buffer A using this API for device x and gets a
> > DMA address inside x's DMA (or IOVA) address space.
> > 2) Driver X creates a dma_buf D(A), backed by buffer A and gives the
> > user space process a file descriptor FD(A) referring to it.
> > 3) Driver Y gets FD(A) from the user space and needs to map it into
> > the DMA/IOVA address space of device y. It doe it by calling
> > dma_buf_map_attachment() which returns an sg_table describing the
> > mapping.
>
> And just as I said last time I think we need to fix the dmabuf code
> to not rely on struct scatterlist.  struct scatterlist is an interface
> that is fundamentally page based, while the dma coherent allocator
> only gives your a kernel virtual and dma address (and the option to
> map the buffer into userspace).  So we need to fix to get the interface
> right as we already have DMAable memory withour a struct page and we
> are bound to get more of those.  Nevermind all the caching implications
> even if we have a struct page.

Putting aside the problem of memory without struct page, one thing to
note here that what is a contiguous DMA range for device X, may not be
mappable contiguously for device Y and it would still need something
like a scatter list to fully describe the buffer.

Do we already have a structure that would work for this purposes? I'd
assume that we need something like the existing scatterlist but with
page links replaced with something that doesn't require the memory to
have struct page, possibly just PFN?

>
> It would also be great to use that opportunity to get rid of all the
> code duplication of almost the same dmabug provides backed by the
> DMA API.

Could you sched some more light on this? I'm curious what is the code
duplication you're referring to.

Best regards,
Tomasz

  reply	other threads:[~2018-12-13  3:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21 17:06 [PATCH v5 0/2] media: usb: pwc: Don't use coherent DMA buffers for ISO transfer Matwey V. Kornilov
2018-08-21 17:06 ` [PATCH v5 1/2] media: usb: pwc: Introduce TRACE_EVENTs for pwc_isoc_handler() Matwey V. Kornilov
2018-08-21 19:49   ` Steven Rostedt
2018-08-21 17:06 ` [PATCH v5 2/2] media: usb: pwc: Don't use coherent DMA buffers for ISO transfer Matwey V. Kornilov
2018-08-28  7:17   ` Matwey V. Kornilov
2018-09-11 18:58     ` Matwey V. Kornilov
2018-09-19 16:12       ` Ezequiel Garcia
2018-10-10 21:13       ` Matwey V. Kornilov
2018-10-30 22:00   ` Laurent Pinchart
2018-10-31  5:38     ` Christoph Hellwig
2018-12-07 15:25     ` Christoph Hellwig
2018-12-12  8:57       ` Tomasz Figa
2018-12-12  9:09         ` Christoph Hellwig
2018-12-12  9:34           ` Tomasz Figa
2018-12-12 13:54             ` Christoph Hellwig
2018-12-13  3:13               ` Tomasz Figa [this message]
2018-12-13 14:03                 ` Christoph Hellwig
2018-12-14  3:12                   ` Tomasz Figa
2018-12-14 12:36                     ` Christoph Hellwig
2018-12-18  7:22                       ` Tomasz Figa
2018-12-18  7:38                         ` Christoph Hellwig
2018-12-18  9:48                           ` Tomasz Figa
2018-12-19  7:51                             ` Christoph Hellwig
2018-12-19  8:18                               ` Tomasz Figa
2018-12-19 14:51                                 ` Christoph Hellwig
2018-12-20  3:23                                   ` Tomasz Figa
2018-12-21  8:13                                     ` Christoph Hellwig

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='CAAFQd5C4RbMxRP+ox+BDuApMusTD=WUD9Vs6aWL3u=HovuWUig@mail.gmail.com' \
    --to=tfiga@chromium.org \
    --cc=bhumirks@gmail.com \
    --cc=colin.king@canonical.com \
    --cc=ezequiel@collabora.com \
    --cc=hch@infradead.org \
    --cc=hdegoede@redhat.com \
    --cc=hverkuil@xs4all.nl \
    --cc=isely@pobox.com \
    --cc=keiichiw@chromium.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=matwey.kornilov@gmail.com \
    --cc=matwey@sai.msu.ru \
    --cc=mchehab@kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=stern@rowland.harvard.edu \
    /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).