VIRTUAL_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@xxxxxxx>

---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [PATCH 1/1] x86: fix text_poke
    ... But it just enables the old NUMA VIRTUAL_BUG_ONs, ... Add a CONFIG option to enable it as a BUG_ON again. ... +#ifdef CONFIG_DEBUG_VIRTUAL ...
    (Linux-Kernel)
  • Re: [PATCH -mm 13/25] Noreclaim LRU Infrastructure
    ... gradually more complex in the SMP cases where we are 3-4 levels deep in ... dozen different memories or so at various interconnect levels). ... We only do NUMA ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
    (Linux-Kernel)
  • Re: [PATCH -mm 13/25] Noreclaim LRU Infrastructure
    ... machines aren't even compiing the new code in. ... support for 4 memory zones and 64 NUMA ... dozen different memories or so at various interconnect levels). ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
    (Linux-Kernel)
  • Re: [PATCH] fs: fcntl_setlease defies lease_init assumptions
    ... the much higher expense than the test. ... Although - especially for NUMA - we're actually going ... and we were going to read from the "struct page" info regardless). ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
    (Linux-Kernel)
  • Re: [PATCH] memory hotplug: run lru_add_drain_all() on each cpu
    ... the per-cpu pagevec layout should be independent ... from NUMA or UNEVICTABLE_LRU, so I guess the right thing to do here ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)