linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-mapping.h: Preserve unmap info for CONFIG_DMA_API_DEBUG
@ 2016-09-20 15:58 Andrey Smirnov
  2016-09-21 10:27 ` Robin Murphy
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Smirnov @ 2016-09-20 15:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Robin Murphy, Joerg Roedel, Will Deacon, Zhen Lei,
	Luis R. Rodriguez, Christian Borntraeger, Geliang Tang,
	Andrey Smirnov

When CONFIG_DMA_API_DEBUG is enabled we need to preserve unmapping
address even if "unmap" is a no-op for our architecutre because we need
debug_dma_unmap_page() to correctly cleanup all of the debug
bookkeeping. Failing to do so results in a false positive warnings about
previously mapped areas never being unmapped.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 include/linux/dma-mapping.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 71c1b21..41c9875 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -678,7 +678,7 @@ static inline int dma_mmap_wc(struct device *dev,
 #define dma_mmap_writecombine dma_mmap_wc
 #endif
 
-#ifdef CONFIG_NEED_DMA_MAP_STATE
+#if defined(CONFIG_NEED_DMA_MAP_STATE) || defined(CONFIG_DMA_API_DEBUG)
 #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME)        dma_addr_t ADDR_NAME
 #define DEFINE_DMA_UNMAP_LEN(LEN_NAME)          __u32 LEN_NAME
 #define dma_unmap_addr(PTR, ADDR_NAME)           ((PTR)->ADDR_NAME)
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dma-mapping.h: Preserve unmap info for CONFIG_DMA_API_DEBUG
  2016-09-20 15:58 [PATCH] dma-mapping.h: Preserve unmap info for CONFIG_DMA_API_DEBUG Andrey Smirnov
@ 2016-09-21 10:27 ` Robin Murphy
  0 siblings, 0 replies; 2+ messages in thread
From: Robin Murphy @ 2016-09-21 10:27 UTC (permalink / raw)
  To: Andrey Smirnov, linux-kernel
  Cc: Andrew Morton, Joerg Roedel, Will Deacon, Zhen Lei,
	Luis R. Rodriguez, Christian Borntraeger, Geliang Tang

On 20/09/16 16:58, Andrey Smirnov wrote:
> When CONFIG_DMA_API_DEBUG is enabled we need to preserve unmapping
> address even if "unmap" is a no-op for our architecutre because we need
> debug_dma_unmap_page() to correctly cleanup all of the debug
> bookkeeping. Failing to do so results in a false positive warnings about
> previously mapped areas never being unmapped.

Makes sense, although I guess it might be even clearer to simply have
DMA_API_DEBUG select NEED_DMA_MAP_STATE. Either way, though,

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  include/linux/dma-mapping.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index 71c1b21..41c9875 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -678,7 +678,7 @@ static inline int dma_mmap_wc(struct device *dev,
>  #define dma_mmap_writecombine dma_mmap_wc
>  #endif
>  
> -#ifdef CONFIG_NEED_DMA_MAP_STATE
> +#if defined(CONFIG_NEED_DMA_MAP_STATE) || defined(CONFIG_DMA_API_DEBUG)
>  #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME)        dma_addr_t ADDR_NAME
>  #define DEFINE_DMA_UNMAP_LEN(LEN_NAME)          __u32 LEN_NAME
>  #define dma_unmap_addr(PTR, ADDR_NAME)           ((PTR)->ADDR_NAME)
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-21 10:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-20 15:58 [PATCH] dma-mapping.h: Preserve unmap info for CONFIG_DMA_API_DEBUG Andrey Smirnov
2016-09-21 10:27 ` Robin Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).