[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <153755119449.119890.13616278963313850730@swboyd.mtv.corp.google.com>
Date: Fri, 21 Sep 2018 10:33:14 -0700
From: Stephen Boyd <swboyd@...omium.org>
To: Christoph Hellwig <hch@....de>
Cc: Christoph Hellwig <hch@....de>, linux-kernel@...r.kernel.org,
iommu@...ts.linux-foundation.org,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>
Subject: Re: [PATCH] dma-debug: Check for drivers mapping vmalloc addresses
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?
Powered by blists - more mailing lists