Patchwork [Lucid] SRU: dma-mapping: Remove WARN_ON in dma_free_coherent

login
register
mail settings
Submitter Stefan Bader
Date April 12, 2010, 12:53 p.m.
Message ID <1271076835-3182-1-git-send-email-stefan.bader@canonical.com>
Download mbox | patch
Permalink /patch/49966/
State Accepted
Delegated to: Andy Whitcroft
Headers show

Comments

Stefan Bader - April 12, 2010, 12:53 p.m.
This is really just hiding the warning about incompatible driver
code (for other archs). But its part of what is done for hot-
plugging in KVM (supposedly cloud) and its in the x86 only code
only, so it might be a way to prevent scared reports about nothing.

Stefan

From 72e6b51aa333435b9492011a4842ab0c462503de Mon Sep 17 00:00:00 2001
From: Stefan Bader <stefan.bader@canonical.com>
Date: Mon, 29 Mar 2010 19:12:36 +0200
Subject: [PATCH] dma-mapping: Remove WARN_ON in dma_free_coherent

BugLink: http://bugs.launchpad.net/ubuntu/bugs/458201

Triggered by the following backtrace:

WARNING: at
/build/buildd/linux-2.6.32/arch/x86/include/asm/dma-mapping.h:154
___free_dma_mem_cluster+0x102/0x110()

 [<ffffffff81064f9b>] warn_slowpath_common+0x7b/0xc0
 [<ffffffff81064ff4>] warn_slowpath_null+0x14/0x20
 [<ffffffff8139a2a2>] ___free_dma_mem_cluster+0x102/0x110
 [<ffffffff8139a072>] __sym_mfree+0xd2/0x100
 [<ffffffff8139a109>] __sym_mfree_dma+0x69/0x100
 [<ffffffff8139245f>] sym_hcb_free+0x8f/0x1f0

This patch never will be accepted upstream because the WARN_ON
is supposed to perevent driver development which is only
compatible with x86 on x86 (ARM can sleep in that function).
The right way to fix it would be to make the offending function
use locks in the right way but that requires careful implementation.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 arch/x86/include/asm/dma-mapping.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
Andy Whitcroft - April 13, 2010, 1:46 p.m.
On Mon, Apr 12, 2010 at 02:53:55PM +0200, Stefan Bader wrote:
> This is really just hiding the warning about incompatible driver
> code (for other archs). But its part of what is done for hot-
> plugging in KVM (supposedly cloud) and its in the x86 only code
> only, so it might be a way to prevent scared reports about nothing.
> 
> Stefan
> 
> From 72e6b51aa333435b9492011a4842ab0c462503de Mon Sep 17 00:00:00 2001
> From: Stefan Bader <stefan.bader@canonical.com>
> Date: Mon, 29 Mar 2010 19:12:36 +0200
> Subject: [PATCH] dma-mapping: Remove WARN_ON in dma_free_coherent
> 
> BugLink: http://bugs.launchpad.net/ubuntu/bugs/458201
> 
> Triggered by the following backtrace:
> 
> WARNING: at
> /build/buildd/linux-2.6.32/arch/x86/include/asm/dma-mapping.h:154
> ___free_dma_mem_cluster+0x102/0x110()
> 
>  [<ffffffff81064f9b>] warn_slowpath_common+0x7b/0xc0
>  [<ffffffff81064ff4>] warn_slowpath_null+0x14/0x20
>  [<ffffffff8139a2a2>] ___free_dma_mem_cluster+0x102/0x110
>  [<ffffffff8139a072>] __sym_mfree+0xd2/0x100
>  [<ffffffff8139a109>] __sym_mfree_dma+0x69/0x100
>  [<ffffffff8139245f>] sym_hcb_free+0x8f/0x1f0
> 
> This patch never will be accepted upstream because the WARN_ON
> is supposed to perevent driver development which is only
> compatible with x86 on x86 (ARM can sleep in that function).
> The right way to fix it would be to make the offending function
> use locks in the right way but that requires careful implementation.
> 
> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  arch/x86/include/asm/dma-mapping.h |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
> index 6a25d5d..2d6097f 100644
> --- a/arch/x86/include/asm/dma-mapping.h
> +++ b/arch/x86/include/asm/dma-mapping.h
> @@ -151,8 +151,6 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
>  {
>  	struct dma_map_ops *ops = get_dma_ops(dev);
>  
> -	WARN_ON(irqs_disabled());       /* for portability */
> -
>  	if (dma_release_from_coherent(dev, get_order(size), vaddr))
>  		return;

This only removes a WARN_ON, ie no functionality should be changed.  As
the warning is bogus in a number of places which will trigger bug
reports it is probabally best to remove it for now.

Acked-by: Andy Whitcroft <apw@canonical.com>

-apw
Andy Whitcroft - April 13, 2010, 1:47 p.m.
Applied to Lucid.

-apw

Patch

diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 6a25d5d..2d6097f 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -151,8 +151,6 @@  static inline void dma_free_coherent(struct device *dev, size_t size,
 {
 	struct dma_map_ops *ops = get_dma_ops(dev);
 
-	WARN_ON(irqs_disabled());       /* for portability */
-
 	if (dma_release_from_coherent(dev, get_order(size), vaddr))
 		return;