DMA-API debugging facility v3
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest16 patches 15 repliesIn review
Changes from v2 -> v3 from the cover letter
- rebased patches against tip/core/iommu branch
- changed storage of virtual address to physical address in struct dma_debug_entry (thanks Fujita)
- removed usage of x86 specific bad_dma_address (thanks Fujita)
- changed a error log message to be more clear (thanks Roel)
- fixed a bug with wrong handling of map_page/unmap_page requests (thanks Michael)
- various improvements and fixes suggested by Ingo, thanks
- added more comments
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/16 | dma-debug: add Kconfig entryarch/ lib/ | +13 | 0 replies | |
| 2/16 | dma-debug: add header file and core data structuresinclude/ lib/ lib/ | +67 | 0 replies | |
| 3/16 | dma-debug: add hash functions for dma_debug_entrieslib/ | +101 | 0 replies | |
| 4/16 | dma-debug: add allocator codelib/ | +57 | 0 replies | |
| 5/16 | dma-debug: add initialization codeinclude/ lib/ | +80 | 0 replies | |
| 6/16 | dma-debug: add kernel command line parametersDocumentation/ lib/ | +48 | 0 replies | |
| 7/16 | dma-debug: add debugfs interfacelib/ | +78 | 0 replies | |
| 8/16 | dma-debug: add core checking functionslib/ | +147 | 3 replies | |
| 9/16 | dma-debug: add checking for map/unmap_page/singleinclude/ lib/ | +74 | 6 replies | |
| 10/16 | dma-debug: add add checking for map/unmap_sginclude/ lib/ | +68 | 2 replies | |
| 11/16 | dma-debug: add checking for [alloc|free]_coherentinclude/ lib/ | +61 | 0 replies | |
| 12/16 | dma-debug: add checks for sync_single_*include/ lib/ | +41 | 0 replies | |
| 13/16 | dma-debug: add checks for sync_single_range_*include/ lib/ | +51 | 0 replies | |
| 14/16 | dma-debug: add checks for sync_single_sg_*include/ lib/ | +52 | 0 replies | |
| 15/16 | dma-debug: x86 architecture bindingsarch/ arch/ arch/ | +46 | 2 replies | |
| 16/16 | dma-debug: Documentation updateDocumentation/ | +106 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/16] DMA-API debugging facility v3
Hi,
this is version 3 of the patchset which introduces code to debug drivers usage of the DMA-API. Many thanks to all the reviewers and the useful comments on the previous versions of this patchset. Tests with hardware IOMMUs have shown several bugs in drivers regarding the usage of that API.
These bugs often don't show up or have any negative impact if there is no hardware IOMMU in use in the system. But with an hardware IOMMU these bugs turn the hardware unusable or, in the worst case, cause data corruption on devices which are managed by other (good) drivers.
With the code these patches introduce driver developers can find several bugs of misusing the DMA-API in their drivers. But be aware, it can not find all possible bugs. What it can not find are use-after-free bugs.
If anyone wants to try this stuff and don't want to apply them one by one, they can also be pulled from (branch is based on tip/core/iommu)
git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git dma-api/debug
Changes from v2 -> v3:
- rebased patches against tip/core/iommu branch
- changed storage of virtual address to physical address in struct dma_debug_entry (thanks Fujita)
- removed usage of x86 specific bad_dma_address (thanks Fujita)
- changed a error log message to be more clear (thanks Roel)
- fixed a bug with wrong handling of map_page/unmap_page requests (thanks Michael)
- various improvements and fixes suggested by Ingo, thanks
- added more comments
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
Here is the diffstat:
Documentation/DMA-API.txt | 106 +++++ Documentation/kernel-parameters.txt | 10 + arch/Kconfig | 2 + arch/x86/Kconfig | 1 + arch/x86/include/asm/dma-mapping.h | 45 ++- arch/x86/kernel/pci-dma.c | 6 + include/linux/dma-debug.h | 160 ++++++++ lib/Kconfig.debug | 11 + lib/Makefile | 2 + lib/dma-debug.c | 753 +++++++++++++++++++++++++++++++++++ 10 files changed, 1090 insertions(+), 6 deletions(-)