lkml.org 
[lkml]   [2008]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectVIRTUAL_BUG_ON()
On Sat, 26 Apr 2008, Andi Kleen wrote:

> > Good idea! Do you have a patch?
>
> Yes. Appended. But it just enables the old NUMA VIRTUAL_BUG_ON()s, more
> work could be done e.g. by instrumenting pa/va and the non NUMA and i386
> case too.

Hmmmm.. No hooks yet? I have some pieces here that do something similar:

Subject: Add checks for virtual addresses

Add checks to insure that virtual addresses are not used in invalid contexts.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
arch/x86/mm/ioremap.c | 1 +
include/asm-x86/page_32.h | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)

Index: linux-2.6.25-mm1/arch/x86/mm/ioremap.c
===================================================================
--- linux-2.6.25-mm1.orig/arch/x86/mm/ioremap.c 2008-04-25 23:17:31.872390404 -0700
+++ linux-2.6.25-mm1/arch/x86/mm/ioremap.c 2008-04-25 23:37:43.202391820 -0700
@@ -25,6 +25,7 @@

unsigned long __phys_addr(unsigned long x)
{
+ VM_BUG_ON(is_vmalloc_addr((void *)x));
if (x >= __START_KERNEL_map)
return x - __START_KERNEL_map + phys_base;
return x - PAGE_OFFSET;
Index: linux-2.6.25-mm1/include/asm-x86/page_32.h
===================================================================
--- linux-2.6.25-mm1.orig/include/asm-x86/page_32.h 2008-04-25 23:17:31.882389317 -0700
+++ linux-2.6.25-mm1/include/asm-x86/page_32.h 2008-04-25 23:37:43.202391820 -0700
@@ -64,7 +64,12 @@ typedef struct page *pgtable_t;
#endif

#ifndef __ASSEMBLY__
-#define __phys_addr(x) ((x) - PAGE_OFFSET)
+static inline unsigned long __phys_addr(unsigned long x)
+{
+ VM_BUG_ON(is_vmalloc_addr((void *)x));
+ return x - PAGE_OFFSET;
+}
+
#define __phys_reloc_hide(x) RELOC_HIDE((x), 0)

#ifdef CONFIG_FLATMEM

\
 
 \ /
  Last update: 2008-04-28 22:27    [W:0.295 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site