WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 7 of 13] Make __FIXADDR_TOP variable to allow it to m

To: Andrew Morton <akpm@xxxxxxxx>
Subject: [Xen-devel] [PATCH 7 of 13] Make __FIXADDR_TOP variable to allow it to make space for a hypervisor
From: Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
Date: Tue, 01 Aug 2006 13:00:45 -0700
Cc: Virtualization <virtualization@xxxxxxxx>, Zachary Amsden <zach@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>, Hollis Blanchard <hollisb@xxxxxxxxxx>, Rusty Russell <rusty@xxxxxxxxxxxxxxx>, Linux Kernel <linux-kernel@xxxxxxxxxxxxxxx>, Chris Wright <chrisw@xxxxxxxxxxxx>, Ian Pratt <ian.pratt@xxxxxxxxxxxxx>, "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxx>, Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>, Christoph Lameter <clameter@xxxxxxx>
Delivery-date: Tue, 01 Aug 2006 13:24:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1154462438@ezr>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
5 files changed, 68 insertions(+), 2 deletions(-)
arch/i386/Kconfig         |    1 +
arch/i386/mm/init.c       |   42 ++++++++++++++++++++++++++++++++++++++++++
arch/i386/mm/pgtable.c    |   18 ++++++++++++++++++
include/asm-i386/fixmap.h |    7 ++++++-
include/asm-i386/page.h   |    2 +-


Make __FIXADDR_TOP a variable, so that it can be set to not get in the
way of address space a hypervisor may want to reserve.

Original patch by Gerd Hoffmann <kraxel@xxxxxxx>

Signed-off-by: Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
Cc: Gerd Hoffmann <kraxel@xxxxxxx>



===================================================================

diff -r 730b4fe6bc1e -r b6c100bb5ca5 arch/i386/Kconfig
--- a/arch/i386/Kconfig Tue Aug 01 01:32:00 2006 -0700
+++ b/arch/i386/Kconfig Tue Aug 01 01:32:00 2006 -0700
@@ -792,6 +792,7 @@ config COMPAT_VDSO
 config COMPAT_VDSO
        bool "Compat VDSO support"
        default y
+       depends on !PARAVIRT
        help
          Map the VDSO to the predictable old-style address too.
        ---help---
diff -r 730b4fe6bc1e -r b6c100bb5ca5 arch/i386/mm/init.c
--- a/arch/i386/mm/init.c       Tue Aug 01 01:32:00 2006 -0700
+++ b/arch/i386/mm/init.c       Tue Aug 01 01:32:00 2006 -0700
@@ -629,6 +629,48 @@ void __init mem_init(void)
                (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))
               );
 
+#if 1 /* double-sanity-check paranoia */
+       printk("virtual kernel memory layout:\n"
+              "    fixmap  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
+#ifdef CONFIG_HIGHMEM
+              "    pkmap   : 0x%08lx - 0x%08lx   (%4ld kB)\n"
+#endif
+              "    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
+              "    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB)\n"
+              "      .init : 0x%08lx - 0x%08lx   (%4ld kB)\n"
+              "      .data : 0x%08lx - 0x%08lx   (%4ld kB)\n"
+              "      .text : 0x%08lx - 0x%08lx   (%4ld kB)\n",
+              FIXADDR_START, FIXADDR_TOP,
+              (FIXADDR_TOP - FIXADDR_START) >> 10,
+
+#ifdef CONFIG_HIGHMEM
+              PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
+              (LAST_PKMAP*PAGE_SIZE) >> 10,
+#endif
+
+              VMALLOC_START, VMALLOC_END,
+              (VMALLOC_END - VMALLOC_START) >> 20,
+
+              (unsigned long)__va(0), (unsigned long)high_memory,
+              ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
+
+              (unsigned long)&__init_begin, (unsigned long)&__init_end,
+              ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 
10,
+
+              (unsigned long)&_etext, (unsigned long)&_edata,
+              ((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
+
+              (unsigned long)&_text, (unsigned long)&_etext,
+              ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
+
+#ifdef CONFIG_HIGHMEM
+       BUG_ON(PKMAP_BASE+LAST_PKMAP*PAGE_SIZE > FIXADDR_START);
+       BUG_ON(VMALLOC_END                     > PKMAP_BASE);
+#endif
+       BUG_ON(VMALLOC_START                   > VMALLOC_END);
+       BUG_ON((unsigned long)high_memory      > VMALLOC_START);
+#endif /* double-sanity-check paranoia */
+
 #ifdef CONFIG_X86_PAE
        if (!cpu_has_pae)
                panic("cannot execute a PAE-enabled kernel on a PAE-less CPU!");
diff -r 730b4fe6bc1e -r b6c100bb5ca5 arch/i386/mm/pgtable.c
--- a/arch/i386/mm/pgtable.c    Tue Aug 01 01:32:00 2006 -0700
+++ b/arch/i386/mm/pgtable.c    Tue Aug 01 01:32:00 2006 -0700
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/pagemap.h>
 #include <linux/spinlock.h>
+#include <linux/module.h>
 
 #include <asm/system.h>
 #include <asm/pgtable.h>
@@ -137,6 +138,12 @@ void set_pmd_pfn(unsigned long vaddr, un
        __flush_tlb_one(vaddr);
 }
 
+static int fixmaps = 0;
+#ifndef CONFIG_COMPAT_VDSO
+unsigned long __FIXADDR_TOP = 0xfffff000;
+EXPORT_SYMBOL(__FIXADDR_TOP);
+#endif
+
 void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t 
flags)
 {
        unsigned long address = __fix_to_virt(idx);
@@ -146,6 +153,17 @@ void __set_fixmap (enum fixed_addresses 
                return;
        }
        set_pte_pfn(address, phys >> PAGE_SHIFT, flags);
+       fixmaps++;
+}
+
+void set_fixaddr_top(unsigned long top)
+{
+       BUG_ON(fixmaps > 0);
+#ifdef CONFIG_COMPAT_VDSO
+       BUG_ON(top - PAGE_SIZE != __FIXADDR_TOP);
+#else
+       __FIXADDR_TOP = top - PAGE_SIZE;
+#endif
 }
 
 pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
diff -r 730b4fe6bc1e -r b6c100bb5ca5 include/asm-i386/fixmap.h
--- a/include/asm-i386/fixmap.h Tue Aug 01 01:32:00 2006 -0700
+++ b/include/asm-i386/fixmap.h Tue Aug 01 01:32:00 2006 -0700
@@ -19,7 +19,11 @@
  * Leave one empty page between vmalloc'ed areas and
  * the start of the fixmap.
  */
-#define __FIXADDR_TOP  0xfffff000
+#ifndef CONFIG_COMPAT_VDSO
+extern unsigned long __FIXADDR_TOP;
+#else
+#define __FIXADDR_TOP  0xfffff000
+#endif
 
 #ifndef __ASSEMBLY__
 #include <linux/kernel.h>
@@ -93,6 +97,7 @@ enum fixed_addresses {
 
 extern void __set_fixmap (enum fixed_addresses idx,
                                        unsigned long phys, pgprot_t flags);
+extern void set_fixaddr_top(unsigned long top);
 
 #define set_fixmap(idx, phys) \
                __set_fixmap(idx, phys, PAGE_KERNEL)
diff -r 730b4fe6bc1e -r b6c100bb5ca5 include/asm-i386/page.h
--- a/include/asm-i386/page.h   Tue Aug 01 01:32:00 2006 -0700
+++ b/include/asm-i386/page.h   Tue Aug 01 01:32:00 2006 -0700
@@ -122,7 +122,7 @@ extern int page_is_ram(unsigned long pag
 
 #define PAGE_OFFSET            ((unsigned long)__PAGE_OFFSET)
 #define VMALLOC_RESERVE                ((unsigned long)__VMALLOC_RESERVE)
-#define MAXMEM                 (-__PAGE_OFFSET-__VMALLOC_RESERVE)
+#define MAXMEM                 (__FIXADDR_TOP-__PAGE_OFFSET-__VMALLOC_RESERVE)
 #define __pa(x)                        ((unsigned long)(x)-PAGE_OFFSET)
 #define __va(x)                        ((void *)((unsigned 
long)(x)+PAGE_OFFSET))
 #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>