* [PATCH 1/2] lib/dma_debug: print out the actual pending DMA allocations on release
@ 2010-10-07 5:07 Keith Packard
0 siblings, 0 replies; only message in thread
From: Keith Packard @ 2010-10-07 5:07 UTC (permalink / raw)
To: linux-kernel; +Cc: Keith Packard
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-07 5:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-07 5:07 [PATCH 1/2] lib/dma_debug: print out the actual pending DMA allocations on release Keith Packard
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®