lib/dma_debug: print out the actual pending DMA allocations on release
PATCH 1/2 lib/dma_debug: print out the actual pending DMA allocations on release
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 <[email protected]>
--- lib/dma-debug.c | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-)
lib/dma-debug.c +22 -3
@@ -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 ;
Signature · 1 line
1.7.1