Re: [PATCH v2] dma-debug: enhance dma_debug_device_change() to checkfor mapping errors

From: Shuah Khan
Date: Fri Jan 10 2014 - 19:25:54 EST


On 01/07/2014 10:22 AM, Shuah Khan wrote:
On 01/07/2014 08:12 AM, Joerg Roedel wrote:
On Tue, Jan 07, 2014 at 08:00:33AM -0700, Shuah Khan wrote:
This patch and a follow-on cocinelli warning fix patch are in
linux-next. Would you like me to send a patch relative to the change
in linux-next or cut a new patch against the latest Linus's git. I
can go either way. We just have to remember to drop those two
patches from linux-next.

Please do a patch against linus.git and drop the two patches from
linux-next. Over which tree did they go into linux-next anyway?



ok. It went through mm tree.


I have a separate routine now for scanning for entries with map error flag set and I also have a new err_printk() call to print the entry from dma_debug_device_change() right after device_dma_allocations() check and corresponding err_printk(). Snippet of the diff below. Only one warning gets printed. Looking at err_printk(): if (!show_all_errors && show_num_errors > 0) conditional, it appears that is the way it is supposed to work, unless I am missing something

One way to not miss the second warning is to just generate just a pr_err() for the mapping error instead of err_printk(). Leaked entries is a bigger problem that should really be shown and the same entry might not have the map error flag set. Thoughts?

static int dma_debug_device_change(struct notifier_block *nb, unsigned long action, void *data)
{
struct device *dev = data;
@@ -758,6 +784,18 @@ static int dma_debug_device_change(struct notifier_block *nb, unsigned long acti
"[mapped with %s] [mapped as %s]\n",
count, entry->dev_addr, entry->size,
dir2name[entry->direction], type2name[entry->type]);
+
+ count = device_dma_map_errors(dev, &entry);
+ if (count == 0)
+ break;
+ err_printk(dev, entry,
+ "DMA-API: device driver failed to check map err"
+ ": [count=%d]\n"
+ "Details of an entry with map error flag set: "
+ "[device address=0x%016llx] [size=%llu bytes] "
+ "[mapped with %s] [mapped as %s]\n",
+ count, entry->dev_addr, entry->size,
+ dir2name[entry->direction], type2name[entry->type]);
break;


--
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
shuah.kh@xxxxxxxxxxx | (970) 672-0658
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/