Patchwork [01/10] x86: add Kconfig entry for DMA-API debugging

login
register
mail settings
Submitter Joerg Roedel
Date Nov. 21, 2008, 4:26 p.m.
Message ID <1227284770-19215-2-git-send-email-joerg.roedel@amd.com>
Download mbox | patch
Permalink /patch/10041/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Joerg Roedel - Nov. 21, 2008, 4:26 p.m.
Impact: adds a new Kconfig option

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/Kconfig.debug |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Ingo Molnar - Nov. 21, 2008, 4:40 p.m.
* Joerg Roedel <joerg.roedel@amd.com> wrote:

> +config DMA_API_DEBUG
> +	default n

'default n' can be omitted in general from interactive Kconfig 
entries.

> +	bool "Enable debugging of DMA-API usage"
> +	depends on X86

perhaps add a proper dependency on iommu or swiotlb presence as well - 
in case we decide to make it all disable-able again and dont have the 
callbacks present?

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joerg Roedel - Nov. 21, 2008, 4:48 p.m.
On Fri, Nov 21, 2008 at 05:40:14PM +0100, Ingo Molnar wrote:
> 
> * Joerg Roedel <joerg.roedel@amd.com> wrote:
> 
> > +config DMA_API_DEBUG
> > +	default n
> 
> 'default n' can be omitted in general from interactive Kconfig 
> entries.

Ok, then I remove it.

> 
> > +	bool "Enable debugging of DMA-API usage"
> > +	depends on X86
> 
> perhaps add a proper dependency on iommu or swiotlb presence as well - 
> in case we decide to make it all disable-able again and dont have the 
> callbacks present?

No problem. But its hard to believe that we make the DMA-API
disable-able some day ;)
The best dependency in this case should be SWIOTLB I think.

Joerg
David Miller - Nov. 21, 2008, 11:18 p.m.
From: Joerg Roedel <joerg.roedel@amd.com>
Date: Fri, 21 Nov 2008 17:26:01 +0100

> Impact: adds a new Kconfig option
> 
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>

This definitely should be generic code, rather than something
tucked away in x86 platform code.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 2a3dfbd..d4fafd5 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -162,6 +162,18 @@  config DOUBLEFAULT
 	  option saves about 4k and might cause you much additional grey
 	  hair.
 
+config DMA_API_DEBUG
+	default n
+	bool "Enable debugging of DMA-API usage"
+	depends on X86
+	help
+	  Enable this option to debug the use of the DMA API by device drivers.
+	  With this option you will be able to detect common bugs in device
+	  drivers like double-freeing of DMA mappings or freeing mappings that
+	  were never allocated.
+	  This option causes a performance degredation. Use only if you want to
+	  debug device drivers. If unsure, say N.
+
 config IOMMU_DEBUG
 	bool "Enable IOMMU debugging"
 	depends on GART_IOMMU && DEBUG_KERNEL