public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Nicolas Boichat <drinkcat@chromium.org>
Cc: Shik Chen <shik@chromium.org>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Tomasz Figa <tfiga@chromium.org>,
	notify@kernel.org, Keiichi Watanabe <keiichiw@chromium.org>,
	Ricky Liang <jcliang@chromium.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	lkml <linux-kernel@vger.kernel.org>,
	kieran.bingham@ideasonboard.com, Vlastimil Babka <vbabka@suse.cz>,
	Christoph Lameter <cl@linux.com>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH] media: uvcvideo: Use streaming DMA APIs to transfer buffers
Date: Mon, 30 Sep 2019 01:23:10 -0700	[thread overview]
Message-ID: <20190930082310.GA1750@infradead.org> (raw)
In-Reply-To: <CANMq1KD3Pth7LNnVqxSesx3kSFte0eR5JqEBETv45s_9_YKWHw@mail.gmail.com>

On Sat, Sep 28, 2019 at 11:33:16AM +0800, Nicolas Boichat wrote:
> > +static gfp_t uvc_alloc_gfp_flags(struct device *dev)
> > +{
> > +       u64 mask = dma_get_mask(dev);
> > +
> > +       if (dev->bus_dma_mask)
> > +               mask &= dev->bus_dma_mask;
> > +
> > +       if (mask < DMA_BIT_MASK(32) && IS_ENABLED(CONFIG_ZONE_DMA))
> > +               return GFP_DMA;
> > +
> > +       if (mask < DMA_BIT_MASK(64)) {
> > +               if (IS_ENABLED(CONFIG_ZONE_DMA32))
> > +                       return GFP_DMA32;
> 
> We're hitting issues with this on 64-bit ARM platform, where
> ZONE_DMA32 is enabled (default), the kmalloc allocation with GFP_DMA32
> fails.
> 
> There is no slab cache for GFP_DMA32, so those calls are expected to
> fail, AFAICT there are no other (working) kmalloc(..., .. | GFP_DMA32)
> users in the kernel, so I don't think we want to add a cache. If this
> helps, some discussion here why the cache wasn't added:
> https://lore.kernel.org/patchwork/patch/1009563/#1198622

And drivers really have no business looking at the dma mask.  I have
a plan for dma_alloc_pages API that could replace that cruft, but
until then please use GFP_KERNEL and let the dma subsystem bounce
buffer if needed.

  reply	other threads:[~2019-09-30  8:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02 13:12 [PATCH] media: uvcvideo: Use streaming DMA APIs to transfer buffers Shik Chen
2019-08-27  2:03 ` Tomasz Figa
2019-09-28  3:33 ` Nicolas Boichat
2019-09-30  8:23   ` Christoph Hellwig [this message]
2019-10-01  6:37     ` Christoph Hellwig
2020-02-27  6:28       ` Tomasz Figa
2020-04-21 11:21         ` Tomasz Figa
2020-04-27 12:48           ` 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=20190930082310.GA1750@infradead.org \
    --to=hch@infradead.org \
    --cc=cl@linux.com \
    --cc=drinkcat@chromium.org \
    --cc=jcliang@chromium.org \
    --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=mchehab@kernel.org \
    --cc=notify@kernel.org \
    --cc=shik@chromium.org \
    --cc=tfiga@chromium.org \
    --cc=vbabka@suse.cz \
    /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