From: Shuah Khan <shuah.khan@hp.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: joerg.roedel@amd.com, paul.gortmaker@windriver.com,
kubakici@wp.pl, stern@rowland.harvard.edu,
dan.carpenter@oracle.com, rob@landley.net,
linux-doc@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
shuahkhan@gmail.com
Subject: Re: [PATCH] dma-debug: Add dma map/unmap error tracking support
Date: Wed, 05 Sep 2012 08:34:56 -0600 [thread overview]
Message-ID: <1346855696.2589.7.camel@lorien2> (raw)
In-Reply-To: <20120905115722.GC5400@localhost.localdomain>
On Wed, 2012-09-05 at 07:57 -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, Sep 04, 2012 at 04:57:56PM -0600, Shuah Khan wrote:
> > On Tue, 2012-09-04 at 17:05 -0400, Konrad Rzeszutek Wilk wrote:
> > > On Sun, Sep 02, 2012 at 08:14:17AM -0600, Shuah Khan wrote:
> > > > A recent dma mapping error analysis effort showed that a large precentage
> > > > of dma_map_single() and dma_map_page() returns are not checked for mapping
> > > > errors. Reference: https://lkml.org/lkml/2012/8/10/326
> > > >
> > >
> > > So were you able to catch some naughty drivers with this?
> >
> > I did compile a complete list of drivers that don't check dma mapping
> > errors from my analysis. Are you interested in seeing the full analysis?
>
> Yes, plus the authors of the drivers are probably interested in it as
> well.
> ..snip..
I compiled very detailed information on the nature of problems with dma
mapping error checking, ranging from not checking mapping errors to not
unmapping etc. I would like to share this information in such a way that
others can leverage the research I already did. One good way to
communicate this information would be on one of the kernel wikis. Ideas,
suggestions?
> > > I was initially thinking that this patch would contain a state for the driver
> > > of whether after map it has called dma_mapping_error. So this function would
> > > increment some internal state, and if dma_mapping_error on that specific dma_addr
> > > it would decrement it. If it never occured, then we would print on the unmap
> > > that the device never had called dma_mapping_error on said dma_addr?
> >
> > That is a good idea. Let me see if I understand what you are saying
> > correctly. Add a new field to dma_debug_entry structure and keep state
> > and clear it if dma_mapping_error() is called. This will require adding
> > a debug interface for dma_mapping_error() which is not hard to do. Is
> > this close to what you are thinking?
>
> Right. It is more complex than this patch but it should provide a nicer
> "trap" mechanism to alert driver writers that they are not checking DMA
> addresses properly.
I will go back and work on improving this patch. I will have to think
about how to track overflow buffer triggers as well without impacting
the production kernel. That is a separate effort.
-- Shuah
next prev parent reply other threads:[~2012-09-05 14:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-02 14:14 [PATCH] dma-debug: Add dma map/unmap error tracking support Shuah Khan
2012-09-04 21:05 ` Konrad Rzeszutek Wilk
2012-09-04 22:57 ` Shuah Khan
2012-09-05 11:57 ` Konrad Rzeszutek Wilk
2012-09-05 14:34 ` Shuah Khan [this message]
2012-09-05 19:30 ` Shuah Khan
2012-09-07 15:53 ` [RFC] DMA mapping error check analysis Shuah Khan
2012-09-07 16:20 ` Alan Stern
2012-09-07 16:54 ` Shuah Khan
2012-09-10 7:53 ` Clemens Ladisch
2012-09-10 15:26 ` Shuah Khan
2012-09-10 17:17 ` Stefan Richter
2012-09-10 17:42 ` Clemens Ladisch
2012-09-10 19:28 ` Stefan Richter
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=1346855696.2589.7.camel@lorien2 \
--to=shuah.khan@hp.com \
--cc=dan.carpenter@oracle.com \
--cc=joerg.roedel@amd.com \
--cc=konrad.wilk@oracle.com \
--cc=kubakici@wp.pl \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
--cc=rob@landley.net \
--cc=shuahkhan@gmail.com \
--cc=stern@rowland.harvard.edu \
/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