Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1212473 > unrolled thread

Re: [PATCH] lib: scatterlist: add sg splitting function

Started byJens Axboe <axboe@kernel.dk>
First post2015-08-24 22:20 +0200
Last post2015-08-24 22:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] lib: scatterlist: add sg splitting function Jens Axboe <axboe@kernel.dk> - 2015-08-24 22:20 +0200
    Re: [PATCH] lib: scatterlist: add sg splitting function Jens Axboe <axboe@kernel.dk> - 2015-08-24 22:30 +0200
    Re: [PATCH] lib: scatterlist: add sg splitting function Andrew Morton <akpm@linux-foundation.org> - 2015-08-24 22:30 +0200

#1212473 — Re: [PATCH] lib: scatterlist: add sg splitting function

FromJens Axboe <axboe@kernel.dk>
Date2015-08-24 22:20 +0200
SubjectRe: [PATCH] lib: scatterlist: add sg splitting function
Message-ID<q16nM-1t6-15@gated-at.bofh.it>
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.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1212488

FromJens Axboe <axboe@kernel.dk>
Date2015-08-24 22:30 +0200
Message-ID<q16xs-1Fh-33@gated-at.bofh.it>
In reply to#1212473
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1212490

FromAndrew Morton <akpm@linux-foundation.org>
Date2015-08-24 22:30 +0200
Message-ID<q16xs-1Fh-35@gated-at.bofh.it>
In reply to#1212473
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.

The tradeoff is a bit of once-off build-time effort versus a permanent
runtime gain for many systems.  That's a good tradeoff.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web