All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] linux: eliminate E820 tables
@ 2006-05-11 13:17 Jan Beulich
  2006-05-11 18:23 ` Anthony Liguori
  2006-05-17 14:34 ` Andrew D. Ball
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Beulich @ 2006-05-11 13:17 UTC (permalink / raw)
  To: Xen-devel

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

.. to make clear that no relevant state is actually maintained in there and that, as a consequence, adjustments to
native Linux code in this area aren't applicable to the Xen kernels.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

[-- Attachment #2: xenlinux-x86-no-e820.patch --]
[-- Type: text/plain, Size: 8028 bytes --]

Index: head-2006-05-03/arch/i386/kernel/setup-xen.c
===================================================================
--- head-2006-05-03.orig/arch/i386/kernel/setup-xen.c	2006-05-08 16:04:28.000000000 +0200
+++ head-2006-05-03/arch/i386/kernel/setup-xen.c	2006-05-08 16:09:21.000000000 +0200
@@ -157,7 +157,9 @@ struct ist_info ist_info;
 	defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
 EXPORT_SYMBOL(ist_info);
 #endif
+#ifndef CONFIG_XEN
 struct e820map e820;
+#endif
 
 extern void early_cpu_init(void);
 extern void generic_apic_probe(char *);
@@ -399,6 +401,7 @@ EXPORT_SYMBOL(phys_to_machine_mapping);
 start_info_t *xen_start_info;
 EXPORT_SYMBOL(xen_start_info);
 
+#ifndef CONFIG_XEN
 static void __init limit_regions(unsigned long long size)
 {
 	unsigned long long current_addr = 0;
@@ -492,7 +495,6 @@ static void __init print_memory_map(char
 	}
 }
 
-#if 0
 /*
  * Sanitize the BIOS e820 map.
  *
@@ -747,7 +749,9 @@ static void __init parse_cmdline_early (
 {
 	char c = ' ', *to = command_line, *from = saved_command_line;
 	int len = 0, max_cmdline;
+#ifndef CONFIG_XEN
 	int userdef = 0;
+#endif
 
 	if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE)
 		max_cmdline = COMMAND_LINE_SIZE;
@@ -795,6 +799,7 @@ static void __init parse_cmdline_early (
 			}
 		}
 
+#ifndef CONFIG_XEN
 		else if (!memcmp(from, "memmap=", 7)) {
 			if (to != command_line)
 				to--;
@@ -836,6 +841,7 @@ static void __init parse_cmdline_early (
 				}
 			}
 		}
+#endif
 
 		else if (!memcmp(from, "noexec=", 7))
 			noexec_setup(from + 7);
@@ -978,10 +984,12 @@ static void __init parse_cmdline_early (
 	}
 	*to = '\0';
 	*cmdline_p = command_line;
+#ifndef CONFIG_XEN
 	if (userdef) {
 		printk(KERN_INFO "user-defined physical RAM map:\n");
 		print_memory_map("user");
 	}
+#endif
 }
 
 #if 0 /* !XEN */
@@ -1111,6 +1119,7 @@ unsigned long __init find_max_low_pfn(vo
 	return max_low_pfn;
 }
 
+#ifndef CONFIG_XEN
 /*
  * Free all available memory for boot time allocation.  Used
  * as a callback function by efi_memory_walk()
@@ -1129,11 +1138,14 @@ free_available_memory(unsigned long star
 
 	return 0;
 }
+#endif
+
 /*
  * Register fully available low RAM pages with the bootmem allocator.
  */
 static void __init register_bootmem_low_pages(unsigned long max_low_pfn)
 {
+#ifndef CONFIG_XEN
 	int i;
 
 	if (efi_enabled) {
@@ -1171,6 +1183,13 @@ static void __init register_bootmem_low_
 		size = last_pfn - curr_pfn;
 		free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
 	}
+#else
+	unsigned long size = xen_start_info->nr_pages;
+
+	if (size > max_low_pfn)
+		size = max_low_pfn;
+	free_bootmem(0, PFN_PHYS(size));
+#endif
 }
 
 #ifndef CONFIG_XEN
@@ -1699,12 +1718,14 @@ void __init setup_arch(char **cmdline_p)
 	setup_xen_features();
 
 	ARCH_SETUP
+#ifndef CONFIG_XEN
 	if (efi_enabled)
 		efi_init();
 	else {
 		printk(KERN_INFO "BIOS-provided physical RAM map:\n");
 		print_memory_map(machine_specific_memory_setup());
 	}
+#endif
 
 	copy_edd();
 
Index: head-2006-05-03/arch/x86_64/kernel/e820-xen.c
===================================================================
--- head-2006-05-03.orig/arch/x86_64/kernel/e820-xen.c	2006-05-03 09:39:54.000000000 +0200
+++ head-2006-05-03/arch/x86_64/kernel/e820-xen.c	2006-05-08 16:04:28.000000000 +0200
@@ -36,6 +36,7 @@ EXPORT_SYMBOL(end_pfn);
 unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT;  
 unsigned long end_pfn_map; 
 
+#ifndef CONFIG_XEN
 /* 
  * Add a memory region to the kernel e820 map.
  */ 
@@ -54,8 +55,6 @@ void __init add_memory_region(unsigned l
 	e820.nr_map++;
 }
 
-#ifndef CONFIG_XEN
-
 /* 
  * end_pfn only includes RAM, while end_pfn_map includes all e820 entries.
  * The direct mapping extends to end_pfn_map, so that we can directly access
@@ -278,6 +279,7 @@ int __init e820_all_mapped(unsigned long
 }
 #endif /* CONFIG_XEN */
 
+#ifndef CONFIG_XEN
 void __init e820_print_map(char *who)
 {
 	int i;
@@ -304,7 +304,6 @@ void __init e820_print_map(char *who)
 	}
 }
 
-#ifndef CONFIG_XEN
 /*
  * Sanitize the BIOS e820 map.
  *
@@ -562,7 +561,8 @@ void __init setup_memory_region(void)
 
 #else  /* CONFIG_XEN */
 
-extern unsigned long xen_override_max_pfn;
+/* Allows setting of maximum possible memory size  */
+static unsigned long xen_override_max_pfn;
 extern union xen_start_info_union xen_start_info_union;
 
 unsigned long __init e820_end_of_ram(void)
@@ -662,6 +662,7 @@ void __init parse_memopt(char *p, char *
 	xen_override_max_pfn = (unsigned long) end_user_pfn;
 } 
 
+#ifndef CONFIG_XEN
 void __init parse_memmapopt(char *p, char **from)
 {
 	unsigned long long start_at, mem_size;
@@ -682,6 +683,7 @@ void __init parse_memmapopt(char *p, cha
 	}
 	p = *from;
 }
+#endif
 
 /*
  * Search for the biggest gap in the low 32 bits of the e820
Index: head-2006-05-03/arch/x86_64/kernel/setup-xen.c
===================================================================
--- head-2006-05-03.orig/arch/x86_64/kernel/setup-xen.c	2006-05-08 16:04:28.000000000 +0200
+++ head-2006-05-03/arch/x86_64/kernel/setup-xen.c	2006-05-08 16:11:01.000000000 +0200
@@ -88,9 +88,6 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info);
 extern char hypercall_page[PAGE_SIZE];
 EXPORT_SYMBOL(hypercall_page);
 
-/* Allows setting of maximum possible memory size  */
-unsigned long xen_override_max_pfn;
-
 static int xen_panic_event(struct notifier_block *, unsigned long, void *);
 static struct notifier_block xen_panic_block = {
 	xen_panic_event, NULL, 0 /* try to go last */
@@ -142,7 +139,9 @@ struct sys_desc_table_struct {
 };
 
 struct edid_info edid_info;
+#ifndef CONFIG_XEN
 struct e820map e820;
+#endif
 
 extern int root_mountflags;
 
@@ -321,7 +320,9 @@ static __init void parse_cmdline_early (
 {
 	char c = ' ', *to = command_line, *from = COMMAND_LINE;
 	int len = 0;
+#ifndef CONFIG_XEN
 	int userdef = 0;
+#endif
 
 	for (;;) {
 		if (c != ' ') 
@@ -401,6 +402,7 @@ static __init void parse_cmdline_early (
 		if (!memcmp(from, "mem=", 4))
 			parse_memopt(from+4, &from); 
 
+#ifndef CONFIG_XEN
 		if (!memcmp(from, "memmap=", 7)) {
 			/* exactmap option is for used defined memory */
 			if (!memcmp(from+7, "exactmap", 8)) {
@@ -422,6 +424,7 @@ static __init void parse_cmdline_early (
 				userdef = 1;
 			}
 		}
+#endif
 
 #ifdef CONFIG_NUMA
 		if (!memcmp(from, "numa=", 5))
@@ -481,10 +484,12 @@ static __init void parse_cmdline_early (
 			break;
 		*(to++) = c;
 	}
+#ifndef CONFIG_XEN
 	if (userdef) {
 		printk(KERN_INFO "user-defined physical RAM map:\n");
 		e820_print_map("user");
 	}
+#endif
 	*to = '\0';
 	*cmdline_p = command_line;
 }
Index: head-2006-05-03/include/asm-i386/mach-xen/setup_arch_post.h
===================================================================
--- head-2006-05-03.orig/include/asm-i386/mach-xen/setup_arch_post.h	2006-04-24 11:43:43.000000000 +0200
+++ head-2006-05-03/include/asm-i386/mach-xen/setup_arch_post.h	2006-05-08 16:04:28.000000000 +0200
@@ -1,6 +1,4 @@
 /**
- * machine_specific_memory_setup - Hook for machine specific memory setup.
- *
  * Description:
  *	This is included late in kernel/setup.c so that it can make
  *	use of all of the static functions.
@@ -8,16 +8,6 @@
 
 #include <xen/interface/callback.h>
 
-static char * __init machine_specific_memory_setup(void)
-{
-	unsigned long max_pfn = xen_start_info->nr_pages;
-
-	e820.nr_map = 0;
-	add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
-
-	return "Xen";
-}
-
 extern void hypervisor_callback(void);
 extern void failsafe_callback(void);
 extern void nmi(void);
Index: head-2006-05-03/include/asm-i386/mach-xen/setup_arch_pre.h
===================================================================
--- head-2006-05-03.orig/include/asm-i386/mach-xen/setup_arch_pre.h	2006-04-24 11:43:43.000000000 +0200
+++ head-2006-05-03/include/asm-i386/mach-xen/setup_arch_pre.h	2006-05-08 16:04:28.000000000 +0200
@@ -3,3 +3,9 @@
 #define ARCH_SETUP machine_specific_arch_setup();
 
 static void __init machine_specific_arch_setup(void);
+
+static inline char * machine_specific_memory_setup(void)
+{
+	return "Xen";
+}
+

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

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

* Re: [PATCH] linux: eliminate E820 tables
  2006-05-11 13:17 [PATCH] linux: eliminate E820 tables Jan Beulich
@ 2006-05-11 18:23 ` Anthony Liguori
  2006-05-12  0:05   ` Chris Wright
  2006-05-17 14:34 ` Andrew D. Ball
  1 sibling, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2006-05-11 18:23 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Xen-devel

Why do we need CONFIG_XEN guards in xen specific files?

Should setup-xen.c and e820-xen.c be built when CONFIG_XEN isn't set?

Regards,

Anthony Liguori

Jan Beulich wrote:
> .. to make clear that no relevant state is actually maintained in there and that, as a consequence, adjustments to
> native Linux code in this area aren't applicable to the Xen kernels.
>
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
>   
> ------------------------------------------------------------------------
>
> Index: head-2006-05-03/arch/i386/kernel/setup-xen.c
> ===================================================================
> --- head-2006-05-03.orig/arch/i386/kernel/setup-xen.c	2006-05-08 16:04:28.000000000 +0200
> +++ head-2006-05-03/arch/i386/kernel/setup-xen.c	2006-05-08 16:09:21.000000000 +0200
> @@ -157,7 +157,9 @@ struct ist_info ist_info;
>  	defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
>  EXPORT_SYMBOL(ist_info);
>  #endif
> +#ifndef CONFIG_XEN
>  struct e820map e820;
> +#endif
>  
>  extern void early_cpu_init(void);
>  extern void generic_apic_probe(char *);
> @@ -399,6 +401,7 @@ EXPORT_SYMBOL(phys_to_machine_mapping);
>  start_info_t *xen_start_info;
>  EXPORT_SYMBOL(xen_start_info);
>  
> +#ifndef CONFIG_XEN
>  static void __init limit_regions(unsigned long long size)
>  {
>  	unsigned long long current_addr = 0;
> @@ -492,7 +495,6 @@ static void __init print_memory_map(char
>  	}
>  }
>  
> -#if 0
>  /*
>   * Sanitize the BIOS e820 map.
>   *
> @@ -747,7 +749,9 @@ static void __init parse_cmdline_early (
>  {
>  	char c = ' ', *to = command_line, *from = saved_command_line;
>  	int len = 0, max_cmdline;
> +#ifndef CONFIG_XEN
>  	int userdef = 0;
> +#endif
>  
>  	if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE)
>  		max_cmdline = COMMAND_LINE_SIZE;
> @@ -795,6 +799,7 @@ static void __init parse_cmdline_early (
>  			}
>  		}
>  
> +#ifndef CONFIG_XEN
>  		else if (!memcmp(from, "memmap=", 7)) {
>  			if (to != command_line)
>  				to--;
> @@ -836,6 +841,7 @@ static void __init parse_cmdline_early (
>  				}
>  			}
>  		}
> +#endif
>  
>  		else if (!memcmp(from, "noexec=", 7))
>  			noexec_setup(from + 7);
> @@ -978,10 +984,12 @@ static void __init parse_cmdline_early (
>  	}
>  	*to = '\0';
>  	*cmdline_p = command_line;
> +#ifndef CONFIG_XEN
>  	if (userdef) {
>  		printk(KERN_INFO "user-defined physical RAM map:\n");
>  		print_memory_map("user");
>  	}
> +#endif
>  }
>  
>  #if 0 /* !XEN */
> @@ -1111,6 +1119,7 @@ unsigned long __init find_max_low_pfn(vo
>  	return max_low_pfn;
>  }
>  
> +#ifndef CONFIG_XEN
>  /*
>   * Free all available memory for boot time allocation.  Used
>   * as a callback function by efi_memory_walk()
> @@ -1129,11 +1138,14 @@ free_available_memory(unsigned long star
>  
>  	return 0;
>  }
> +#endif
> +
>  /*
>   * Register fully available low RAM pages with the bootmem allocator.
>   */
>  static void __init register_bootmem_low_pages(unsigned long max_low_pfn)
>  {
> +#ifndef CONFIG_XEN
>  	int i;
>  
>  	if (efi_enabled) {
> @@ -1171,6 +1183,13 @@ static void __init register_bootmem_low_
>  		size = last_pfn - curr_pfn;
>  		free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
>  	}
> +#else
> +	unsigned long size = xen_start_info->nr_pages;
> +
> +	if (size > max_low_pfn)
> +		size = max_low_pfn;
> +	free_bootmem(0, PFN_PHYS(size));
> +#endif
>  }
>  
>  #ifndef CONFIG_XEN
> @@ -1699,12 +1718,14 @@ void __init setup_arch(char **cmdline_p)
>  	setup_xen_features();
>  
>  	ARCH_SETUP
> +#ifndef CONFIG_XEN
>  	if (efi_enabled)
>  		efi_init();
>  	else {
>  		printk(KERN_INFO "BIOS-provided physical RAM map:\n");
>  		print_memory_map(machine_specific_memory_setup());
>  	}
> +#endif
>  
>  	copy_edd();
>  
> Index: head-2006-05-03/arch/x86_64/kernel/e820-xen.c
> ===================================================================
> --- head-2006-05-03.orig/arch/x86_64/kernel/e820-xen.c	2006-05-03 09:39:54.000000000 +0200
> +++ head-2006-05-03/arch/x86_64/kernel/e820-xen.c	2006-05-08 16:04:28.000000000 +0200
> @@ -36,6 +36,7 @@ EXPORT_SYMBOL(end_pfn);
>  unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT;  
>  unsigned long end_pfn_map; 
>  
> +#ifndef CONFIG_XEN
>  /* 
>   * Add a memory region to the kernel e820 map.
>   */ 
> @@ -54,8 +55,6 @@ void __init add_memory_region(unsigned l
>  	e820.nr_map++;
>  }
>  
> -#ifndef CONFIG_XEN
> -
>  /* 
>   * end_pfn only includes RAM, while end_pfn_map includes all e820 entries.
>   * The direct mapping extends to end_pfn_map, so that we can directly access
> @@ -278,6 +279,7 @@ int __init e820_all_mapped(unsigned long
>  }
>  #endif /* CONFIG_XEN */
>  
> +#ifndef CONFIG_XEN
>  void __init e820_print_map(char *who)
>  {
>  	int i;
> @@ -304,7 +304,6 @@ void __init e820_print_map(char *who)
>  	}
>  }
>  
> -#ifndef CONFIG_XEN
>  /*
>   * Sanitize the BIOS e820 map.
>   *
> @@ -562,7 +561,8 @@ void __init setup_memory_region(void)
>  
>  #else  /* CONFIG_XEN */
>  
> -extern unsigned long xen_override_max_pfn;
> +/* Allows setting of maximum possible memory size  */
> +static unsigned long xen_override_max_pfn;
>  extern union xen_start_info_union xen_start_info_union;
>  
>  unsigned long __init e820_end_of_ram(void)
> @@ -662,6 +662,7 @@ void __init parse_memopt(char *p, char *
>  	xen_override_max_pfn = (unsigned long) end_user_pfn;
>  } 
>  
> +#ifndef CONFIG_XEN
>  void __init parse_memmapopt(char *p, char **from)
>  {
>  	unsigned long long start_at, mem_size;
> @@ -682,6 +683,7 @@ void __init parse_memmapopt(char *p, cha
>  	}
>  	p = *from;
>  }
> +#endif
>  
>  /*
>   * Search for the biggest gap in the low 32 bits of the e820
> Index: head-2006-05-03/arch/x86_64/kernel/setup-xen.c
> ===================================================================
> --- head-2006-05-03.orig/arch/x86_64/kernel/setup-xen.c	2006-05-08 16:04:28.000000000 +0200
> +++ head-2006-05-03/arch/x86_64/kernel/setup-xen.c	2006-05-08 16:11:01.000000000 +0200
> @@ -88,9 +88,6 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info);
>  extern char hypercall_page[PAGE_SIZE];
>  EXPORT_SYMBOL(hypercall_page);
>  
> -/* Allows setting of maximum possible memory size  */
> -unsigned long xen_override_max_pfn;
> -
>  static int xen_panic_event(struct notifier_block *, unsigned long, void *);
>  static struct notifier_block xen_panic_block = {
>  	xen_panic_event, NULL, 0 /* try to go last */
> @@ -142,7 +139,9 @@ struct sys_desc_table_struct {
>  };
>  
>  struct edid_info edid_info;
> +#ifndef CONFIG_XEN
>  struct e820map e820;
> +#endif
>  
>  extern int root_mountflags;
>  
> @@ -321,7 +320,9 @@ static __init void parse_cmdline_early (
>  {
>  	char c = ' ', *to = command_line, *from = COMMAND_LINE;
>  	int len = 0;
> +#ifndef CONFIG_XEN
>  	int userdef = 0;
> +#endif
>  
>  	for (;;) {
>  		if (c != ' ') 
> @@ -401,6 +402,7 @@ static __init void parse_cmdline_early (
>  		if (!memcmp(from, "mem=", 4))
>  			parse_memopt(from+4, &from); 
>  
> +#ifndef CONFIG_XEN
>  		if (!memcmp(from, "memmap=", 7)) {
>  			/* exactmap option is for used defined memory */
>  			if (!memcmp(from+7, "exactmap", 8)) {
> @@ -422,6 +424,7 @@ static __init void parse_cmdline_early (
>  				userdef = 1;
>  			}
>  		}
> +#endif
>  
>  #ifdef CONFIG_NUMA
>  		if (!memcmp(from, "numa=", 5))
> @@ -481,10 +484,12 @@ static __init void parse_cmdline_early (
>  			break;
>  		*(to++) = c;
>  	}
> +#ifndef CONFIG_XEN
>  	if (userdef) {
>  		printk(KERN_INFO "user-defined physical RAM map:\n");
>  		e820_print_map("user");
>  	}
> +#endif
>  	*to = '\0';
>  	*cmdline_p = command_line;
>  }
> Index: head-2006-05-03/include/asm-i386/mach-xen/setup_arch_post.h
> ===================================================================
> --- head-2006-05-03.orig/include/asm-i386/mach-xen/setup_arch_post.h	2006-04-24 11:43:43.000000000 +0200
> +++ head-2006-05-03/include/asm-i386/mach-xen/setup_arch_post.h	2006-05-08 16:04:28.000000000 +0200
> @@ -1,6 +1,4 @@
>  /**
> - * machine_specific_memory_setup - Hook for machine specific memory setup.
> - *
>   * Description:
>   *	This is included late in kernel/setup.c so that it can make
>   *	use of all of the static functions.
> @@ -8,16 +8,6 @@
>  
>  #include <xen/interface/callback.h>
>  
> -static char * __init machine_specific_memory_setup(void)
> -{
> -	unsigned long max_pfn = xen_start_info->nr_pages;
> -
> -	e820.nr_map = 0;
> -	add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
> -
> -	return "Xen";
> -}
> -
>  extern void hypervisor_callback(void);
>  extern void failsafe_callback(void);
>  extern void nmi(void);
> Index: head-2006-05-03/include/asm-i386/mach-xen/setup_arch_pre.h
> ===================================================================
> --- head-2006-05-03.orig/include/asm-i386/mach-xen/setup_arch_pre.h	2006-04-24 11:43:43.000000000 +0200
> +++ head-2006-05-03/include/asm-i386/mach-xen/setup_arch_pre.h	2006-05-08 16:04:28.000000000 +0200
> @@ -3,3 +3,9 @@
>  #define ARCH_SETUP machine_specific_arch_setup();
>  
>  static void __init machine_specific_arch_setup(void);
> +
> +static inline char * machine_specific_memory_setup(void)
> +{
> +	return "Xen";
> +}
> +
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>   

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

* Re: [PATCH] linux: eliminate E820 tables
  2006-05-11 18:23 ` Anthony Liguori
@ 2006-05-12  0:05   ` Chris Wright
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wright @ 2006-05-12  0:05 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Xen-devel, Jan Beulich

* Anthony Liguori (aliguori@us.ibm.com) wrote:
> Why do we need CONFIG_XEN guards in xen specific files?
> 
> Should setup-xen.c and e820-xen.c be built when CONFIG_XEN isn't set?

Yes, but *-xen.c is temporary.  Adding CONFIG_XEN annotations
make the diffs smaller and it's easier to keep in sync with the
corresponding file's changes.

thanks,
-chris

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

* Re: [PATCH] linux: eliminate E820 tables
  2006-05-11 13:17 [PATCH] linux: eliminate E820 tables Jan Beulich
  2006-05-11 18:23 ` Anthony Liguori
@ 2006-05-17 14:34 ` Andrew D. Ball
  2006-05-18 14:53   ` Ian Campbell
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew D. Ball @ 2006-05-17 14:34 UTC (permalink / raw)
  To: xen-devel

Jan Beulich wrote:
> .. to make clear that no relevant state is actually maintained in there and that, as a consequence, adjustments to
> native Linux code in this area aren't applicable to the Xen kernels.
> 

In dom0, I like to read the system memory map from the kernel message 
buffer.  Does your patch make this no longer work?

Thanks.
Andrew

> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> 
> 
> ------------------------------------------------------------------------
> 
> Index: head-2006-05-03/arch/i386/kernel/setup-xen.c
> ===================================================================
> --- head-2006-05-03.orig/arch/i386/kernel/setup-xen.c	2006-05-08 16:04:28.000000000 +0200
> +++ head-2006-05-03/arch/i386/kernel/setup-xen.c	2006-05-08 16:09:21.000000000 +0200
> @@ -157,7 +157,9 @@ struct ist_info ist_info;
>  	defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
>  EXPORT_SYMBOL(ist_info);
>  #endif
> +#ifndef CONFIG_XEN
>  struct e820map e820;
> +#endif
>  
>  extern void early_cpu_init(void);
>  extern void generic_apic_probe(char *);
> @@ -399,6 +401,7 @@ EXPORT_SYMBOL(phys_to_machine_mapping);
>  start_info_t *xen_start_info;
>  EXPORT_SYMBOL(xen_start_info);
>  
> +#ifndef CONFIG_XEN
>  static void __init limit_regions(unsigned long long size)
>  {
>  	unsigned long long current_addr = 0;
> @@ -492,7 +495,6 @@ static void __init print_memory_map(char
>  	}
>  }
>  
> -#if 0
>  /*
>   * Sanitize the BIOS e820 map.
>   *
> @@ -747,7 +749,9 @@ static void __init parse_cmdline_early (
>  {
>  	char c = ' ', *to = command_line, *from = saved_command_line;
>  	int len = 0, max_cmdline;
> +#ifndef CONFIG_XEN
>  	int userdef = 0;
> +#endif
>  
>  	if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE)
>  		max_cmdline = COMMAND_LINE_SIZE;
> @@ -795,6 +799,7 @@ static void __init parse_cmdline_early (
>  			}
>  		}
>  
> +#ifndef CONFIG_XEN
>  		else if (!memcmp(from, "memmap=", 7)) {
>  			if (to != command_line)
>  				to--;
> @@ -836,6 +841,7 @@ static void __init parse_cmdline_early (
>  				}
>  			}
>  		}
> +#endif
>  
>  		else if (!memcmp(from, "noexec=", 7))
>  			noexec_setup(from + 7);
> @@ -978,10 +984,12 @@ static void __init parse_cmdline_early (
>  	}
>  	*to = '\0';
>  	*cmdline_p = command_line;
> +#ifndef CONFIG_XEN
>  	if (userdef) {
>  		printk(KERN_INFO "user-defined physical RAM map:\n");
>  		print_memory_map("user");
>  	}
> +#endif
>  }
>  
>  #if 0 /* !XEN */
> @@ -1111,6 +1119,7 @@ unsigned long __init find_max_low_pfn(vo
>  	return max_low_pfn;
>  }
>  
> +#ifndef CONFIG_XEN
>  /*
>   * Free all available memory for boot time allocation.  Used
>   * as a callback function by efi_memory_walk()
> @@ -1129,11 +1138,14 @@ free_available_memory(unsigned long star
>  
>  	return 0;
>  }
> +#endif
> +
>  /*
>   * Register fully available low RAM pages with the bootmem allocator.
>   */
>  static void __init register_bootmem_low_pages(unsigned long max_low_pfn)
>  {
> +#ifndef CONFIG_XEN
>  	int i;
>  
>  	if (efi_enabled) {
> @@ -1171,6 +1183,13 @@ static void __init register_bootmem_low_
>  		size = last_pfn - curr_pfn;
>  		free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
>  	}
> +#else
> +	unsigned long size = xen_start_info->nr_pages;
> +
> +	if (size > max_low_pfn)
> +		size = max_low_pfn;
> +	free_bootmem(0, PFN_PHYS(size));
> +#endif
>  }
>  
>  #ifndef CONFIG_XEN
> @@ -1699,12 +1718,14 @@ void __init setup_arch(char **cmdline_p)
>  	setup_xen_features();
>  
>  	ARCH_SETUP
> +#ifndef CONFIG_XEN
>  	if (efi_enabled)
>  		efi_init();
>  	else {
>  		printk(KERN_INFO "BIOS-provided physical RAM map:\n");
>  		print_memory_map(machine_specific_memory_setup());
>  	}
> +#endif
>  
>  	copy_edd();
>  
> Index: head-2006-05-03/arch/x86_64/kernel/e820-xen.c
> ===================================================================
> --- head-2006-05-03.orig/arch/x86_64/kernel/e820-xen.c	2006-05-03 09:39:54.000000000 +0200
> +++ head-2006-05-03/arch/x86_64/kernel/e820-xen.c	2006-05-08 16:04:28.000000000 +0200
> @@ -36,6 +36,7 @@ EXPORT_SYMBOL(end_pfn);
>  unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT;  
>  unsigned long end_pfn_map; 
>  
> +#ifndef CONFIG_XEN
>  /* 
>   * Add a memory region to the kernel e820 map.
>   */ 
> @@ -54,8 +55,6 @@ void __init add_memory_region(unsigned l
>  	e820.nr_map++;
>  }
>  
> -#ifndef CONFIG_XEN
> -
>  /* 
>   * end_pfn only includes RAM, while end_pfn_map includes all e820 entries.
>   * The direct mapping extends to end_pfn_map, so that we can directly access
> @@ -278,6 +279,7 @@ int __init e820_all_mapped(unsigned long
>  }
>  #endif /* CONFIG_XEN */
>  
> +#ifndef CONFIG_XEN
>  void __init e820_print_map(char *who)
>  {
>  	int i;
> @@ -304,7 +304,6 @@ void __init e820_print_map(char *who)
>  	}
>  }
>  
> -#ifndef CONFIG_XEN
>  /*
>   * Sanitize the BIOS e820 map.
>   *
> @@ -562,7 +561,8 @@ void __init setup_memory_region(void)
>  
>  #else  /* CONFIG_XEN */
>  
> -extern unsigned long xen_override_max_pfn;
> +/* Allows setting of maximum possible memory size  */
> +static unsigned long xen_override_max_pfn;
>  extern union xen_start_info_union xen_start_info_union;
>  
>  unsigned long __init e820_end_of_ram(void)
> @@ -662,6 +662,7 @@ void __init parse_memopt(char *p, char *
>  	xen_override_max_pfn = (unsigned long) end_user_pfn;
>  } 
>  
> +#ifndef CONFIG_XEN
>  void __init parse_memmapopt(char *p, char **from)
>  {
>  	unsigned long long start_at, mem_size;
> @@ -682,6 +683,7 @@ void __init parse_memmapopt(char *p, cha
>  	}
>  	p = *from;
>  }
> +#endif
>  
>  /*
>   * Search for the biggest gap in the low 32 bits of the e820
> Index: head-2006-05-03/arch/x86_64/kernel/setup-xen.c
> ===================================================================
> --- head-2006-05-03.orig/arch/x86_64/kernel/setup-xen.c	2006-05-08 16:04:28.000000000 +0200
> +++ head-2006-05-03/arch/x86_64/kernel/setup-xen.c	2006-05-08 16:11:01.000000000 +0200
> @@ -88,9 +88,6 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info);
>  extern char hypercall_page[PAGE_SIZE];
>  EXPORT_SYMBOL(hypercall_page);
>  
> -/* Allows setting of maximum possible memory size  */
> -unsigned long xen_override_max_pfn;
> -
>  static int xen_panic_event(struct notifier_block *, unsigned long, void *);
>  static struct notifier_block xen_panic_block = {
>  	xen_panic_event, NULL, 0 /* try to go last */
> @@ -142,7 +139,9 @@ struct sys_desc_table_struct {
>  };
>  
>  struct edid_info edid_info;
> +#ifndef CONFIG_XEN
>  struct e820map e820;
> +#endif
>  
>  extern int root_mountflags;
>  
> @@ -321,7 +320,9 @@ static __init void parse_cmdline_early (
>  {
>  	char c = ' ', *to = command_line, *from = COMMAND_LINE;
>  	int len = 0;
> +#ifndef CONFIG_XEN
>  	int userdef = 0;
> +#endif
>  
>  	for (;;) {
>  		if (c != ' ') 
> @@ -401,6 +402,7 @@ static __init void parse_cmdline_early (
>  		if (!memcmp(from, "mem=", 4))
>  			parse_memopt(from+4, &from); 
>  
> +#ifndef CONFIG_XEN
>  		if (!memcmp(from, "memmap=", 7)) {
>  			/* exactmap option is for used defined memory */
>  			if (!memcmp(from+7, "exactmap", 8)) {
> @@ -422,6 +424,7 @@ static __init void parse_cmdline_early (
>  				userdef = 1;
>  			}
>  		}
> +#endif
>  
>  #ifdef CONFIG_NUMA
>  		if (!memcmp(from, "numa=", 5))
> @@ -481,10 +484,12 @@ static __init void parse_cmdline_early (
>  			break;
>  		*(to++) = c;
>  	}
> +#ifndef CONFIG_XEN
>  	if (userdef) {
>  		printk(KERN_INFO "user-defined physical RAM map:\n");
>  		e820_print_map("user");
>  	}
> +#endif
>  	*to = '\0';
>  	*cmdline_p = command_line;
>  }
> Index: head-2006-05-03/include/asm-i386/mach-xen/setup_arch_post.h
> ===================================================================
> --- head-2006-05-03.orig/include/asm-i386/mach-xen/setup_arch_post.h	2006-04-24 11:43:43.000000000 +0200
> +++ head-2006-05-03/include/asm-i386/mach-xen/setup_arch_post.h	2006-05-08 16:04:28.000000000 +0200
> @@ -1,6 +1,4 @@
>  /**
> - * machine_specific_memory_setup - Hook for machine specific memory setup.
> - *
>   * Description:
>   *	This is included late in kernel/setup.c so that it can make
>   *	use of all of the static functions.
> @@ -8,16 +8,6 @@
>  
>  #include <xen/interface/callback.h>
>  
> -static char * __init machine_specific_memory_setup(void)
> -{
> -	unsigned long max_pfn = xen_start_info->nr_pages;
> -
> -	e820.nr_map = 0;
> -	add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
> -
> -	return "Xen";
> -}
> -
>  extern void hypervisor_callback(void);
>  extern void failsafe_callback(void);
>  extern void nmi(void);
> Index: head-2006-05-03/include/asm-i386/mach-xen/setup_arch_pre.h
> ===================================================================
> --- head-2006-05-03.orig/include/asm-i386/mach-xen/setup_arch_pre.h	2006-04-24 11:43:43.000000000 +0200
> +++ head-2006-05-03/include/asm-i386/mach-xen/setup_arch_pre.h	2006-05-08 16:04:28.000000000 +0200
> @@ -3,3 +3,9 @@
>  #define ARCH_SETUP machine_specific_arch_setup();
>  
>  static void __init machine_specific_arch_setup(void);
> +
> +static inline char * machine_specific_memory_setup(void)
> +{
> +	return "Xen";
> +}
> +
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

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

* Re: [PATCH] linux: eliminate E820 tables
  2006-05-17 14:34 ` Andrew D. Ball
@ 2006-05-18 14:53   ` Ian Campbell
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2006-05-18 14:53 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

Hi Jan,

I seem to have lost the original mail so I'll reply here....

Thanks for the patch. I'm currently testing one which makes XenLinux use
the e820 map (basically it fakes up a single entry map). It removes a
bunch of the divergence from the native code.

Thanks,
Ian.

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

end of thread, other threads:[~2006-05-18 14:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-11 13:17 [PATCH] linux: eliminate E820 tables Jan Beulich
2006-05-11 18:23 ` Anthony Liguori
2006-05-12  0:05   ` Chris Wright
2006-05-17 14:34 ` Andrew D. Ball
2006-05-18 14:53   ` Ian Campbell

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.