diff options
author | Dan Williams <dan.j.williams@intel.com> | 2014-01-21 18:48:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-21 19:19:41 -0500 |
commit | 0abdd7a81b7e3fd781d7fabcca49501852bba17e (patch) | |
tree | 20ab3aa4b476ceaf6d3a824c842cd581445ded8b /mm/memory.c | |
parent | 03d11a0e458d7008192585124e4c3313c2829046 (diff) |
dma-debug: introduce debug_dma_assert_idle()
Record actively mapped pages and provide an api for asserting a given
page is dma inactive before execution proceeds. Placing
debug_dma_assert_idle() in cow_user_page() flagged the violation of the
dma-api in the NET_DMA implementation (see commit 77873803363c "net_dma:
mark broken").
The implementation includes the capability to count, in a limited way,
repeat mappings of the same page that occur without an intervening
unmap. This 'overlap' counter is limited to the few bits of tag space
in a radix tree. This mechanism is added to mitigate false negative
cases where, for example, a page is dma mapped twice and
debug_dma_assert_idle() is called after the page is un-mapped once.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c index 6768ce9e57d2..e9c550484ba6 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <linux/gfp.h> | 59 | #include <linux/gfp.h> |
60 | #include <linux/migrate.h> | 60 | #include <linux/migrate.h> |
61 | #include <linux/string.h> | 61 | #include <linux/string.h> |
62 | #include <linux/dma-debug.h> | ||
62 | 63 | ||
63 | #include <asm/io.h> | 64 | #include <asm/io.h> |
64 | #include <asm/pgalloc.h> | 65 | #include <asm/pgalloc.h> |
@@ -2559,6 +2560,8 @@ static inline int pte_unmap_same(struct mm_struct *mm, pmd_t *pmd, | |||
2559 | 2560 | ||
2560 | static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va, struct vm_area_struct *vma) | 2561 | static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va, struct vm_area_struct *vma) |
2561 | { | 2562 | { |
2563 | debug_dma_assert_idle(src); | ||
2564 | |||
2562 | /* | 2565 | /* |
2563 | * If the source page was a PFN mapping, we don't have | 2566 | * If the source page was a PFN mapping, we don't have |
2564 | * a "struct page" for it. We do a best-effort copy by | 2567 | * a "struct page" for it. We do a best-effort copy by |