this is version 2 of the patchset which introduces code to debug driversusage of the DMA-API. Many thanks to all the reviewers and the usefulcomments on the fist version of this patchset. Tests with hardwareIOMMUs have shown several bugs in drivers regarding the usage of thatAPI. Problems were found especially in network card drivers.

These bugs often don't show up or have any negative impact if there isno hardware IOMMU in use in the system. But with an hardware IOMMU thesebugs turn the hardware unusable or, in the worst case, cause datacorruption on devices which are managed by other (good) drivers.

With the code these patches introduce driver developers can find severalbugs of misusing the DMA-API in their drivers. But be aware, it can notfind all possible bugs. If it finds a problem it prints out messageslike

This way driver developers get an idea where the problem is in theircode.

I hope I addressed most of the review comments and objections from thefirst version. Please give this version also a good review and send meyour comments.

Thanks,

Joerg

Changes from v1 -> v2:

- moved code to lib/ and include/linux to make it usable for all architectures- more fine grained hash locking (locking is now per hash bucket, no global lock anymore)- dma_debug_entries are preallocated- per default the code will only print one warning and is silent then- added a debugfs interface to see some statistics and to enable more verbose error reporting in the kernel log- added command line parameter to disable debugging code- allocation errors are now handled correctly- added documentation about this facility for driver developers