Skip to contentSkip to conversation

dma-debug: Allow archs to override check_for_illegal_area

PATCH In review Joerg Roedel 3 participants 4 messages Aug 11, 2009 – Aug 15, 2009 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-debug: Allow archs to override check_for_illegal_area

For some architectures (like sparc32) the default check_for_illegal_area function does not work reliable. This patch makes this function a weak symbol allowing architectures to override it if necessary.

---
 lib/dma-debug.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
lib/dma-debug.c +6 -3
index 65b0d99..4f6ad34 100644
@@ -866,7 +866,9 @@ static inline bool overlap(void *addr, unsigned long len, void *start, void *end
 	return !(b1 <= a2 || a1 >= b2);
 }
 
-static void check_for_illegal_area(struct device *dev, void *addr, unsigned long len)
+void __weak dma_debug_check_for_illegal_area(struct device *dev,
+					     void *addr,
+					     unsigned long len)
 {
 	if (overlap(addr, len, _text, _etext) ||
 	    overlap(addr, len, __start_rodata, __end_rodata))
@@ -971,7 +973,7 @@ void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
 		void *addr = page_address(page) + offset;
 
 		check_for_stack(dev, addr);
-		check_for_illegal_area(dev, addr, size);
+		dma_debug_check_for_illegal_area(dev, addr, size);
 	}
 
 	add_dma_entry(entry);
@@ -1025,7 +1027,8 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
 
 		if (!PageHighMem(sg_page(s))) {
 			check_for_stack(dev, sg_virt(s));
-			check_for_illegal_area(dev, sg_virt(s), sg_dma_len(s));
+			dma_debug_check_for_illegal_area(dev, sg_virt(s),
+							 sg_dma_len(s));
 		}
 
 		add_dma_entry(entry);
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 9 lines · Joerg Roedel

For some architectures (like sparc32) the default check_for_illegal_area function does not work reliable. This patch makes this function a weak symbol allowing architectures to override it if necessary.

---
 lib/dma-debug.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Dave, you indicated that sparc32 would address this problem differently. Do we still need this patch (for .31 for example)?

Ingo

#2 lore raw

From: Ingo Molnar <[email protected]>
Date: Wed, 12 Aug 2009 10:54:40 +0200

Quoted 8 lines · Joerg Roedel
Quoted 6 lines

For some architectures (like sparc32) the default check_for_illegal_area function does not work reliable. This patch makes this function a weak symbol allowing architectures to override it if necessary.

Quoted 7 lines
Quoted 4 lines
---
 lib/dma-debug.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Dave, you indicated that sparc32 would address this problem differently. Do we still need this patch (for .31 for example)?

Don't worry about this purely for sparc32's sake.

We can revisit this patch if I can't sort out the sparc32 issue locally.

Thanks.

#3 lore raw
Quoted 16 lines · David Miller

From: Ingo Molnar <[email protected]>
Date: Wed, 12 Aug 2009 10:54:40 +0200

Quoted 13 lines · Joerg Roedel
Quoted 10 lines

For some architectures (like sparc32) the default check_for_illegal_area function does not work reliable. This patch makes this function a weak symbol allowing architectures to override it if necessary.

---
 lib/dma-debug.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
Quoted 7 lines
Quoted 2 lines

Dave, you indicated that sparc32 would address this problem differently. Do we still need this patch (for .31 for example)?

Don't worry about this purely for sparc32's sake.

We can revisit this patch if I can't sort out the sparc32 issue locally.

Ok, thanks David!

Ingo