linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	linux-kernel@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] lib: scatterlist: add sg splitting function
Date: Mon, 24 Aug 2015 14:27:46 -0600	[thread overview]
Message-ID: <55DB7E42.4070803@kernel.dk> (raw)
In-Reply-To: <20150824132630.814fe743f051d49531bb7a17@linux-foundation.org>

On 08/24/2015 02:26 PM, Andrew Morton wrote:
> On Mon, 24 Aug 2015 14:15:08 -0600 Jens Axboe <axboe@kernel.dk> wrote:
>
>> On 08/08/2015 02:44 AM, Robert Jarzmik wrote:
>>> Sometimes a scatter-gather has to be split into several chunks, or sub
>>> scatter lists. This happens for example if a scatter list will be
>>> handled by multiple DMA channels, each one filling a part of it.
>>>
>>> A concrete example comes with the media V4L2 API, where the scatter list
>>> is allocated from userspace to hold an image, regardless of the
>>> knowledge of how many DMAs will fill it :
>>>    - in a simple RGB565 case, one DMA will pump data from the camera ISP
>>>      to memory
>>>    - in the trickier YUV422 case, 3 DMAs will pump data from the camera
>>>      ISP pipes, one for pipe Y, one for pipe U and one for pipe V
>>>
>>> For these cases, it is necessary to split the original scatter list into
>>> multiple scatter lists, which is the purpose of this patch.
>>>
>>> The guarantees that are required for this patch are :
>>>    - the intersection of spans of any couple of resulting scatter lists is
>>>      empty.
>>>    - the union of spans of all resulting scatter lists is a subrange of
>>>      the span of the original scatter list.
>>>    - streaming DMA API operations (mapping, unmapping) should not happen
>>>      both on both the resulting and the original scatter list. It's either
>>>      the first or the later ones.
>>>    - the caller is reponsible to call kfree() on the resulting
>>>      scatterlists.
>>>
>>> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
>>
>> I think this looks fine. But do we really need the Kconfig option? It's
>> not a lot of code, and it seems silly to put the onus on the driver for
>> having to enable something that is a subset of the SG api.
>
> Blame me for that.  It's so that all kernels don't need to carry a lump
> of code which only a small number of media drivers actually use.

Right

> The tradeoff is a bit of once-off build-time effort versus a permanent
> runtime gain for many systems.  That's a good tradeoff.

I guess that's true, errors in this area will be found pretty quickly.

-- 
Jens Axboe


      reply	other threads:[~2015-08-24 20:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-08  8:44 [PATCH] lib: scatterlist: add sg splitting function Robert Jarzmik
2015-08-22 18:25 ` Robert Jarzmik
2015-08-24 20:15 ` Jens Axboe
2015-08-24 20:26   ` Andrew Morton
2015-08-24 20:27     ` Jens Axboe [this message]

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=55DB7E42.4070803@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=akpm@linux-foundation.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mchehab@osg.samsung.com \
    --cc=robert.jarzmik@free.fr \
    /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).