aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /lib/dma-debug.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r--lib/dma-debug.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 01e64270e246..db07bfd9298e 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -590,6 +590,7 @@ out_unlock:
590static const struct file_operations filter_fops = { 590static const struct file_operations filter_fops = {
591 .read = filter_read, 591 .read = filter_read,
592 .write = filter_write, 592 .write = filter_write,
593 .llseek = default_llseek,
593}; 594};
594 595
595static int dma_debug_fs_init(void) 596static int dma_debug_fs_init(void)
@@ -648,7 +649,7 @@ out_err:
648 return -ENOMEM; 649 return -ENOMEM;
649} 650}
650 651
651static int device_dma_allocations(struct device *dev) 652static int device_dma_allocations(struct device *dev, struct dma_debug_entry **out_entry)
652{ 653{
653 struct dma_debug_entry *entry; 654 struct dma_debug_entry *entry;
654 unsigned long flags; 655 unsigned long flags;
@@ -659,8 +660,10 @@ static int device_dma_allocations(struct device *dev)
659 for (i = 0; i < HASH_SIZE; ++i) { 660 for (i = 0; i < HASH_SIZE; ++i) {
660 spin_lock(&dma_entry_hash[i].lock); 661 spin_lock(&dma_entry_hash[i].lock);
661 list_for_each_entry(entry, &dma_entry_hash[i].list, list) { 662 list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
662 if (entry->dev == dev) 663 if (entry->dev == dev) {
663 count += 1; 664 count += 1;
665 *out_entry = entry;
666 }
664 } 667 }
665 spin_unlock(&dma_entry_hash[i].lock); 668 spin_unlock(&dma_entry_hash[i].lock);
666 } 669 }
@@ -673,6 +676,7 @@ static int device_dma_allocations(struct device *dev)
673static int dma_debug_device_change(struct notifier_block *nb, unsigned long action, void *data) 676static int dma_debug_device_change(struct notifier_block *nb, unsigned long action, void *data)
674{ 677{
675 struct device *dev = data; 678 struct device *dev = data;
679 struct dma_debug_entry *uninitialized_var(entry);
676 int count; 680 int count;
677 681
678 if (global_disable) 682 if (global_disable)
@@ -680,12 +684,17 @@ static int dma_debug_device_change(struct notifier_block *nb, unsigned long acti
680 684
681 switch (action) { 685 switch (action) {
682 case BUS_NOTIFY_UNBOUND_DRIVER: 686 case BUS_NOTIFY_UNBOUND_DRIVER:
683 count = device_dma_allocations(dev); 687 count = device_dma_allocations(dev, &entry);
684 if (count == 0) 688 if (count == 0)
685 break; 689 break;
686 err_printk(dev, NULL, "DMA-API: device driver has pending " 690 err_printk(dev, entry, "DMA-API: device driver has pending "
687 "DMA allocations while released from device " 691 "DMA allocations while released from device "
688 "[count=%d]\n", count); 692 "[count=%d]\n"
693 "One of leaked entries details: "
694 "[device address=0x%016llx] [size=%llu bytes] "
695 "[mapped with %s] [mapped as %s]\n",
696 count, entry->dev_addr, entry->size,
697 dir2name[entry->direction], type2name[entry->type]);
689 break; 698 break;
690 default: 699 default:
691 break; 700 break;