public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH,experimental] i386 Allow the fixmap to be relocated at boot time
@ 2005-08-05 23:28 Zachary Amsden
  2005-08-05 23:46 ` [PATCH, experimental] " Chris Wright
  0 siblings, 1 reply; 5+ messages in thread
From: Zachary Amsden @ 2005-08-05 23:28 UTC (permalink / raw)
  To: Linux Kernel Mailing List, virtualization, xen-devel

[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]

This most curious patch allows the fixmap on i386 to be unfixed.  The 
result is that we can create a dynamically sizable hole at the top of 
kernel linear address space.  I know at least some virtualization 
developers are interested in being able to achieve this to achieve 
run-time sizing of a hole in which a hypervisor can live, or at least to 
test out the performance characteristics of different sized holes.

I have not run any performance numbers yet to see how much the cost of 
making this dynamic affects native performance, but again I would stress 
this is a highly experimental patch and I am looking for feedback and 
any performance data from other systems that people are kind enough to 
share.  I'm not advocating that this get pushed into the mainline Linux 
tree at this point by any means!

I believe at least the Xen folks would be interested in playing around 
with this for experimenting with different MPT and frame table sizes for 
PAE support in a way that doesn't require recompiling the Linux guest 
each time - if the performance impact proves to be negligble, this gives 
a lot of flexibility to any virtual machine which runs a hypervisor 
aware kernel.

Although I did as much as possible to make the vsyscall relocation 
appear clean to userspace, I can't guarantee this patch won't set fire 
to your chair and electrocute your cat.  Please move all pets to a safe 
location before attempting to use this.

Zachary Amsden <zach@vmware.com>

[-- Attachment #2: linear-hole --]
[-- Type: text/plain, Size: 9261 bytes --]

Allow creation of an compile time hole at the top of linear address space.

Extended to allow a dynamic hole in linear address space, 7/2005.  This
required some serious hacking to get everything perfect, but the end result
appears to function quite nicely.  Everyone can now share the appreciation
of pseudo-undocumented ELF OS fields, which means core dumps, debuggers
and even broken or obsolete linkers may continue to work.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Index: linux-2.6.13/arch/i386/Kconfig
===================================================================
--- linux-2.6.13.orig/arch/i386/Kconfig	2005-08-04 14:14:24.000000000 -0700
+++ linux-2.6.13/arch/i386/Kconfig	2005-08-05 15:28:42.000000000 -0700
@@ -127,6 +127,20 @@
 
 endchoice
 
+config RELOCATABLE_FIXMAP
+	bool "Allow the fixmap to be placed dynamically at runtime"
+	depends on EXPERIMENTAL
+	help
+	  Crazy hackers only.
+
+config MEMORY_HOLE
+	int "Create hole at top of memory (0-512 MB)"
+	range 0 512
+	default "0"
+	help
+	  Useful for creating a hole in the top of memory when running
+	  inside of a virtual machine monitor.
+
 config ACPI_SRAT
 	bool
 	default y
Index: linux-2.6.13/arch/i386/kernel/sysenter.c
===================================================================
--- linux-2.6.13.orig/arch/i386/kernel/sysenter.c	2005-08-02 17:04:12.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/sysenter.c	2005-08-05 15:47:53.000000000 -0700
@@ -46,22 +46,90 @@
 extern const char vsyscall_int80_start, vsyscall_int80_end;
 extern const char vsyscall_sysenter_start, vsyscall_sysenter_end;
 
+#ifdef CONFIG_RELOCATABLE_FIXMAP
+extern const char SYSENTER_RETURN;
+const char *SYSENTER_RETURN_ADDR;
+
+static void fixup_vsyscall_elf(char *page)
+{
+	Elf32_Ehdr *hdr;
+	Elf32_Shdr *sechdrs;
+	Elf32_Phdr *phdr;
+	char *secstrings;
+	int i, j, n;
+
+	hdr = (Elf32_Ehdr *)page;
+
+	/* Sanity checks against insmoding binaries or wrong arch,
+           weird elf version */
+	if (memcmp(hdr->e_ident, ELFMAG, 4) != 0 ||
+		!elf_check_arch(hdr) ||
+		hdr->e_type != ET_DYN)
+		panic("Bogus ELF in vsyscall DSO\n");
+
+	hdr->e_entry += VSYSCALL_RELOCATION;
+
+	sechdrs = (void *)hdr + hdr->e_shoff;
+	secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
+
+	for (i = 1; i < hdr->e_shnum; i++) {
+		if (!(sechdrs[i].sh_flags & SHF_ALLOC))
+			continue;
+
+		sechdrs[i].sh_addr += VSYSCALL_RELOCATION;
+		if (strcmp(secstrings+sechdrs[i].sh_name, ".dynsym") == 0) {
+			Elf32_Sym  *sym =  (void *)hdr + sechdrs[i].sh_offset;
+			n = sechdrs[i].sh_size / sizeof(*sym);
+			for (j = 1; j < n;  j++) {
+				int ndx = sym[j].st_shndx;
+				if (ndx == SHN_UNDEF || ndx == SHN_ABS)
+					continue;
+				sym[j].st_value += VSYSCALL_RELOCATION;
+			}
+		} else if (strcmp(secstrings+sechdrs[i].sh_name, ".dynamic") == 0) {
+			Elf32_Dyn *dyn = (void *)hdr + sechdrs[i].sh_offset;
+			int tag;
+			while ((tag = (++dyn)->d_tag) != DT_NULL) {
+				if (tag == DT_PLTGOT || tag == DT_HASH ||
+				    tag == DT_STRTAB || tag == DT_SYMTAB ||
+				    tag == DT_RELA || tag == DT_INIT ||
+				    tag == DT_FINI || tag == DT_REL ||
+				    tag == DT_JMPREL || tag == DT_VERSYM ||
+				    tag == DT_VERDEF || tag == DT_VERNEED)
+					dyn->d_un.d_val += VSYSCALL_RELOCATION;
+			}
+		} else if (strcmp(secstrings+sechdrs[i].sh_name, ".useless") == 0) {
+			uint32_t *got = (void *)hdr + sechdrs[i].sh_offset;
+			*got += VSYSCALL_RELOCATION;
+		}
+	}
+	phdr = (void *)hdr + hdr->e_phoff;
+	for (i = 0; i < hdr->e_phnum; i++) {
+		phdr[i].p_vaddr += VSYSCALL_RELOCATION;
+		phdr[i].p_paddr += VSYSCALL_RELOCATION;
+	}
+	SYSENTER_RETURN_ADDR = (char *)&SYSENTER_RETURN + VSYSCALL_RELOCATION;
+}
+#endif
+
 int __init sysenter_setup(void)
 {
 	void *page = (void *)get_zeroed_page(GFP_ATOMIC);
 
-	__set_fixmap(FIX_VSYSCALL, __pa(page), PAGE_READONLY_EXEC);
-
-	if (!boot_cpu_has(X86_FEATURE_SEP)) {
+	if (!boot_cpu_has(X86_FEATURE_SEP))
 		memcpy(page,
 		       &vsyscall_int80_start,
 		       &vsyscall_int80_end - &vsyscall_int80_start);
-		return 0;
-	}
+	else
+		memcpy(page,
+			&vsyscall_sysenter_start,
+			&vsyscall_sysenter_end - &vsyscall_sysenter_start);
 
-	memcpy(page,
-	       &vsyscall_sysenter_start,
-	       &vsyscall_sysenter_end - &vsyscall_sysenter_start);
+#ifdef CONFIG_RELOCATABLE_FIXMAP
+	fixup_vsyscall_elf((char *)page);
+#endif
+
+	__set_fixmap(FIX_VSYSCALL, __pa(page), PAGE_READONLY_EXEC);
 
 	return 0;
 }
Index: linux-2.6.13/arch/i386/kernel/asm-offsets.c
===================================================================
--- linux-2.6.13.orig/arch/i386/kernel/asm-offsets.c	2005-08-04 14:28:35.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/asm-offsets.c	2005-08-05 15:11:45.000000000 -0700
@@ -68,5 +68,9 @@
 		 sizeof(struct tss_struct));
 
 	DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
+#ifdef CONFIG_RELOCATABLE_FIXMAP
+	DEFINE(VSYSCALL_BASE, 0);
+#else
 	DEFINE(VSYSCALL_BASE, __fix_to_virt(FIX_VSYSCALL));
+#endif
 }
Index: linux-2.6.13/arch/i386/kernel/signal.c
===================================================================
--- linux-2.6.13.orig/arch/i386/kernel/signal.c	2005-08-03 23:36:46.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/signal.c	2005-08-05 15:11:33.000000000 -0700
@@ -345,6 +345,8 @@
    See vsyscall-sigreturn.S.  */
 extern void __user __kernel_sigreturn;
 extern void __user __kernel_rt_sigreturn;
+#define kernel_sigreturn  (VSYSCALL_RELOCATION + (void __user *)&__kernel_sigreturn)
+#define kernel_rt_sigreturn  (VSYSCALL_RELOCATION + (void __user *)&__kernel_rt_sigreturn)
 
 static int setup_frame(int sig, struct k_sigaction *ka,
 		       sigset_t *set, struct pt_regs * regs)
@@ -380,7 +382,7 @@
 			goto give_sigsegv;
 	}
 
-	restorer = &__kernel_sigreturn;
+	restorer = kernel_sigreturn;
 	if (ka->sa.sa_flags & SA_RESTORER)
 		restorer = ka->sa.sa_restorer;
 
@@ -476,7 +478,7 @@
 		goto give_sigsegv;
 
 	/* Set up to return from userspace.  */
-	restorer = &__kernel_rt_sigreturn;
+	restorer = kernel_rt_sigreturn;
 	if (ka->sa.sa_flags & SA_RESTORER)
 		restorer = ka->sa.sa_restorer;
 	err |= __put_user(restorer, &frame->pretcode);
Index: linux-2.6.13/arch/i386/kernel/entry.S
===================================================================
--- linux-2.6.13.orig/arch/i386/kernel/entry.S	2005-08-04 14:17:15.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/entry.S	2005-08-05 14:09:15.000000000 -0700
@@ -200,7 +200,11 @@
 	pushl %ebp
 	pushfl
 	pushl $(__USER_CS)
+#ifdef CONFIG_RELOCATABLE_FIXMAP
+	pushl %ss:SYSENTER_RETURN_ADDR
+#else
 	pushl $SYSENTER_RETURN
+#endif
 
 /*
  * Load the potential sixth argument from user stack.
Index: linux-2.6.13/arch/i386/mm/init.c
===================================================================
--- linux-2.6.13.orig/arch/i386/mm/init.c	2005-08-04 14:39:17.000000000 -0700
+++ linux-2.6.13/arch/i386/mm/init.c	2005-08-05 15:20:04.000000000 -0700
@@ -42,6 +42,10 @@
 
 unsigned int __VMALLOC_RESERVE = 128 << 20;
 
+#ifdef CONFIG_RELOCATABLE_FIXMAP
+unsigned long __FIXADDR_TOP = 0;
+#endif
+
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 unsigned long highstart_pfn, highend_pfn;
 
@@ -478,6 +482,12 @@
 		printk("NX (Execute Disable) protection: active\n");
 #endif
 
+#ifdef CONFIG_RELOCATABLE_FIXMAP
+	if (!__FIXADDR_TOP) 
+		__FIXADDR_TOP =  0xfffff000UL-(CONFIG_MEMORY_HOLE << 20);
+	printk(KERN_INFO "Fixmap top relocated to %lxh\n", __FIXADDR_TOP);
+#endif
+
 	pagetable_init();
 
 	load_cr3(swapper_pg_dir);
Index: linux-2.6.13/include/asm-i386/fixmap.h
===================================================================
--- linux-2.6.13.orig/include/asm-i386/fixmap.h	2005-08-04 14:14:24.000000000 -0700
+++ linux-2.6.13/include/asm-i386/fixmap.h	2005-08-05 15:36:13.000000000 -0700
@@ -20,7 +20,13 @@
  * Leave one empty page between vmalloc'ed areas and
  * the start of the fixmap.
  */
-#define __FIXADDR_TOP	0xfffff000
+#ifdef CONFIG_RELOCATABLE_FIXMAP
+extern unsigned long __FIXADDR_TOP;
+#define VSYSCALL_RELOCATION __fix_to_virt(FIX_VSYSCALL)
+#else
+#define __FIXADDR_TOP	(0xfffff000-(CONFIG_MEMORY_HOLE << 20))
+#define VSYSCALL_RELOCATION 0
+#endif
 
 #ifndef __ASSEMBLY__
 #include <linux/kernel.h>
Index: linux-2.6.13/include/asm-i386/elf.h
===================================================================
--- linux-2.6.13.orig/include/asm-i386/elf.h	2005-08-02 17:06:23.000000000 -0700
+++ linux-2.6.13/include/asm-i386/elf.h	2005-08-05 15:31:32.000000000 -0700
@@ -129,7 +129,7 @@
 
 #define VSYSCALL_BASE	(__fix_to_virt(FIX_VSYSCALL))
 #define VSYSCALL_EHDR	((const struct elfhdr *) VSYSCALL_BASE)
-#define VSYSCALL_ENTRY	((unsigned long) &__kernel_vsyscall)
+#define VSYSCALL_ENTRY	((unsigned long) (VSYSCALL_RELOCATION+&__kernel_vsyscall))
 extern void __kernel_vsyscall;
 
 #define ARCH_DLINFO						\
Index: linux-2.6.13/include/linux/elf.h
===================================================================
--- linux-2.6.13.orig/include/linux/elf.h	2005-08-02 17:06:24.000000000 -0700
+++ linux-2.6.13/include/linux/elf.h	2005-08-05 12:06:17.000000000 -0700
@@ -138,6 +138,9 @@
 #define DT_DEBUG	21
 #define DT_TEXTREL	22
 #define DT_JMPREL	23
+#define DT_VERSYM	0x6ffffff0
+#define DT_VERDEF	0x6ffffffc
+#define DT_VERNEED	0x6ffffffe
 #define DT_LOPROC	0x70000000
 #define DT_HIPROC	0x7fffffff
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, experimental] i386 Allow the fixmap to be relocated at boot time
  2005-08-05 23:28 [PATCH,experimental] i386 Allow the fixmap to be relocated at boot time Zachary Amsden
@ 2005-08-05 23:46 ` Chris Wright
  2005-08-06  0:09   ` Zachary Amsden
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wright @ 2005-08-05 23:46 UTC (permalink / raw)
  To: Zachary Amsden; +Cc: Linux Kernel Mailing List, virtualization, xen-devel

* Zachary Amsden (zach@vmware.com) wrote:
> This most curious patch allows the fixmap on i386 to be unfixed.  The 
> result is that we can create a dynamically sizable hole at the top of 
> kernel linear address space.  I know at least some virtualization 
> developers are interested in being able to achieve this to achieve 
> run-time sizing of a hole in which a hypervisor can live, or at least to 
> test out the performance characteristics of different sized holes.

I've done it simpler with keeping it fixed but defined by the subarch.
Patch is stupid simple (and untested).  Do you think there's a huge gain
for dynamically sizing?

--- linux-2.6.12/include/asm-i386/fixmap.h	2005-06-17 12:48:29.000000000 -0700
+++ linux-2.6.12-subarch/include/asm-i386/fixmap.h	2005-08-01 15:27:05.000000000 -0700
@@ -15,82 +15,9 @@
 
 #include <linux/config.h>
 
-/* used by vmalloc.c, vsyscall.lds.S.
- *
- * Leave one empty page between vmalloc'ed areas and
- * the start of the fixmap.
- */
-#define __FIXADDR_TOP	0xfffff000
+#include <mach_fixmap.h>
 
 #ifndef __ASSEMBLY__
-#include <linux/kernel.h>
-#include <asm/acpi.h>
-#include <asm/apicdef.h>
-#include <asm/page.h>
-#ifdef CONFIG_HIGHMEM
-#include <linux/threads.h>
-#include <asm/kmap_types.h>
-#endif
-
-/*
- * Here we define all the compile-time 'special' virtual
- * addresses. The point is to have a constant address at
- * compile time, but to set the physical address only
- * in the boot process. We allocate these special addresses
- * from the end of virtual memory (0xfffff000) backwards.
- * Also this lets us do fail-safe vmalloc(), we
- * can guarantee that these special addresses and
- * vmalloc()-ed addresses never overlap.
- *
- * these 'compile-time allocated' memory buffers are
- * fixed-size 4k pages. (or larger if used with an increment
- * highger than 1) use fixmap_set(idx,phys) to associate
- * physical memory with fixmap indices.
- *
- * TLB entries of such buffers will not be flushed across
- * task switches.
- */
-enum fixed_addresses {
-	FIX_HOLE,
-	FIX_VSYSCALL,
-#ifdef CONFIG_X86_LOCAL_APIC
-	FIX_APIC_BASE,	/* local (CPU) APIC) -- required for SMP or not */
-#endif
-#ifdef CONFIG_X86_IO_APIC
-	FIX_IO_APIC_BASE_0,
-	FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
-#endif
-#ifdef CONFIG_X86_VISWS_APIC
-	FIX_CO_CPU,	/* Cobalt timer */
-	FIX_CO_APIC,	/* Cobalt APIC Redirection Table */ 
-	FIX_LI_PCIA,	/* Lithium PCI Bridge A */
-	FIX_LI_PCIB,	/* Lithium PCI Bridge B */
-#endif
-#ifdef CONFIG_X86_F00F_BUG
-	FIX_F00F_IDT,	/* Virtual mapping for IDT */
-#endif
-#ifdef CONFIG_X86_CYCLONE_TIMER
-	FIX_CYCLONE_TIMER, /*cyclone timer register*/
-#endif 
-#ifdef CONFIG_HIGHMEM
-	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
-	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
-#endif
-#ifdef CONFIG_ACPI_BOOT
-	FIX_ACPI_BEGIN,
-	FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
-#endif
-#ifdef CONFIG_PCI_MMCONFIG
-	FIX_PCIE_MCFG,
-#endif
-	__end_of_permanent_fixed_addresses,
-	/* temporary boot-time mappings, used before ioremap() is functional */
-#define NR_FIX_BTMAPS	16
-	FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
-	FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS - 1,
-	FIX_WP_TEST,
-	__end_of_fixed_addresses
-};
 
 extern void __set_fixmap (enum fixed_addresses idx,
 					unsigned long phys, pgprot_t flags);
--- linux-2.6.12/include/asm-i386/mach-default/mach_fixmap.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.6.12-subarch/include/asm-i386/mach-default/mach_fixmap.h	2005-08-01 15:27:44.000000000 -0700
@@ -0,0 +1,93 @@
+/*
+ * mach_fixmap.h: mach dependent fixmap split out from fixmap.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1998 Ingo Molnar
+ *
+ * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
+ */
+
+#ifndef _ASM_MACH_FIXMAP_H
+#define _ASM_MACH_FIXMAP_H
+
+/* used by vmalloc.c, vsyscall.lds.S.
+ *
+ * Leave one empty page between vmalloc'ed areas and
+ * the start of the fixmap.
+ */
+#define __FIXADDR_TOP	0xfffff000
+
+#ifndef __ASSEMBLY__
+#include <linux/kernel.h>
+#include <asm/acpi.h>
+#include <asm/apicdef.h>
+#include <asm/page.h>
+#ifdef CONFIG_HIGHMEM
+#include <linux/threads.h>
+#include <asm/kmap_types.h>
+#endif
+/*
+ * Here we define all the compile-time 'special' virtual
+ * addresses. The point is to have a constant address at
+ * compile time, but to set the physical address only
+ * in the boot process. We allocate these special addresses
+ * from the end of virtual memory (0xfffff000) backwards.
+ * Also this lets us do fail-safe vmalloc(), we
+ * can guarantee that these special addresses and
+ * vmalloc()-ed addresses never overlap.
+ *
+ * these 'compile-time allocated' memory buffers are
+ * fixed-size 4k pages. (or larger if used with an increment
+ * highger than 1) use fixmap_set(idx,phys) to associate
+ * physical memory with fixmap indices.
+ *
+ * TLB entries of such buffers will not be flushed across
+ * task switches.
+ */
+enum fixed_addresses {
+	FIX_HOLE,
+	FIX_VSYSCALL,
+#ifdef CONFIG_X86_LOCAL_APIC
+	FIX_APIC_BASE,	/* local (CPU) APIC) -- required for SMP or not */
+#endif
+#ifdef CONFIG_X86_IO_APIC
+	FIX_IO_APIC_BASE_0,
+	FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
+#endif
+#ifdef CONFIG_X86_VISWS_APIC
+	FIX_CO_CPU,	/* Cobalt timer */
+	FIX_CO_APIC,	/* Cobalt APIC Redirection Table */ 
+	FIX_LI_PCIA,	/* Lithium PCI Bridge A */
+	FIX_LI_PCIB,	/* Lithium PCI Bridge B */
+#endif
+#ifdef CONFIG_X86_F00F_BUG
+	FIX_F00F_IDT,	/* Virtual mapping for IDT */
+#endif
+#ifdef CONFIG_X86_CYCLONE_TIMER
+	FIX_CYCLONE_TIMER, /*cyclone timer register*/
+#endif 
+#ifdef CONFIG_HIGHMEM
+	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
+	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
+#endif
+#ifdef CONFIG_ACPI_BOOT
+	FIX_ACPI_BEGIN,
+	FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
+#endif
+#ifdef CONFIG_PCI_MMCONFIG
+	FIX_PCIE_MCFG,
+#endif
+	__end_of_permanent_fixed_addresses,
+	/* temporary boot-time mappings, used before ioremap() is functional */
+#define NR_FIX_BTMAPS	16
+	FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
+	FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS - 1,
+	FIX_WP_TEST,
+	__end_of_fixed_addresses
+};
+
+#endif /* !__ASSEMBLY__ */
+#endif

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, experimental] i386 Allow the fixmap to be relocated at boot time
  2005-08-05 23:46 ` [PATCH, experimental] " Chris Wright
@ 2005-08-06  0:09   ` Zachary Amsden
  2005-08-06  0:22     ` Chris Wright
  2005-08-06 12:48     ` Rusty Russell
  0 siblings, 2 replies; 5+ messages in thread
From: Zachary Amsden @ 2005-08-06  0:09 UTC (permalink / raw)
  To: Chris Wright; +Cc: Linux Kernel Mailing List, virtualization, xen-devel

Chris Wright wrote:

>* Zachary Amsden (zach@vmware.com) wrote:
>  
>
>>This most curious patch allows the fixmap on i386 to be unfixed.  The 
>>result is that we can create a dynamically sizable hole at the top of 
>>kernel linear address space.  I know at least some virtualization 
>>developers are interested in being able to achieve this to achieve 
>>run-time sizing of a hole in which a hypervisor can live, or at least to 
>>test out the performance characteristics of different sized holes.
>>    
>>
>
>I've done it simpler with keeping it fixed but defined by the subarch.
>Patch is stupid simple (and untested).  Do you think there's a huge gain
>for dynamically sizing?
>

Your patch looks good, although the minimal change to subarch is to 
merely have __FIXADDR_TOP defined by the sub-architecture.  Is there any 
additional benefit to moving the fixmaps into the subarch - i.e. moving 
subarch-specific pieces out of mach-default?

I guess there is.  For example include/asm-i386/mach-visws/mach_fixmap.h 
could do this:

#define SUBARCH_FIXMAPS \
        FIX_CO_CPU,     /* Cobalt timer */ \
        FIX_CO_APIC,    /* Cobalt APIC Redirection Table */ \
        FIX_LI_PCIA,    /* Lithium PCI Bridge A */ \
        FIX_LI_PCIB,    /* Lithium PCI Bridge B */

Then include/asm-i386/fixmap.h includes <mach_fixmap.h>, for which the 
default is an empty define for SUBARCH_FIXMAPS.

And then you don't have to maintain the list of common fixmaps across 
the sub-architecture layer or uglify the top level fixmaps with SGI 
Visual Workstation support.

Also, it seems reasonable that people may want to poke holes in high 
linear space for other hypervisor projects, research, or performance 
reasons without having to build a custom sub-architecture just for 
that.  So I think there is some benefit to making the hole size a 
general configurable option (with defaults depending on the sub-arch you 
select).

I have no idea if the dynamic sizing has any performance impact yet, but 
it may be a big win in terms of flexibility.  I would be curious to hear 
more from the Xen core team (I know Ian mentioned he would like to try 
this out at one point in time).

Zach

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, experimental] i386 Allow the fixmap to be relocated at boot time
  2005-08-06  0:09   ` Zachary Amsden
@ 2005-08-06  0:22     ` Chris Wright
  2005-08-06 12:48     ` Rusty Russell
  1 sibling, 0 replies; 5+ messages in thread
From: Chris Wright @ 2005-08-06  0:22 UTC (permalink / raw)
  To: Zachary Amsden
  Cc: Chris Wright, Linux Kernel Mailing List, virtualization,
	xen-devel

* Zachary Amsden (zach@vmware.com) wrote:
> Your patch looks good, although the minimal change to subarch is to 
> merely have __FIXADDR_TOP defined by the sub-architecture.  Is there any 
> additional benefit to moving the fixmaps into the subarch - i.e. moving 
> subarch-specific pieces out of mach-default?

As you've identified, so subarch can put whatever wonky junk
it needs in there.

> I guess there is.  For example include/asm-i386/mach-visws/mach_fixmap.h 
> could do this:
> 
> #define SUBARCH_FIXMAPS \
>        FIX_CO_CPU,     /* Cobalt timer */ \
>        FIX_CO_APIC,    /* Cobalt APIC Redirection Table */ \
>        FIX_LI_PCIA,    /* Lithium PCI Bridge A */ \
>        FIX_LI_PCIB,    /* Lithium PCI Bridge B */
> 
> Then include/asm-i386/fixmap.h includes <mach_fixmap.h>, for which the 
> default is an empty define for SUBARCH_FIXMAPS.

nice.

> Also, it seems reasonable that people may want to poke holes in high 
> linear space for other hypervisor projects, research, or performance 
> reasons without having to build a custom sub-architecture just for 
> that.  So I think there is some benefit to making the hole size a 
> general configurable option (with defaults depending on the sub-arch you 
> select).

It needs to have tangible value for in-tree code.  Seems worthwhile to
play with it a bit though.

thanks,
-chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, experimental] i386 Allow the fixmap to be relocated at boot time
  2005-08-06  0:09   ` Zachary Amsden
  2005-08-06  0:22     ` Chris Wright
@ 2005-08-06 12:48     ` Rusty Russell
  1 sibling, 0 replies; 5+ messages in thread
From: Rusty Russell @ 2005-08-06 12:48 UTC (permalink / raw)
  To: Zachary Amsden
  Cc: Chris Wright, virtualization, xen-devel,
	Linux Kernel Mailing List

On Fri, 2005-08-05 at 17:09 -0700, Zachary Amsden wrote:
> Also, it seems reasonable that people may want to poke holes in high 
> linear space for other hypervisor projects, research, or performance 
> reasons without having to build a custom sub-architecture just for 
> that.  So I think there is some benefit to making the hole size a 
> general configurable option (with defaults depending on the sub-arch you 
> select).

qemu-fast needs a kernel with __FIXADDR_TOP 0xa7fff000, and PAGE_OFFSET
0x90000000.  I used to continually patch my kernels, but these days I
just run full qemu and take the speed hit.  If this was easier, it would
be really nice to have that speed back.

Rusty.
-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-08-06 12:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-05 23:28 [PATCH,experimental] i386 Allow the fixmap to be relocated at boot time Zachary Amsden
2005-08-05 23:46 ` [PATCH, experimental] " Chris Wright
2005-08-06  0:09   ` Zachary Amsden
2005-08-06  0:22     ` Chris Wright
2005-08-06 12:48     ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox