lkml.org 
[lkml]   [2009]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 15/16] dma-debug: x86 architecture bindings
From
On Fri, 9 Jan 2009 17:19:29 +0100
Joerg Roedel <joerg.roedel@amd.com> wrote:

> Impact: make use of DMA-API debugging code in x86
>
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> ---
> arch/x86/Kconfig | 1 +
> arch/x86/include/asm/dma-mapping.h | 30 ++++++++++++++++++++++++++----
> arch/x86/kernel/pci-dma.c | 5 +++++
> 3 files changed, 32 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 862adb9..68a806c 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -39,6 +39,7 @@ config X86
> select HAVE_GENERIC_DMA_COHERENT if X86_32
> select HAVE_EFFICIENT_UNALIGNED_ACCESS
> select USER_STACKTRACE_SUPPORT
> + select HAVE_DMA_API_DEBUG
>
> config ARCH_DEFCONFIG
> string
> diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
> index 4035357..939d5b3 100644
> --- a/arch/x86/include/asm/dma-mapping.h
> +++ b/arch/x86/include/asm/dma-mapping.h
> @@ -7,6 +7,7 @@
> */
>
> #include <linux/scatterlist.h>
> +#include <linux/dma-debug.h>
> #include <asm/io.h>
> #include <asm/swiotlb.h>
> #include <asm-generic/dma-coherent.h>
> @@ -93,9 +94,12 @@ dma_map_single(struct device *hwdev, void *ptr, size_t size,
> int direction)
> {
> struct dma_mapping_ops *ops = get_dma_ops(hwdev);
> + dma_addr_t addr;
>
> BUG_ON(!valid_dma_direction(direction));
> - return ops->map_single(hwdev, virt_to_phys(ptr), size, direction);
> + addr = ops->map_single(hwdev, virt_to_phys(ptr), size, direction);
> + debug_map_single(hwdev, ptr, size, direction, addr);
> + return addr;

What happens if ops->map_single fails?

Seems that debug_map_single doesn't check the dma mapping fails. So it
allocates a new entries and nobody frees it?

Another problem is that what happens if ops->map_single succeeds but
debug_map_single fails? Seems that it gives a false warning.


\
 
 \ /
  Last update: 2009-01-11 07:29    [W:0.354 / U:3.968 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site