linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media <linux-media@vger.kernel.org>,
	Federico Vaga <federico.vaga@gmail.com>,
	Pawel Osciak <p.osciak@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [RFC PATCH] Adding additional flags when allocating buffer memory
Date: Tue, 05 Mar 2013 11:43:24 +0100	[thread overview]
Message-ID: <5135CC4C.1030905@samsung.com> (raw)
In-Reply-To: <201303051059.50277.hverkuil@xs4all.nl>

Hello,

On 3/5/2013 10:59 AM, Hans Verkuil wrote:
> On Tue 5 March 2013 10:28:38 Marek Szyprowski wrote:
> > Hello,
> >
> > On 3/1/2013 7:44 PM, Hans Verkuil wrote:
> > > Hi all,
> > >
> > > This patch is based on an idea from Federico:
> > >
> > > http://www.mail-archive.com/davinci-linux-open-source@linux.davincidsp.com/msg24669.html
> > >
> > > While working on converting the solo6x10 driver to vb2 I realized that the
> > > same thing was needed for the dma-sg case: the solo6x10 has 32-bit PCI DMA,
> > > so you want to specify __GFP_DMA32 to prevent bounce buffers from being created.
> > >
> > > Rather than patching all drivers as the patch above does (error prone IMHO),
> > > I've decided to just add a gfp_flags field to vb2_queue and pass that to the
> > > alloc mem_op. The various alloc implementations will just OR it in.
> >
> > I agree that the gfp_flags is needed. It should be there from the
> > beginning,
> > but there is not DMA zone on our hardware and we missed that point. Our
> > fault.
> > However IMHO the better place for gfp_flags is the allocator context
> > structure
> > instead of vb2_queue. vb2_dma_contig_init_ctx() would need to be
> > extended and
> > similar function should be added for dma sg.
>
> Why is this better? It seems a huge amount of work for something that is
> useful for pretty much any allocator. Note that most PCI drivers are 32-bit
> only and need __GFP_DMA32. So this is not a rare case, it just that we
> haven't converted them yet.
>
> I don't mind doing the work, but I'd like to know the reasoning behind it.

I would like to keep the logical separation between queue and buffer 
allocators.
Putting gfp flags to vb2_queue suggests that those flags will be used for
allocating queue internal structures, what is something different from 
allocating
buffer itself.

DMA SG allocator also needs to have the context structure (which should 
contain
device pointer and gfp flags) as well as the redesign in the mapping 
approach
(the buffers should be mapped by the allocator not the driver) and the
'descriptor' structure (sgtable should be used instead of the custom 
thing).
This requires significant amount of work, so I don't expect You to do it 
atm.

For the target solution I would like to have gfp flags in the context 
structure,
but for fixing v3.9-rc / v3.8 the patch you have proposed can be used. I 
will
just rebase my work-in-progress patches on top of that one day.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center



      parent reply	other threads:[~2013-03-05 10:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 18:44 [RFC PATCH] Adding additional flags when allocating buffer memory Hans Verkuil
2013-03-05  9:28 ` Marek Szyprowski
2013-03-05  9:59   ` Hans Verkuil
2013-03-05 10:34     ` Federico Vaga
2013-03-05 10:43     ` Marek Szyprowski [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=5135CC4C.1030905@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=federico.vaga@gmail.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=p.osciak@gmail.com \
    /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).