aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2009-06-08dma-debug: disable/enable irqs only once in device_dma_allocationsJoerg Roedel1-2/+6
There is no need to disable/enable irqs on each loop iteration. Just disable irqs for the whole time the loop runs. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-06-08dma-debug: use pr_* instead of printk(KERN_* ...)Joerg Roedel1-21/+15
The pr_* macros are shorter than the old printk(KERN_ ...) variant. Change the dma-debug code to use the new macros and save a few unnecessary line breaks. If lines don't break the source code can also be grepped more easily. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-06-08dma-debug: code style fixesJoerg Roedel1-11/+12
This patch changes the recent updates to dma-debug to conform with coding style guidelines of Linux and the -tip tree. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-06-08dma-debug: comment style fixesJoerg Roedel1-2/+3
Last patch series introduced some new comment which does not fit the Kernel comment style guidelines. Fix it with this patch. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-06-07Merge branch 'dma-debug/2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into core/iommuIngo Molnar1-22/+269
2009-06-07dma-debug: change hash_bucket_find from first-fit to best-fitJoerg Roedel1-4/+39
Some device drivers map the same physical address multiple times to a dma address. Without an IOMMU this results in the same dma address being put into the dma-debug hash multiple times. With a first-fit match in hash_bucket_find() this function may return the wrong dma_debug_entry. This can result in false positive warnings. This patch fixes it by changing the first-fit behavior of hash_bucket_find() into a best-fit algorithm. Reported-by: Torsten Kaiser <just.for.lkml@googlemail.com> Reported-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: lethal@linux-sh.org Cc: just.for.lkml@googlemail.com Cc: hancockrwd@gmail.com Cc: jens.axboe@oracle.com Cc: bharrosh@panasas.com Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: <stable@kernel.org> LKML-Reference: <20090605104132.GE24836@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-06-02Merge branches 'dma-debug/fixes' and 'dma-debug/driver-filter' into dma-debug/2.6.31Joerg Roedel1-1/+166
2009-06-02dma-debug: add dma_debug_driver kernel command lineJoerg Roedel1-0/+18
This patch add the dma_debug_driver= boot parameter to enable the driver filter for early boot. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-06-02dma-debug: add debugfs file for driver filterJoerg Roedel1-1/+101
This patch adds the dma-api/driver_filter file to debugfs. The root user can write a driver name into this file to see only dma-api errors for that particular driver in the kernel log. Writing an empty string to that file disables the driver filter. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-06-02dma-debug: add variables and checks for driver filterJoerg Roedel1-1/+48
This patch adds the state variables for the driver filter and a function to check if the filter is enabled and matches to the current device. The check is built into the err_printk function. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-29dma-debug: fix debug_dma_sync_sg_for_cpu and debug_dma_sync_sg_for_deviceFUJITA Tomonori1-11/+37
DMA-mapping.txt says that debug_dma_sync_sg family must be called with the _same_ one you passed into the dma_map_sg call, it should _NOT_ be the 'count' value _returned_ from the dma_map_sg call. debug_dma_sync_sg_for_cpu and debug_dma_sync_sg_for_device can't handle this properly; they need to use the sg_mapped_ents in struct dma_debug_entry as debug_dma_unmap_sg() does. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-29dma-debug: use sg_dma_len accessorFUJITA Tomonori1-5/+5
debug_dma_map_sg() and debug_dma_unmap_sg() use length in struct scatterlist while debug_dma_sync_sg_for_cpu() and debug_dma_sync_sg_for_device() use dma_length. This causes bugs warnings on some IOMMU implementations since these values are not same; the length doesn't represent the dma length. We always need to use sg_dma_len() accessor to get the dma length of a scatterlist entry. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-29dma-debug: use sg_dma_address accessor instead of using dma_address directlyFUJITA Tomonori1-6/+6
Architectures might not have dma_address in struct scatterlist (PARISC doesn't). Directly accessing to dma_address in struct scatterlist is wrong; we need to use sg_dma_address() accesssor instead. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-28dma-debug: re-add dma memory leak detectionJoerg Roedel1-1/+57
This is basically a revert of commit 314eeac9 but now in a fixed version. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-05-11Merge commit 'v2.6.30-rc5' into core/iommuIngo Molnar1-52/+1
Merge reason: core/iommu was on an .30-rc1 base, update it to .30-rc5 to refresh. Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-04-26dma-debug: remove broken dma memory leak detection for 2.6.30Joerg Roedel1-52/+1
The feature needs some more work because the notfier which is used to check for pending allocations is called before the device drivers ->remove() function. Therefore this feature reports false positives. A real fix for this issue is to introduce a new notifier event which sent _after_ the driver has deinitialized itself. That will done for the next kernel version. [ Impact: reduce the scope of CONFIG_DMA_API_DEBUG=y checks ] Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org LKML-Reference: <1240576557-22442-1-git-send-email-joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-04-15dma-debug: add dma_debug_resize_entries() to adjust the number of dma_debug_entriesFUJITA Tomonori1-6/+66
We use a static value for the number of dma_debug_entries. It can be overwritten by a kernel command line option. Some IOMMUs (e.g. GART) can't set an appropriate value by a kernel command line option because they can't know such value until they finish initializing up their hardware. This patch adds dma_debug_resize_entries() enables IOMMUs to adjust the number of dma_debug_entries anytime. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Joerg Roedel <joerg.roedel@amd.com> Cc: fujita.tomonori@lab.ntt.co.jp Cc: akpm@linux-foundation.org LKML-Reference: <20090415182234R.fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-30dma-debug: fix printk formats (i386)Randy Dunlap1-4/+4
Fix printk format warnings in dma-debug: lib/dma-debug.c:645: warning: format '%016llx' expects type 'long long unsigned int', but argument 6 has type 'dma_addr_t' lib/dma-debug.c:662: warning: format '%016llx' expects type 'long long unsigned int', but argument 6 has type 'dma_addr_t' lib/dma-debug.c:676: warning: format '%016llx' expects type 'long long unsigned int', but argument 6 has type 'dma_addr_t' lib/dma-debug.c:686: warning: format '%016llx' expects type 'long long unsigned int', but argument 6 has type 'dma_addr_t' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-03-24dma-debug: make memory range checks more consistentJoerg Roedel1-5/+8
Impact: extend on-kernel-stack DMA debug checks to all !highmem pages We only checked dma_map_single() - extend it to dma_map_page() and dma_map_sg() as well. Also, fix dma_map_single() corner case bug: make sure we dont stack-check highmem (not mapped) pages. Reported-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org LKML-Reference: <1237818908-26516-1-git-send-email-joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-19dma-debug: warn of unmapping an invalid dma addressFUJITA Tomonori1-1/+4
Impact: extend DMA-debug checks Calling dma_unmap families against an invalid dma address should be a bug. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Joerg Roedel <joerg.roedel@amd.com> LKML-Reference: <20090319103743N.fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-17dma-debug: add a check dma memory leaksJoerg Roedel1-0/+55
Impact: allow architectures to monitor busses for dma mem leakage This patch adds checking code to detect if a device has pending DMA operations when it is about to be unbound from its device driver. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-17dma-debug: add checks for kernel text and rodataJoerg Roedel1-1/+25
Impact: get notified if a device dma maps illegal areas This patch adds a check to print a warning message when a device driver tries to map a memory area from the kernel text segment or rodata. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-17dma-debug: print stacktrace of mapping path on unmap errorDavid Woodhouse1-14/+38
Impact: saves stacktrace of a dma mapping and prints it if there is an error Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-17dma-debug: add function to dump dma mappingsDavid Woodhouse1-0/+30
This adds a function to dump the DMA mappings that the debugging code is aware of -- either for a single device, or for _all_ devices. This can be useful for debugging -- sticking a call to it in the DMA page fault handler, for example, to see if the faulting address _should_ be mapped or not, and hence work out whether it's IOMMU bugs we're seeing, or driver bugs. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-03-05dma-debug: add checks for sync_single_sg_*Joerg Roedel1-0/+32
Impact: add debug callbacks for dma_sync_sg_* functions Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add checks for sync_single_range_*Joerg Roedel1-0/+24
Impact: add debug callbacks for dma_sync_single_range_for_* functions Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add checks for sync_single_*Joerg Roedel1-0/+21
Impact: add debug callbacks for dma_sync_single_for_* functions Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add checking for [alloc|free]_coherentJoerg Roedel1-0/+45
Impact: add debug callbacks for dma_[alloc|free]_coherent Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add add checking for map/unmap_sgJoerg Roedel1-0/+73
Impact: add debug callbacks for dma_{un}map_sg Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add checking for map/unmap_page/singleJoerg Roedel1-0/+53
Impact: add debug callbacks for dma_{un}map_[page|single] Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add core checking functionsJoerg Roedel1-1/+187
Impact: add functions to check on dma unmap and sync Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add debugfs interfaceJoerg Roedel1-0/+78
Impact: add debugfs interface for configuring DMA-API debugging Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add kernel command line parametersJoerg Roedel1-0/+38
Impact: add dma_debug= and dma_debug_entries= kernel parameters Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add initialization codeJoerg Roedel1-0/+66
Impact: add code to initialize dma-debug core data structures Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add allocator codeJoerg Roedel1-0/+57
Impact: add allocator code for struct dma_debug_entry Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add hash functions for dma_debug_entriesJoerg Roedel1-0/+101
Impact: implement necessary functions for the core hash Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2009-03-05dma-debug: add header file and core data structuresJoerg Roedel1-0/+42
Impact: add groundwork for DMA-API debugging Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>