From: David Woodhouse <dwmw2@infradead.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Joerg Roedel <joerg.roedel@amd.com>,
reinette.chatre@intel.com, benh@kernel.crashing.org,
greg@kroah.com
Subject: Re: dma-debug: add a check dma memory leaks
Date: Fri, 17 Apr 2009 22:51:05 +0100 [thread overview]
Message-ID: <1240005065.19059.19.camel@macbook.infradead.org> (raw)
In-Reply-To: <200903302101.n2UL1O1n011970@hera.kernel.org>
On Mon, 2009-03-30 at 21:01 +0000, Linux Kernel Mailing List wrote:
> Gitweb: http://git.kernel.org/linus/41531c8f5f05aba5ec645d9770557eedbf75b422
> Commit: 41531c8f5f05aba5ec645d9770557eedbf75b422
> dma-debug: add a check dma memory leaks
>
> Impact: allow architectures to monitor busses for dma mem leakage
>
> This patch adds checking code to detect if a device has pending DMA
> operations when it is about to be unbound from its device driver.
>
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> +static int dma_debug_device_change(struct notifier_block *nb,
> + unsigned long action, void *data)
> +{
> + struct device *dev = data;
> + int count;
> +
> +
> + switch (action) {
> + case BUS_NOTIFY_UNBIND_DRIVER:
> + count = device_dma_allocations(dev);
> + if (count == 0)
> + break;
> + err_printk(dev, NULL, "DMA-API: device driver has pending "
> + "DMA allocations while released from device "
> + "[count=%d]\n", count);
Hm, cute... but not quite functioning as you intended. If you look at
__device_release_driver() in drivers/base/dd.c you'll see it actually
calls the notifier _before_ calling into the driver's ->remove() method.
So it's hardly surprising that not everything has been freed yet...
Reported by Reinette when it bit iwlwifi.
Ben, can we get away with changing the order so that the ->remove() is
called before the notifier, in this case?
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
next parent reply other threads:[~2009-04-17 21:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200903302101.n2UL1O1n011970@hera.kernel.org>
2009-04-17 21:51 ` David Woodhouse [this message]
2009-04-21 9:20 ` dma-debug: add a check dma memory leaks Joerg Roedel
2009-05-09 23:59 ` David Woodhouse
2009-05-10 1:46 ` Benjamin Herrenschmidt
2009-05-10 2:09 ` Greg KH
2009-05-10 8:49 ` David Woodhouse
2009-05-10 9:32 ` Benjamin Herrenschmidt
2009-05-11 17:43 ` Greg KH
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=1240005065.19059.19.camel@macbook.infradead.org \
--to=dwmw2@infradead.org \
--cc=benh@kernel.crashing.org \
--cc=greg@kroah.com \
--cc=joerg.roedel@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=reinette.chatre@intel.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).