[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200901210117.33153.arnd@arndb.de>
Date: Wed, 21 Jan 2009 01:17:32 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Joerg Roedel <joerg.roedel@....com>
Cc: mingo@...hat.com, linux-kernel@...r.kernel.org,
fujita.tomonori@....ntt.co.jp, dwmw2@...radead.org,
iommu@...ts.linux-foundation.org,
David Miller <davem@...emloft.net>,
Oliver Neukum <oliver@...kum.org>, ceggers@....de
Subject: Re: [PATCH 09/16] dma-debug: add checking for map/unmap_page/single
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)));
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
Arnd <><
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists