From: Stephen Boyd <swboyd@chromium.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Christoph Hellwig <hch@lst.de>,
linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>
Subject: Re: [PATCH] dma-debug: Check for drivers mapping vmalloc addresses
Date: Fri, 21 Sep 2018 10:33:14 -0700 [thread overview]
Message-ID: <153755119449.119890.13616278963313850730@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <20180921052537.GB12825@lst.de>
Quoting Christoph Hellwig (2018-09-20 22:25:37)
> On Thu, Sep 20, 2018 at 03:35:59PM -0700, Stephen Boyd wrote:
> > I recently debugged a DMA mapping oops where a driver was trying to map
> > a buffer returned from request_firmware() with dma_map_single(). Memory
> > returned from request_firmware() is mapped into the vmalloc region and
> > this isn't a valid region to map with dma_map_single() per the DMA
> > documentation's "What memory is DMA'able?" section.
> >
> > Unfortunately, we don't really check that in the DMA debugging code, so
> > enabling DMA debugging doesn't help catch this problem. Let's add a new
> > DMA debug function to check for a vmalloc address and print a warning if
> > this happens. This makes it a little easier to debug these sorts of
> > problems, instead of seeing odd behavior or crashes when drivers attempt
> > to map the vmalloc space for DMA.
>
> This looks sensible to me. I wonder if we shouldn't just throw in
> an unconditional
>
> WARN_ON_ONCE(is_vmalloc_addr(ptr)));
>
> into dma_map_single_attrs, though.
Yes that works just as well if we're willing to take the overhead of the
check all the time. This isn't a hotpath?
next prev parent reply other threads:[~2018-09-21 17:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 22:35 Stephen Boyd
2018-09-21 5:25 ` Christoph Hellwig
2018-09-21 17:33 ` Stephen Boyd [this message]
2018-09-21 11:09 ` Robin Murphy
2018-09-21 17:39 ` Stephen Boyd
2018-09-26 13:24 ` Robin Murphy
2018-09-28 16:19 ` Stephen Boyd
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=153755119449.119890.13616278963313850730@swboyd.mtv.corp.google.com \
--to=swboyd@chromium.org \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.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
all inboxes | Powered by JetHome®