linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Christoph Hellwig <hch@lst.de>
Cc: Tomasz Figa <tfiga@chromium.org>,
	Robin Murphy <robin.murphy@arm.com>, Anle Pan <anle.pan@nxp.com>,
	m.szyprowski@samsung.com, mchehab@kernel.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	hui.fang@nxp.com
Subject: Re: [PATCH] media: videobuf2-dma-sg: limit the sg segment size
Date: Thu, 31 Aug 2023 12:32:38 -0300	[thread overview]
Message-ID: <ZPCylmcRD0hwluZf@ziepe.ca> (raw)
In-Reply-To: <20230831123532.GA11156@lst.de>

On Thu, Aug 31, 2023 at 02:35:32PM +0200, Christoph Hellwig wrote:
> On Wed, Aug 30, 2023 at 01:43:57PM -0300, Jason Gunthorpe wrote:
> > > > conversion function for the drivers.
> > > 
> > > Jason said at LSF/MM that he had a prototype for a mapping API that
> > > takes a phys/len array as input and dma_addr/len a output, which really
> > > is the right thing to do, especially for dmabuf.
> > 
> > Yes, still a prototype. Given the change in direction some of the
> > assumptions of the list design will need some adjusting.
> > 
> > I felt there wasn't much justification to add a list without also
> > supporting the P2P and it was not looking very good to give the DMA
> > API proper p2p support without also connecting it to lists somehow.
> > 
> > Anyhow, I had drafted a basic list datastructure and starting
> > implementation that is sort of structured in away that is similar to
> > xarray (eg with fixed chunks, generic purpose, etc)
> > 
> > https://github.com/jgunthorpe/linux/commit/58d7e0578a09d9cd2360be515208bcd74ade5958
> 
> This seems fairly complicated complicated, and the entry seems pretty large
> for a bio_vec replacement or a dma_addr_t+len tuple, which both should
> be (sizeof(phys_addr_t) + sizeof(u32) + the size of flags if needed, which
> for 64-bit would fit into the padding from 96 bytes to 128 bytes anyway.

The entry is variable sized, so it depends on what is stuffed in
it. For alot of common use cases, especially RDMA page lists, it will
be able to use an 8 byte entry. This is pretty much the most space
efficient it could be.

There are RDMA use cases where we end up holding huge numbers of pages
for a long time just so we can eventually unpin them. It is a nice
outcome if that could use 8 bytes/folio.

The primary alternative I see is a fixed 16 bytes/entry with a 64 bit
address and ~60 bit length + ~4 bits of flags. This is closer to bio,
simpler and faster, but makes the RDMA cases 2x bigger.

Which are the right trade offs, or not, I don't know yet. I wanted to
experiment with what this would look like for a bit.

With your direction I felt we could safely keep bio as it is and
cheaply make a fast DMA mapper for it. Provide something like this as
the 'kitchen sink' version for dmabuf/rdma/etc that are a little
different.

Jason

  reply	other threads:[~2023-08-31 15:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28  7:54 [PATCH] media: videobuf2-dma-sg: limit the sg segment size Anle Pan
2023-08-29 10:03 ` Tomasz Figa
2023-08-29 11:14   ` Robin Murphy
2023-08-29 15:04     ` Christoph Hellwig
2023-08-30  3:47       ` Tomasz Figa
2023-08-30 14:33         ` Christoph Hellwig
2023-08-30 16:43           ` Jason Gunthorpe
2023-08-31 12:35             ` Christoph Hellwig
2023-08-31 15:32               ` Jason Gunthorpe [this message]
2023-09-01  6:10                 ` Christoph Hellwig
2023-09-01 14:26                   ` Jason Gunthorpe
     [not found]       ` <DB9PR04MB92841D8BC1122D5A4210F78987E6A@DB9PR04MB9284.eurprd04.prod.outlook.com>
2023-08-30 13:41         ` [EXT] " Robin Murphy
2023-08-30  3:59     ` Tomasz Figa
2023-09-06  8:52     ` Hans Verkuil
2023-09-06  9:26       ` Tomasz Figa
2023-09-06  9:43         ` Hans Verkuil
2023-08-30  8:50 ` Hui Fang
2023-08-30  9:28   ` Tomasz Figa
2023-09-04  7:10     ` [EXT] " Hui Fang
2023-09-05  3:43       ` Tomasz Figa
2023-09-06  8:16         ` Hui Fang
2023-09-06  9:28           ` Tomasz Figa
2023-09-11  6:13             ` Hui Fang
2023-09-12  2:22               ` Tomasz Figa
2023-09-12  7:01                 ` Hui Fang
2023-09-12  7:10                   ` Tomasz Figa
2023-09-12  7:43                     ` Hui Fang
2023-09-12  7:51                       ` Tomasz Figa
2023-09-13  9:13                         ` Hui Fang
2023-09-13  9:44                           ` Tomasz Figa
2023-09-13 13:16                             ` Hui Fang
2023-09-18  2:28                               ` Hui Fang

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=ZPCylmcRD0hwluZf@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=anle.pan@nxp.com \
    --cc=hch@lst.de \
    --cc=hui.fang@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=robin.murphy@arm.com \
    --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).