* [PATCH v1] dma-mapping: Move debug configuration options to kernel/dma
@ 2019-02-11 15:54 Andy Shevchenko
2019-02-11 15:54 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2019-02-11 15:54 UTC (permalink / raw)
To: Marek Szyprowski, Robin Murphy, linux-kernel, iommu
Cc: Andy Shevchenko, Christoph Hellwig
This is a follow up to the commit cf65a0f6f6ff
("dma-mapping: move all DMA mapping code to kernel/dma")
which moved source code of DMA API to kernel/dma folder. Since there is
no file left in the lib that require DMA API debugging options move the
latter to kernel/dma as well.
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
kernel/dma/Kconfig | 2 ++
kernel/dma/Kconfig.debug | 36 ++++++++++++++++++++++++++++++++++++
lib/Kconfig.debug | 36 ------------------------------------
3 files changed, 38 insertions(+), 36 deletions(-)
create mode 100644 kernel/dma/Kconfig.debug
diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
index ca88b867e7fe..cba73df57982 100644
--- a/kernel/dma/Kconfig
+++ b/kernel/dma/Kconfig
@@ -53,3 +53,5 @@ config DMA_REMAP
config DMA_DIRECT_REMAP
bool
select DMA_REMAP
+
+source "kernel/dma/Kconfig.debug"
diff --git a/kernel/dma/Kconfig.debug b/kernel/dma/Kconfig.debug
new file mode 100644
index 000000000000..2015976cf4ca
--- /dev/null
+++ b/kernel/dma/Kconfig.debug
@@ -0,0 +1,36 @@
+config DMA_API_DEBUG
+ bool "Enable debugging of DMA-API usage"
+ select NEED_DMA_MAP_STATE
+ 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 also attempts to catch cases where a page owned by DMA is
+ accessed by the cpu in a way that could cause data corruption. For
+ example, this enables cow_user_page() to check that the source page is
+ not undergoing DMA.
+
+ This option causes a performance degradation. Use only if you want to
+ debug device drivers and dma interactions.
+
+ If unsure, say N.
+
+config DMA_API_DEBUG_SG
+ bool "Debug DMA scatter-gather usage"
+ default y
+ depends on DMA_API_DEBUG
+ help
+ Perform extra checking that callers of dma_map_sg() have respected the
+ appropriate segment length/boundary limits for the given device when
+ preparing DMA scatterlists.
+
+ This is particularly likely to have been overlooked in cases where the
+ dma_map_sg() API is used for general bulk mapping of pages rather than
+ preparing literal scatter-gather descriptors, where there is a risk of
+ unexpected behaviour from DMA API implementations if the scatterlist
+ is technically out-of-spec.
+
+ If unsure, say N.
+
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d4df5b24d75e..ef5d7c08e5b9 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1655,42 +1655,6 @@ config PROVIDE_OHCI1394_DMA_INIT
See Documentation/debugging-via-ohci1394.txt for more information.
-config DMA_API_DEBUG
- bool "Enable debugging of DMA-API usage"
- select NEED_DMA_MAP_STATE
- 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 also attempts to catch cases where a page owned by DMA is
- accessed by the cpu in a way that could cause data corruption. For
- example, this enables cow_user_page() to check that the source page is
- not undergoing DMA.
-
- This option causes a performance degradation. Use only if you want to
- debug device drivers and dma interactions.
-
- If unsure, say N.
-
-config DMA_API_DEBUG_SG
- bool "Debug DMA scatter-gather usage"
- default y
- depends on DMA_API_DEBUG
- help
- Perform extra checking that callers of dma_map_sg() have respected the
- appropriate segment length/boundary limits for the given device when
- preparing DMA scatterlists.
-
- This is particularly likely to have been overlooked in cases where the
- dma_map_sg() API is used for general bulk mapping of pages rather than
- preparing literal scatter-gather descriptors, where there is a risk of
- unexpected behaviour from DMA API implementations if the scatterlist
- is technically out-of-spec.
-
- If unsure, say N.
-
menuconfig RUNTIME_TESTING_MENU
bool "Runtime Testing"
def_bool y
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] dma-mapping: Move debug configuration options to kernel/dma
2019-02-11 15:54 [PATCH v1] dma-mapping: Move debug configuration options to kernel/dma Andy Shevchenko
@ 2019-02-11 15:54 ` Christoph Hellwig
2019-02-11 16:08 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2019-02-11 15:54 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Marek Szyprowski, Robin Murphy, linux-kernel, iommu, Christoph Hellwig
On Mon, Feb 11, 2019 at 05:54:09PM +0200, Andy Shevchenko wrote:
> This is a follow up to the commit cf65a0f6f6ff
>
> ("dma-mapping: move all DMA mapping code to kernel/dma")
>
> which moved source code of DMA API to kernel/dma folder. Since there is
> no file left in the lib that require DMA API debugging options move the
> latter to kernel/dma as well.
Can we do this without the separate Kconfig.debug file?
Otherwise this looks good to me.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] dma-mapping: Move debug configuration options to kernel/dma
2019-02-11 15:54 ` Christoph Hellwig
@ 2019-02-11 16:08 ` Andy Shevchenko
0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2019-02-11 16:08 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Marek Szyprowski, Robin Murphy, linux-kernel, iommu
On Mon, Feb 11, 2019 at 04:54:50PM +0100, Christoph Hellwig wrote:
> On Mon, Feb 11, 2019 at 05:54:09PM +0200, Andy Shevchenko wrote:
> > This is a follow up to the commit cf65a0f6f6ff
> >
> > ("dma-mapping: move all DMA mapping code to kernel/dma")
> >
> > which moved source code of DMA API to kernel/dma folder. Since there is
> > no file left in the lib that require DMA API debugging options move the
> > latter to kernel/dma as well.
>
> Can we do this without the separate Kconfig.debug file?
Sure.
>
> Otherwise this looks good to me.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-11 16:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-11 15:54 [PATCH v1] dma-mapping: Move debug configuration options to kernel/dma Andy Shevchenko
2019-02-11 15:54 ` Christoph Hellwig
2019-02-11 16:08 ` Andy Shevchenko
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).