- x86_64-avoid-ebda-area-in-early-boot-allocator.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     x86_64: Avoid EBDA area in early boot allocator

has been removed from the -mm tree.  Its filename is

     x86_64-avoid-ebda-area-in-early-boot-allocator.patch

This patch was probably dropped from -mm because
it has now been merged into a subsystem tree or
into Linus's tree, or because it was folded into
its parent patch in the -mm tree.


From: Andi Kleen <ak@xxxxxxx>

Based on analysis&patch from Robert Hentosch

Observed on a Dell PE6850 with 16GB

The problem occurs very early on, when the kernel allocates space for the
temporary memory map called bootmap.  The bootmap overlaps the EBDA region. 
EBDA region is not historically reserved in the e820 mapping.  When the
bootmap is freed it marks the EBDA region as usable.

If you notice in setup.c there is already code to work around the EBDA in
reserve_ebda_region(), this check however occurs after the bootmap is
allocated and doesn't prevent the bootmap from using this range.

AK: I redid the original patch.  Thanks also to Jan Beulich for spotting some
mistakes.

Cc: <Robert_Hentosch@xxxxxxxx>
Cc: <jbeulich@xxxxxxxxxx>
Signed-off-by: Andi Kleen <ak@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 arch/x86_64/kernel/e820.c  |    6 ++++++
 arch/x86_64/kernel/setup.c |   30 ++++++++++++++++++++++--------
 include/asm-x86_64/e820.h  |    2 ++
 3 files changed, 30 insertions(+), 8 deletions(-)

diff -puN arch/x86_64/kernel/e820.c~x86_64-avoid-ebda-area-in-early-boot-allocator arch/x86_64/kernel/e820.c
--- devel/arch/x86_64/kernel/e820.c~x86_64-avoid-ebda-area-in-early-boot-allocator	2006-05-10 21:18:13.000000000 -0700
+++ devel-akpm/arch/x86_64/kernel/e820.c	2006-05-10 21:18:13.000000000 -0700
@@ -76,6 +76,12 @@ static inline int bad_addr(unsigned long
 		*addrp = __pa_symbol(&_end);
 		return 1;
 	}
+
+	if (last >= ebda_addr && addr < ebda_addr + ebda_size) {
+		*addrp = ebda_addr + ebda_size;
+		return 1;
+	}
+
 	/* XXX ramdisk image here? */ 
 	return 0;
 } 
diff -puN arch/x86_64/kernel/setup.c~x86_64-avoid-ebda-area-in-early-boot-allocator arch/x86_64/kernel/setup.c
--- devel/arch/x86_64/kernel/setup.c~x86_64-avoid-ebda-area-in-early-boot-allocator	2006-05-10 21:18:13.000000000 -0700
+++ devel-akpm/arch/x86_64/kernel/setup.c	2006-05-10 21:18:13.000000000 -0700
@@ -571,17 +571,28 @@ static inline void copy_edd(void)
 #endif
 
 #define EBDA_ADDR_POINTER 0x40E
-static void __init reserve_ebda_region(void)
+
+unsigned __initdata ebda_addr;
+unsigned __initdata ebda_size;
+
+static void discover_ebda(void)
 {
-	unsigned int addr;
-	/** 
+	/*
 	 * there is a real-mode segmented pointer pointing to the 
 	 * 4K EBDA area at 0x40E
 	 */
-	addr = *(unsigned short *)phys_to_virt(EBDA_ADDR_POINTER);
-	addr <<= 4;
-	if (addr)
-		reserve_bootmem_generic(addr, PAGE_SIZE);
+	ebda_addr = *(unsigned short *)EBDA_ADDR_POINTER;
+	ebda_addr <<= 4;
+
+	ebda_size = *(unsigned short *)(unsigned long)ebda_addr;
+
+	/* Round EBDA up to pages */
+	if (ebda_size == 0)
+		ebda_size = 1;
+	ebda_size <<= 10;
+	ebda_size = round_up(ebda_size + (ebda_addr & ~PAGE_MASK), PAGE_SIZE);
+	if (ebda_size > 64*1024)
+		ebda_size = 64*1024;
 }
 
 void __init setup_arch(char **cmdline_p)
@@ -627,6 +638,8 @@ void __init setup_arch(char **cmdline_p)
 
 	check_efer();
 
+	discover_ebda();
+
 	init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT));
 
 	dmi_scan_machine();
@@ -669,7 +682,8 @@ void __init setup_arch(char **cmdline_p)
 	reserve_bootmem_generic(0, PAGE_SIZE);
 
 	/* reserve ebda region */
-	reserve_ebda_region();
+	if (ebda_addr)
+		reserve_bootmem_generic(ebda_addr, ebda_size);
 
 #ifdef CONFIG_SMP
 	/*
diff -puN include/asm-x86_64/e820.h~x86_64-avoid-ebda-area-in-early-boot-allocator include/asm-x86_64/e820.h
--- devel/include/asm-x86_64/e820.h~x86_64-avoid-ebda-area-in-early-boot-allocator	2006-05-10 21:18:13.000000000 -0700
+++ devel-akpm/include/asm-x86_64/e820.h	2006-05-10 21:18:13.000000000 -0700
@@ -59,6 +59,8 @@ extern void __init parse_memopt(char *p,
 extern void __init parse_memmapopt(char *p, char **end);
 
 extern struct e820map e820;
+
+extern unsigned ebda_addr, ebda_size;
 #endif/*!__ASSEMBLY__*/
 
 #endif/*__E820_HEADER*/
_

Patches currently in -mm which might be from ak@xxxxxxx are

origin.patch
x86_64-disable-aperture-pci-region-check-in-amd64.patch
x86_64-check-for-too-many-northbridges-in-iommu.patch
git-acpi.patch
git-agpgart.patch
x86_64-mm-serialize-assign_irq_vector-use-of-static-variables-fix.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux