All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@xensource.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Virtualization <virtualization@osdl.org>,
	Zachary Amsden <zach@vmware.com>,
	Xen-devel <xen-devel@lists.xensource.com>,
	Jeremy Fitzhardinge <jeremy@xensource.com>,
	Hollis Blanchard <hollisb@us.ibm.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Chris Wright <chrisw@sous-sol.org>,
	Ian Pratt <ian.pratt@xensource.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Gerd Hoffmann <kraxel@suse.de>,
	Christian Limpach <Christian.Limpach@cl.cam.ac.uk>,
	Christoph Lameter <clameter@sgi.com>
Subject: [PATCH 7 of 13] Make __FIXADDR_TOP variable to allow it to make space for a hypervisor
Date: Tue, 01 Aug 2006 13:00:45 -0700	[thread overview]
Message-ID: <b6c100bb5ca5e2839ac8.1154462445@ezr> (raw)
In-Reply-To: <patchbomb.1154462438@ezr>

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@suse.de>

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Gerd Hoffmann <kraxel@suse.de>



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

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)

  parent reply	other threads:[~2006-08-01 20:00 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-01 20:00 [PATCH 0 of 13] Basic infrastructure patches for a paravirtualized kernel Jeremy Fitzhardinge
2006-08-01 20:00 ` [PATCH 1 of 13] Add apply_to_page_range() which applies a function to a pte range Jeremy Fitzhardinge
2006-08-01 20:00 ` [PATCH 2 of 13] Remove locally-defined ldt structure in favour of standard type Jeremy Fitzhardinge
2006-08-01 20:00 ` [PATCH 3 of 13] Implement always-locked bit ops, for memory shared with an SMP hypervisor Jeremy Fitzhardinge
2006-08-01 20:00 ` [PATCH 4 of 13] Allow a kernel to not be in ring 0 Jeremy Fitzhardinge
2006-08-01 20:00 ` [PATCH 5 of 13] Replace sensitive instructions with macros Jeremy Fitzhardinge
2006-08-01 20:00 ` [PATCH 6 of 13] Roll all the cpuid asm into one __cpuid call Jeremy Fitzhardinge
2006-08-01 20:00 ` Jeremy Fitzhardinge [this message]
2006-08-01 20:00 ` [PATCH 8 of 13] Add a bootparameter to reserve high linear address space for hypervisors Jeremy Fitzhardinge
2006-08-01 21:47   ` Andi Kleen
2006-08-01 21:47     ` Andi Kleen
2006-08-02  0:48     ` Rusty Russell
2006-08-02  2:59       ` Andi Kleen
2006-08-02  2:59         ` Andi Kleen
2006-08-02  3:54         ` [Xen-devel] " Rusty Russell
2006-08-02  3:54           ` Rusty Russell
2006-08-02  4:21           ` [Xen-devel] " Andi Kleen
2006-08-02  4:33             ` Rusty Russell
2006-08-02  4:33               ` Rusty Russell
2006-08-02  4:36               ` [Xen-devel] " Andi Kleen
2006-08-02  4:36                 ` Andi Kleen
2006-08-02  5:20                 ` [Xen-devel] " Rusty Russell
2006-08-02  5:20                   ` Rusty Russell
2006-08-02  5:24                   ` [Xen-devel] " Andi Kleen
2006-08-02  5:24                     ` Andi Kleen
2006-08-02  9:06                     ` [PATCH 1/2] Allow early_param and identical __setup to exist Rusty Russell
2006-08-02  9:06                       ` Rusty Russell
2006-08-02  9:08                     ` [PATCH 2/2] Replace i386 open-coded cmdline parsing with early_param/parse_early_param Rusty Russell
2006-08-02  9:08                       ` Rusty Russell
2006-08-02  9:24                       ` Andi Kleen
2006-08-01 20:00 ` [PATCH 9 of 13] Remove the read hazard from the COW path in copy_one_pte Jeremy Fitzhardinge
2006-08-01 20:00 ` [PATCH 10 of 13] Change pte_clear_full to a more appropriately named pte_clear_not_present, Jeremy Fitzhardinge
2006-08-01 21:48   ` Andi Kleen
2006-08-01 20:00 ` [PATCH 11 of 13] Implement lazy MMU update hooks which are SMP safe for both direct and Jeremy Fitzhardinge
2006-08-01 20:00 ` [PATCH 12 of 13] Pass the mm struct into the pgd_free code so the mm is available here Jeremy Fitzhardinge
2006-08-02  3:14   ` Andi Kleen
2006-08-02  3:14     ` Andi Kleen
2006-08-02  6:25     ` [Xen-devel] " Zachary Amsden
2006-08-02  7:13       ` Chris Wright
2006-08-02  7:13         ` Chris Wright
2006-08-01 20:00 ` [PATCH 13 of 13] Put .note.* sections into a PT_NOTE segment in vmlinux Jeremy Fitzhardinge
2006-08-22 11:14   ` [PATCH 1 of 1] x86_43: " Ian Campbell
2006-08-22 11:14     ` Ian Campbell
2006-08-22 11:33     ` Andi Kleen
2006-08-22 11:33       ` Andi Kleen
2006-08-22 11:43       ` Ian Campbell
2006-08-22 11:43         ` Ian Campbell
2006-08-02  3:18 ` [PATCH 0 of 13] Basic infrastructure patches for a paravirtualized kernel Andi Kleen
2006-08-02  3:18   ` Andi Kleen
     [not found] <patchbomb.1154421371@ezr.goop.org>
     [not found] ` <b6c100bb5ca5e2839ac8.1154421378@ezr.goop.org>
2006-08-01  9:03   ` [PATCH 7 of 13] Make __FIXADDR_TOP variable to allow it to make space for a hypervisor Chris Wright
2006-08-01 14:34     ` Andrew Morton
2006-08-01 21:37       ` Chris Wright
2006-08-02  1:47         ` Rusty Russell
2006-08-02  7:01           ` Chris Wright
2006-08-02  7:20             ` Rusty Russell
2006-08-02  8:26               ` Chris Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6c100bb5ca5e2839ac8.1154462445@ezr \
    --to=jeremy@xensource.com \
    --cc=Christian.Limpach@cl.cam.ac.uk \
    --cc=akpm@osdl.org \
    --cc=chrisw@sous-sol.org \
    --cc=clameter@sgi.com \
    --cc=ebiederm@xmission.com \
    --cc=hollisb@us.ibm.com \
    --cc=ian.pratt@xensource.com \
    --cc=kraxel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@osdl.org \
    --cc=xen-devel@lists.xensource.com \
    --cc=zach@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.