[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-iommu
Subject:    [PATCH 09/16] dma-debug: add checking for map/unmap_page/single
From:       joro () 8bytes ! org (Joerg Roedel)
Date:       2009-01-25 13:51:15
Message-ID: 20090125135115.GA29009 () 8bytes ! org
[Download RAW message or body]

On Sun, Jan 25, 2009 at 10:17:19PM +0900, FUJITA Tomonori wrote:
> On Fri, 23 Jan 2009 11:28:27 +0100
> Joerg Roedel <joro at 8bytes.org> wrote:
> 
> > On Wed, Jan 21, 2009 at 01:17:32AM +0100, Arnd Bergmann wrote:
> > > On Monday 19 January 2009, Joerg Roedel wrote:
> > > > Impact: add debug callbacks for dma_{un}map_[page|single]
> > > 
> > > In the discussion about "[PATCH] usb/mcs7830: Don't use buffers from
> > > stack for USB transfers", I have raised the question of whether we can
> > > add a check for the DMA address being on the stack, I guess this would
> > > be the right place for it.
> > > 
> > > Maybe you can add another check like:
> > > 
> > > WARN_ON(is_kernel_stack(page_to_virt(page)));
> > 
> > Good idea. This would be the right place for such a check.
> > 
> > > Unfortunately, I can't think of a way to define a generic is_kernel_stack
> > > function. On most architectures (all that put thread_info at the top of the
> > > stack), something like this should work:
> > > 
> > > #ifndef is_kernel_stack
> > > static inline int is_kernel_stack(void *p)
> > > {
> > > 	return (unsigned long)p & ~(THREAD_SIZE - 1) == current_thread_info();
> > > }
> > > #endif
> > 
> > Hmm, this function is indeed required on all architectures. If you send
> > a patchset which adds it I will add the check for stack addresses to
> > this debugging code :)
> 
> object_is_on_stack()

Oh cool. This function exists already. Thanks for the hint :)

Joerg

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic