From: Keith Packard <keithp@keithp.com>
To: linux-kernel@vger.kernel.org
Cc: Keith Packard <keithp@keithp.com>
Subject: [PATCH 1/2] lib/dma_debug: print out the actual pending DMA allocations on release
Date: Wed, 6 Oct 2010 22:07:53 -0700 [thread overview]
Message-ID: <1286428073-29799-1-git-send-email-keithp@keithp.com> (raw)
When a device leaves DMA allocations pending, instead of just printing
the count of allocations, go back and print out information about each
one so that the user can find the call site causing the bug.
Signed-off-by: Keith Packard <keithp@keithp.com>
---
lib/dma-debug.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 01e6427..46cdc55 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -670,6 +670,27 @@ static int device_dma_allocations(struct device *dev)
return count;
}
+static void device_dma_print_allocations(struct device *dev)
+{
+ struct dma_debug_entry *entry;
+ unsigned long flags;
+ int i;
+
+ local_irq_save(flags);
+
+ for (i = 0; i < HASH_SIZE; ++i) {
+ spin_lock(&dma_entry_hash[i].lock);
+ list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
+ if (entry->dev == dev)
+ err_printk(dev, entry, "DMA-API: device driver has pending "
+ "DMA allocations while released from device");
+ }
+ spin_unlock(&dma_entry_hash[i].lock);
+ }
+
+ local_irq_restore(flags);
+}
+
static int dma_debug_device_change(struct notifier_block *nb, unsigned long action, void *data)
{
struct device *dev = data;
@@ -683,9 +704,7 @@ static int dma_debug_device_change(struct notifier_block *nb, unsigned long acti
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);
+ device_dma_print_allocations(dev);
break;
default:
break;
--
1.7.1
reply other threads:[~2010-10-07 5:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1286428073-29799-1-git-send-email-keithp@keithp.com \
--to=keithp@keithp.com \
--cc=linux-kernel@vger.kernel.org \
/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®