public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma-debug: Allow archs to override check_for_illegal_area
@ 2009-08-11 15:43 Joerg Roedel
  2009-08-12  8:54 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Joerg Roedel @ 2009-08-11 15:43 UTC (permalink / raw)
  To: Ingo Molnar, David Miller; +Cc: linux-kernel, 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.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 lib/dma-debug.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 65b0d99..4f6ad34 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -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);
-- 
1.6.3.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-debug: Allow archs to override check_for_illegal_area
  2009-08-11 15:43 [PATCH] dma-debug: Allow archs to override check_for_illegal_area Joerg Roedel
@ 2009-08-12  8:54 ` Ingo Molnar
  2009-08-14 20:02   ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2009-08-12  8:54 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Ingo Molnar, David Miller, linux-kernel


* Joerg Roedel <joerg.roedel@amd.com> wrote:

> 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.
> 
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-debug: Allow archs to override check_for_illegal_area
  2009-08-12  8:54 ` Ingo Molnar
@ 2009-08-14 20:02   ` David Miller
  2009-08-15  8:46     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2009-08-14 20:02 UTC (permalink / raw)
  To: mingo; +Cc: joerg.roedel, mingo, linux-kernel

From: Ingo Molnar <mingo@elte.hu>
Date: Wed, 12 Aug 2009 10:54:40 +0200

> 
> * Joerg Roedel <joerg.roedel@amd.com> wrote:
> 
>> 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.
>> 
>> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
>> ---
>>  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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-debug: Allow archs to override check_for_illegal_area
  2009-08-14 20:02   ` David Miller
@ 2009-08-15  8:46     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-08-15  8:46 UTC (permalink / raw)
  To: David Miller; +Cc: joerg.roedel, mingo, linux-kernel


* David Miller <davem@davemloft.net> wrote:

> From: Ingo Molnar <mingo@elte.hu>
> Date: Wed, 12 Aug 2009 10:54:40 +0200
> 
> > 
> > * Joerg Roedel <joerg.roedel@amd.com> wrote:
> > 
> >> 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.
> >> 
> >> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> >> ---
> >>  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.

Ok, thanks David!

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-15  8:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-11 15:43 [PATCH] dma-debug: Allow archs to override check_for_illegal_area Joerg Roedel
2009-08-12  8:54 ` Ingo Molnar
2009-08-14 20:02   ` David Miller
2009-08-15  8:46     ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox