linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
@ 2012-02-20 13:30 Matt Fleming
  2012-02-23  1:16 ` [tip:x86/urgent] " tip-bot for Matt Fleming
  2012-02-28  2:33 ` [PATCH] " H. Peter Anvin
  0 siblings, 2 replies; 28+ messages in thread
From: Matt Fleming @ 2012-02-20 13:30 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: H. Peter Anvin, linux-kernel, Matthew Garrett, Zhang Rui,
	Huang Ying, Keith Packard, Matt Fleming, Thomas Gleixner

From: Matt Fleming <matt.fleming@intel.com>

This patch reimplements the fix from e8c7106280a3 ("x86, efi: Calling
__pa() with an ioremap()ed address is invalid") which was reverted in
e1ad783b12ec because it caused a regression on some MacBooks (they
hung at boot). The regression was caused because the commit only
marked EFI_RUNTIME_SERVICES_DATA as E820_RESERVED_EFI, when it should
have marked all regions that have the EFI_MEMORY_RUNTIME attribute.

Calling __pa() with an ioremap'd address is invalid. If we encounter
an efi_memory_desc_t without EFI_MEMORY_WB set in ->attribute we
currently call set_memory_uc(), which in turn calls __pa() on a
potentially ioremap'd address. On CONFIG_X86_32 this results in the
following oops,

  BUG: unable to handle kernel paging request at f7f22280
  IP: [<c10257b9>] reserve_ram_pages_type+0x89/0x210
  *pdpt = 0000000001978001 *pde = 0000000001ffb067 *pte = 0000000000000000
  Oops: 0000 [#1] PREEMPT SMP
  Modules linked in:

  Pid: 0, comm: swapper Not tainted 3.0.0-acpi-efi-0805 #3
   EIP: 0060:[<c10257b9>] EFLAGS: 00010202 CPU: 0
   EIP is at reserve_ram_pages_type+0x89/0x210
   EAX: 0070e280 EBX: 38714000 ECX: f7814000 EDX: 00000000
   ESI: 00000000 EDI: 38715000 EBP: c189fef0 ESP: c189fea8
   DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
  Process swapper (pid: 0, ti=c189e000 task=c18bbe60 task.ti=c189e000)
  Stack:
   80000200 ff108000 00000000 c189ff00 00038714 00000000 00000000 c189fed0
   c104f8ca 00038714 00000000 00038715 00000000 00000000 00038715 00000000
   00000010 38715000 c189ff48 c1025aff 38715000 00000000 00000010 00000000
  Call Trace:
   [<c104f8ca>] ? page_is_ram+0x1a/0x40
   [<c1025aff>] reserve_memtype+0xdf/0x2f0
   [<c1024dc9>] set_memory_uc+0x49/0xa0
   [<c19334d0>] efi_enter_virtual_mode+0x1c2/0x3aa
   [<c19216d4>] start_kernel+0x291/0x2f2
   [<c19211c7>] ? loglevel+0x1b/0x1b
   [<c19210bf>] i386_start_kernel+0xbf/0xc8

A better approach to this problem is to map the memory region with the
correct attributes from the start, instead of modifying them after the
fact.

Despite first impressions, it's not possible to use ioremap_cache() to
map all cached memory regions on CONFIG_X86_64 because of the way that
the memory map might be configured as detailed in the following bug
report,

	https://bugzilla.redhat.com/show_bug.cgi?id=748516

Therefore, we need to ensure that any regions requiring a runtime
mapping are covered by the direct kernel mapping table. Previously,
this was taken care of by efi_ioremap() but if we handle this case
earlier, in setup_arch(), we can delete the CONFIG_X86_32 and
CONFIG_X86_64 efi_ioremap() implementations entirely.

To accomplish this we now mark any regions that need a runtime mapping
as E820_RESERVED_EFI and map them via the direct kernel mapping in
setup_arch().

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Huang Ying <huang.ying.caritas@gmail.com>
Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
---
 arch/x86/include/asm/e820.h    |    7 +++++++
 arch/x86/include/asm/efi.h     |    5 -----
 arch/x86/kernel/e820.c         |    3 ++-
 arch/x86/kernel/setup.c        |   21 ++++++++++++++++++++-
 arch/x86/platform/efi/efi.c    |   37 ++++++++++++++++++++++++-------------
 arch/x86/platform/efi/efi_64.c |   17 -----------------
 6 files changed, 53 insertions(+), 37 deletions(-)

diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
index 3778256..5db3c45 100644
--- a/arch/x86/include/asm/e820.h
+++ b/arch/x86/include/asm/e820.h
@@ -53,6 +53,12 @@
  */
 #define E820_RESERVED_KERN        128
 
+/*
+ * Address ranges that need to be mapped by the kernel direct mapping
+ * because they require a runtime mapping. See setup_arch().
+ */
+#define E820_RESERVED_EFI         129
+
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
 struct e820entry {
@@ -115,6 +121,7 @@ static inline void early_memtest(unsigned long start, unsigned long end)
 }
 #endif
 
+extern unsigned long e820_end_pfn(unsigned long limit_pfn, unsigned type);
 extern unsigned long e820_end_of_ram_pfn(void);
 extern unsigned long e820_end_of_low_ram_pfn(void);
 extern u64 early_reserve_e820(u64 sizet, u64 align);
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 844f735..26d8c18 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -35,8 +35,6 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
 #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6)	\
 	efi_call_virt(f, a1, a2, a3, a4, a5, a6)
 
-#define efi_ioremap(addr, size, type)		ioremap_cache(addr, size)
-
 #else /* !CONFIG_X86_32 */
 
 #define EFI_LOADER_SIGNATURE	"EL64"
@@ -88,9 +86,6 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3,
 	efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
 		  (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
 
-extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
-				 u32 type);
-
 #endif /* CONFIG_X86_32 */
 
 extern int add_efi_memmap;
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 62d61e9..dd27ca0 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -136,6 +136,7 @@ static void __init e820_print_type(u32 type)
 		printk(KERN_CONT "(usable)");
 		break;
 	case E820_RESERVED:
+	case E820_RESERVED_EFI:
 		printk(KERN_CONT "(reserved)");
 		break;
 	case E820_ACPI:
@@ -754,7 +755,7 @@ u64 __init early_reserve_e820(u64 size, u64 align)
 /*
  * Find the highest page frame number we have available
  */
-static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
+unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
 {
 	int i;
 	unsigned long last_pfn = 0;
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d7d5099..e22bb08 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -690,6 +690,8 @@ early_param("reservelow", parse_reservelow);
 
 void __init setup_arch(char **cmdline_p)
 {
+	unsigned long end_pfn;
+
 #ifdef CONFIG_X86_32
 	memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
 	visws_early_detect();
@@ -926,7 +928,24 @@ void __init setup_arch(char **cmdline_p)
 	init_gbpages();
 
 	/* max_pfn_mapped is updated here */
-	max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
+	end_pfn = max_low_pfn;
+
+#ifdef CONFIG_X86_64
+	/*
+	 * There may be regions after the last E820_RAM region that we
+	 * want to include in the kernel direct mapping because their
+	 * contents are needed at runtime.
+	 */
+	if (efi_enabled) {
+		unsigned long efi_end;
+
+		efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI);
+		if (efi_end > end_pfn)
+			end_pfn = efi_end;
+	}
+#endif
+
+	max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
 	max_pfn_mapped = max_low_pfn_mapped;
 
 #ifdef CONFIG_X86_64
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 4cf9bd0..264cc6e 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -324,13 +324,20 @@ static void __init do_add_efi_memmap(void)
 		case EFI_UNUSABLE_MEMORY:
 			e820_type = E820_UNUSABLE;
 			break;
+		case EFI_MEMORY_MAPPED_IO:
+		case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
+			e820_type = E820_RESERVED;
+			break;
 		default:
 			/*
 			 * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE
-			 * EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO
-			 * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE
+			 * EFI_RUNTIME_SERVICES_DATA
+			 * EFI_PAL_CODE
 			 */
-			e820_type = E820_RESERVED;
+			if (md->attribute & EFI_MEMORY_RUNTIME)
+				e820_type = E820_RESERVED_EFI;
+			else
+				e820_type = E820_RESERVED;
 			break;
 		}
 		e820_add_region(start, size, e820_type);
@@ -669,10 +676,21 @@ void __init efi_enter_virtual_mode(void)
 		end_pfn = PFN_UP(end);
 		if (end_pfn <= max_low_pfn_mapped
 		    || (end_pfn > (1UL << (32 - PAGE_SHIFT))
-			&& end_pfn <= max_pfn_mapped))
+			&& end_pfn <= max_pfn_mapped)) {
 			va = __va(md->phys_addr);
-		else
-			va = efi_ioremap(md->phys_addr, size, md->type);
+
+			if (!(md->attribute & EFI_MEMORY_WB)) {
+				addr = (u64) (unsigned long)va;
+				npages = md->num_pages;
+				memrange_efi_to_native(&addr, &npages);
+				set_memory_uc(addr, npages);
+			}
+		} else {
+			if (!(md->attribute & EFI_MEMORY_WB))
+				va = ioremap_nocache(md->phys_addr, size);
+			else
+				va = ioremap_cache(md->phys_addr, size);
+		}
 
 		md->virt_addr = (u64) (unsigned long) va;
 
@@ -682,13 +700,6 @@ void __init efi_enter_virtual_mode(void)
 			continue;
 		}
 
-		if (!(md->attribute & EFI_MEMORY_WB)) {
-			addr = md->virt_addr;
-			npages = md->num_pages;
-			memrange_efi_to_native(&addr, &npages);
-			set_memory_uc(addr, npages);
-		}
-
 		systab = (u64) (unsigned long) efi_phys.systab;
 		if (md->phys_addr <= systab && systab < end) {
 			systab += md->virt_addr - md->phys_addr;
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index ac3aa54..312250c 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -80,20 +80,3 @@ void __init efi_call_phys_epilog(void)
 	local_irq_restore(efi_flags);
 	early_code_mapping_set_exec(0);
 }
-
-void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size,
-				 u32 type)
-{
-	unsigned long last_map_pfn;
-
-	if (type == EFI_MEMORY_MAPPED_IO)
-		return ioremap(phys_addr, size);
-
-	last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size);
-	if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) {
-		unsigned long top = last_map_pfn << PAGE_SHIFT;
-		efi_ioremap(top, size - (top - phys_addr), type);
-	}
-
-	return (void __iomem *)__va(phys_addr);
-}
-- 
1.7.4.4


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

* [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-02-20 13:30 [PATCH] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops Matt Fleming
@ 2012-02-23  1:16 ` tip-bot for Matt Fleming
  2012-02-23  2:20   ` Yinghai Lu
  2012-03-04  0:12   ` Keith Packard
  2012-02-28  2:33 ` [PATCH] " H. Peter Anvin
  1 sibling, 2 replies; 28+ messages in thread
From: tip-bot for Matt Fleming @ 2012-02-23  1:16 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, mjg, hpa, mingo, keithp, rui.zhang, stable,
	huang.ying.caritas, matt.fleming, tglx

Commit-ID:  f75bd1837564657b21431e44243e064a77276589
Gitweb:     http://git.kernel.org/tip/f75bd1837564657b21431e44243e064a77276589
Author:     Matt Fleming <matt.fleming@intel.com>
AuthorDate: Mon, 20 Feb 2012 13:30:26 +0000
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Wed, 22 Feb 2012 14:49:55 -0800

x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops

This patch reimplements the fix from e8c7106280a3 ("x86, efi: Calling
__pa() with an ioremap()ed address is invalid") which was reverted in
e1ad783b12ec because it caused a regression on some MacBooks (they
hung at boot). The regression was caused because the commit only
marked EFI_RUNTIME_SERVICES_DATA as E820_RESERVED_EFI, when it should
have marked all regions that have the EFI_MEMORY_RUNTIME attribute.

Calling __pa() with an ioremap'd address is invalid. If we encounter
an efi_memory_desc_t without EFI_MEMORY_WB set in ->attribute we
currently call set_memory_uc(), which in turn calls __pa() on a
potentially ioremap'd address. On CONFIG_X86_32 this results in the
following oops,

  BUG: unable to handle kernel paging request at f7f22280
  IP: [<c10257b9>] reserve_ram_pages_type+0x89/0x210
  *pdpt = 0000000001978001 *pde = 0000000001ffb067 *pte = 0000000000000000
  Oops: 0000 [#1] PREEMPT SMP
  Modules linked in:

  Pid: 0, comm: swapper Not tainted 3.0.0-acpi-efi-0805 #3
   EIP: 0060:[<c10257b9>] EFLAGS: 00010202 CPU: 0
   EIP is at reserve_ram_pages_type+0x89/0x210
   EAX: 0070e280 EBX: 38714000 ECX: f7814000 EDX: 00000000
   ESI: 00000000 EDI: 38715000 EBP: c189fef0 ESP: c189fea8
   DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
  Process swapper (pid: 0, ti=c189e000 task=c18bbe60 task.ti=c189e000)
  Stack:
   80000200 ff108000 00000000 c189ff00 00038714 00000000 00000000 c189fed0
   c104f8ca 00038714 00000000 00038715 00000000 00000000 00038715 00000000
   00000010 38715000 c189ff48 c1025aff 38715000 00000000 00000010 00000000
  Call Trace:
   [<c104f8ca>] ? page_is_ram+0x1a/0x40
   [<c1025aff>] reserve_memtype+0xdf/0x2f0
   [<c1024dc9>] set_memory_uc+0x49/0xa0
   [<c19334d0>] efi_enter_virtual_mode+0x1c2/0x3aa
   [<c19216d4>] start_kernel+0x291/0x2f2
   [<c19211c7>] ? loglevel+0x1b/0x1b
   [<c19210bf>] i386_start_kernel+0xbf/0xc8

A better approach to this problem is to map the memory region with the
correct attributes from the start, instead of modifying them after the
fact.

Despite first impressions, it's not possible to use ioremap_cache() to
map all cached memory regions on CONFIG_X86_64 because of the way that
the memory map might be configured as detailed in the following bug
report,

	https://bugzilla.redhat.com/show_bug.cgi?id=748516

Therefore, we need to ensure that any regions requiring a runtime
mapping are covered by the direct kernel mapping table. Previously,
this was taken care of by efi_ioremap() but if we handle this case
earlier, in setup_arch(), we can delete the CONFIG_X86_32 and
CONFIG_X86_64 efi_ioremap() implementations entirely.

To accomplish this we now mark any regions that need a runtime mapping
as E820_RESERVED_EFI and map them via the direct kernel mapping in
setup_arch().

Cc: Matthew Garrett <mjg@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Huang Ying <huang.ying.caritas@gmail.com>
Cc: Keith Packard <keithp@keithp.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Link: http://lkml.kernel.org/r/1329744626-5036-1-git-send-email-matt@console-pimps.org
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/asm/e820.h    |    7 +++++++
 arch/x86/include/asm/efi.h     |    5 -----
 arch/x86/kernel/e820.c         |    3 ++-
 arch/x86/kernel/setup.c        |   21 ++++++++++++++++++++-
 arch/x86/platform/efi/efi.c    |   37 ++++++++++++++++++++++++-------------
 arch/x86/platform/efi/efi_64.c |   17 -----------------
 6 files changed, 53 insertions(+), 37 deletions(-)

diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
index 3778256..5db3c45 100644
--- a/arch/x86/include/asm/e820.h
+++ b/arch/x86/include/asm/e820.h
@@ -53,6 +53,12 @@
  */
 #define E820_RESERVED_KERN        128
 
+/*
+ * Address ranges that need to be mapped by the kernel direct mapping
+ * because they require a runtime mapping. See setup_arch().
+ */
+#define E820_RESERVED_EFI         129
+
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
 struct e820entry {
@@ -115,6 +121,7 @@ static inline void early_memtest(unsigned long start, unsigned long end)
 }
 #endif
 
+extern unsigned long e820_end_pfn(unsigned long limit_pfn, unsigned type);
 extern unsigned long e820_end_of_ram_pfn(void);
 extern unsigned long e820_end_of_low_ram_pfn(void);
 extern u64 early_reserve_e820(u64 sizet, u64 align);
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 844f735..26d8c18 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -35,8 +35,6 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
 #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6)	\
 	efi_call_virt(f, a1, a2, a3, a4, a5, a6)
 
-#define efi_ioremap(addr, size, type)		ioremap_cache(addr, size)
-
 #else /* !CONFIG_X86_32 */
 
 #define EFI_LOADER_SIGNATURE	"EL64"
@@ -88,9 +86,6 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3,
 	efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
 		  (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
 
-extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
-				 u32 type);
-
 #endif /* CONFIG_X86_32 */
 
 extern int add_efi_memmap;
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 62d61e9..dd27ca0 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -136,6 +136,7 @@ static void __init e820_print_type(u32 type)
 		printk(KERN_CONT "(usable)");
 		break;
 	case E820_RESERVED:
+	case E820_RESERVED_EFI:
 		printk(KERN_CONT "(reserved)");
 		break;
 	case E820_ACPI:
@@ -754,7 +755,7 @@ u64 __init early_reserve_e820(u64 size, u64 align)
 /*
  * Find the highest page frame number we have available
  */
-static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
+unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
 {
 	int i;
 	unsigned long last_pfn = 0;
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d7d5099..e22bb08 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -690,6 +690,8 @@ early_param("reservelow", parse_reservelow);
 
 void __init setup_arch(char **cmdline_p)
 {
+	unsigned long end_pfn;
+
 #ifdef CONFIG_X86_32
 	memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
 	visws_early_detect();
@@ -926,7 +928,24 @@ void __init setup_arch(char **cmdline_p)
 	init_gbpages();
 
 	/* max_pfn_mapped is updated here */
-	max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
+	end_pfn = max_low_pfn;
+
+#ifdef CONFIG_X86_64
+	/*
+	 * There may be regions after the last E820_RAM region that we
+	 * want to include in the kernel direct mapping because their
+	 * contents are needed at runtime.
+	 */
+	if (efi_enabled) {
+		unsigned long efi_end;
+
+		efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI);
+		if (efi_end > end_pfn)
+			end_pfn = efi_end;
+	}
+#endif
+
+	max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
 	max_pfn_mapped = max_low_pfn_mapped;
 
 #ifdef CONFIG_X86_64
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 4cf9bd0..264cc6e 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -324,13 +324,20 @@ static void __init do_add_efi_memmap(void)
 		case EFI_UNUSABLE_MEMORY:
 			e820_type = E820_UNUSABLE;
 			break;
+		case EFI_MEMORY_MAPPED_IO:
+		case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
+			e820_type = E820_RESERVED;
+			break;
 		default:
 			/*
 			 * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE
-			 * EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO
-			 * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE
+			 * EFI_RUNTIME_SERVICES_DATA
+			 * EFI_PAL_CODE
 			 */
-			e820_type = E820_RESERVED;
+			if (md->attribute & EFI_MEMORY_RUNTIME)
+				e820_type = E820_RESERVED_EFI;
+			else
+				e820_type = E820_RESERVED;
 			break;
 		}
 		e820_add_region(start, size, e820_type);
@@ -669,10 +676,21 @@ void __init efi_enter_virtual_mode(void)
 		end_pfn = PFN_UP(end);
 		if (end_pfn <= max_low_pfn_mapped
 		    || (end_pfn > (1UL << (32 - PAGE_SHIFT))
-			&& end_pfn <= max_pfn_mapped))
+			&& end_pfn <= max_pfn_mapped)) {
 			va = __va(md->phys_addr);
-		else
-			va = efi_ioremap(md->phys_addr, size, md->type);
+
+			if (!(md->attribute & EFI_MEMORY_WB)) {
+				addr = (u64) (unsigned long)va;
+				npages = md->num_pages;
+				memrange_efi_to_native(&addr, &npages);
+				set_memory_uc(addr, npages);
+			}
+		} else {
+			if (!(md->attribute & EFI_MEMORY_WB))
+				va = ioremap_nocache(md->phys_addr, size);
+			else
+				va = ioremap_cache(md->phys_addr, size);
+		}
 
 		md->virt_addr = (u64) (unsigned long) va;
 
@@ -682,13 +700,6 @@ void __init efi_enter_virtual_mode(void)
 			continue;
 		}
 
-		if (!(md->attribute & EFI_MEMORY_WB)) {
-			addr = md->virt_addr;
-			npages = md->num_pages;
-			memrange_efi_to_native(&addr, &npages);
-			set_memory_uc(addr, npages);
-		}
-
 		systab = (u64) (unsigned long) efi_phys.systab;
 		if (md->phys_addr <= systab && systab < end) {
 			systab += md->virt_addr - md->phys_addr;
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index ac3aa54..312250c 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -80,20 +80,3 @@ void __init efi_call_phys_epilog(void)
 	local_irq_restore(efi_flags);
 	early_code_mapping_set_exec(0);
 }
-
-void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size,
-				 u32 type)
-{
-	unsigned long last_map_pfn;
-
-	if (type == EFI_MEMORY_MAPPED_IO)
-		return ioremap(phys_addr, size);
-
-	last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size);
-	if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) {
-		unsigned long top = last_map_pfn << PAGE_SHIFT;
-		efi_ioremap(top, size - (top - phys_addr), type);
-	}
-
-	return (void __iomem *)__va(phys_addr);
-}

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-02-23  1:16 ` [tip:x86/urgent] " tip-bot for Matt Fleming
@ 2012-02-23  2:20   ` Yinghai Lu
  2012-02-23  3:32     ` H. Peter Anvin
  2012-03-04  0:12   ` Keith Packard
  1 sibling, 1 reply; 28+ messages in thread
From: Yinghai Lu @ 2012-02-23  2:20 UTC (permalink / raw)
  To: mingo, hpa, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, matt.fleming, tglx
  Cc: linux-tip-commits

On Wed, Feb 22, 2012 at 5:16 PM, tip-bot for Matt Fleming
<matt.fleming@intel.com> wrote:
> Commit-ID:  f75bd1837564657b21431e44243e064a77276589
> Gitweb:     http://git.kernel.org/tip/f75bd1837564657b21431e44243e064a77276589
> Author:     Matt Fleming <matt.fleming@intel.com>
> AuthorDate: Mon, 20 Feb 2012 13:30:26 +0000
> Committer:  H. Peter Anvin <hpa@zytor.com>
> CommitDate: Wed, 22 Feb 2012 14:49:55 -0800
>
> x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
>
...
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index d7d5099..e22bb08 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -690,6 +690,8 @@ early_param("reservelow", parse_reservelow);
>
>  void __init setup_arch(char **cmdline_p)
>  {
> +       unsigned long end_pfn;
> +
>  #ifdef CONFIG_X86_32
>        memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
>        visws_early_detect();
> @@ -926,7 +928,24 @@ void __init setup_arch(char **cmdline_p)
>        init_gbpages();
>
>        /* max_pfn_mapped is updated here */
> -       max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
> +       end_pfn = max_low_pfn;
> +
> +#ifdef CONFIG_X86_64
> +       /*
> +        * There may be regions after the last E820_RAM region that we
> +        * want to include in the kernel direct mapping because their
> +        * contents are needed at runtime.
> +        */
> +       if (efi_enabled) {
> +               unsigned long efi_end;
> +
> +               efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI);

> +               if (efi_end > end_pfn)
> +                       end_pfn = efi_end;
> +       }
> +#endif
> +
> +       max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);


Why is MAXMEM used here?

EFI reserved area could be above 4G?

if that is the case, you will map all mmio hole below 4g.

        Yinghai

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-02-23  2:20   ` Yinghai Lu
@ 2012-02-23  3:32     ` H. Peter Anvin
  2012-02-23 10:36       ` Yinghai Lu
  0 siblings, 1 reply; 28+ messages in thread
From: H. Peter Anvin @ 2012-02-23  3:32 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: mingo, mjg, linux-kernel, keithp, rui.zhang, huang.ying.caritas,
	stable, matt.fleming, tglx, linux-tip-commits

On 02/22/2012 06:20 PM, Yinghai Lu wrote:
> 
> Why is MAXMEM used here?
> 
> EFI reserved area could be above 4G?
> 
> if that is the case, you will map all mmio hole below 4g.
> 

OK, dropping this patch for now, at least from -urgent.

We really need to restrict the memory types we map, at least without
ioremap() called on them.  In theory, on x86-64, we could have a
dedicated "1:1" address for each physical address, but there is no good
reason we should ever map memory types other than RAM, ACPI and EFI by
default -- with the possible exception of the low 1 MiB legacy area.

Therefore, I don't see why on Earth we have
kernel_physical_mapping_init() create mappings for areas which are not
RAM.  It has access to the memory map at this point, so there is no
reason for it.  Unfortunately I think we still have a bunch of code
which implicitly assumes the old "PC" model with separate contiguous
memory ranges starting at 0, 1 MiB, and 4 GiB, however, there are more
and more systems where that just doesn't match reality.


	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-02-23  3:32     ` H. Peter Anvin
@ 2012-02-23 10:36       ` Yinghai Lu
  2012-02-24  4:47         ` H. Peter Anvin
  0 siblings, 1 reply; 28+ messages in thread
From: Yinghai Lu @ 2012-02-23 10:36 UTC (permalink / raw)
  To: H. Peter Anvin, matt.fleming, mingo
  Cc: mjg, linux-kernel, keithp, rui.zhang, huang.ying.caritas, stable,
	tglx, linux-tip-commits

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

On Wed, Feb 22, 2012 at 7:32 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 02/22/2012 06:20 PM, Yinghai Lu wrote:
>>
>> Why is MAXMEM used here?
>>
>> EFI reserved area could be above 4G?
>>
>> if that is the case, you will map all mmio hole below 4g.
>>
>
> OK, dropping this patch for now, at least from -urgent.
>
> We really need to restrict the memory types we map, at least without
> ioremap() called on them.  In theory, on x86-64, we could have a
> dedicated "1:1" address for each physical address, but there is no good
> reason we should ever map memory types other than RAM, ACPI and EFI by
> default -- with the possible exception of the low 1 MiB legacy area.

please check attach patch for tip/efi branch.

Thanks

       Yinghai

[-- Attachment #2: fix_efi_map_end.patch --]
[-- Type: text/x-patch, Size: 2322 bytes --]

Subject: [PATCH] x86, efi: use e820_end_pfn_efi with low_pfn and max_pfn
From: Yinghai Lu <yinghai@kernel.org>

So avoid to map mmio below 4g, if system have EFI range above 4g.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/setup.c |   42 ++++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)

Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -681,6 +681,27 @@ static int __init parse_reservelow(char
 
 early_param("reservelow", parse_reservelow);
 
+static unsigned long __init e820_end_pfn_efi(unsigned long end_pfn,
+					     unsigned long limit_pfn)
+{
+#ifdef CONFIG_X86_64
+	/*
+	 * There may be regions after the last E820_RAM region that we
+	 * want to include in the kernel direct mapping because their
+	 * contents are needed at runtime.
+	 */
+	if (efi_enabled) {
+		unsigned long efi_end;
+
+		efi_end = e820_end_pfn(limit_pfn, E820_RESERVED_EFI);
+		if (efi_end > end_pfn)
+			end_pfn = efi_end;
+	}
+#endif
+
+	return end_pfn;
+}
+
 /*
  * Determine if we were loaded by an EFI loader.  If so, then we have also been
  * passed the efi memmap, systab, etc., so we should use these data structures
@@ -934,30 +955,15 @@ void __init setup_arch(char **cmdline_p)
 	init_gbpages();
 
 	/* max_pfn_mapped is updated here */
-	end_pfn = max_low_pfn;
-
-#ifdef CONFIG_X86_64
-	/*
-	 * There may be regions after the last E820_RAM region that we
-	 * want to include in the kernel direct mapping because their
-	 * contents are needed at runtime.
-	 */
-	if (efi_enabled) {
-		unsigned long efi_end;
-
-		efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI);
-		if (efi_end > end_pfn)
-			end_pfn = efi_end;
-	}
-#endif
-
+	end_pfn = e820_end_pfn_efi(max_low_pfn, 1UL<<(32-PAGE_SHIFT));
 	max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
 	max_pfn_mapped = max_low_pfn_mapped;
 
 #ifdef CONFIG_X86_64
 	if (max_pfn > max_low_pfn) {
+		end_pfn = e820_end_pfn_efi(max_pfn, MAXMEM>>PAGE_SHIFT);
 		max_pfn_mapped = init_memory_mapping(1UL<<32,
-						     max_pfn<<PAGE_SHIFT);
+						     end_pfn<<PAGE_SHIFT);
 		/* can we preseve max_low_pfn ?*/
 		max_low_pfn = max_pfn;
 	}

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-02-23 10:36       ` Yinghai Lu
@ 2012-02-24  4:47         ` H. Peter Anvin
  2012-02-28  2:27           ` H. Peter Anvin
  0 siblings, 1 reply; 28+ messages in thread
From: H. Peter Anvin @ 2012-02-24  4:47 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: matt.fleming, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On 02/23/2012 02:36 AM, Yinghai Lu wrote:
> On Wed, Feb 22, 2012 at 7:32 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> On 02/22/2012 06:20 PM, Yinghai Lu wrote:
>>>
>>> Why is MAXMEM used here?
>>>
>>> EFI reserved area could be above 4G?
>>>
>>> if that is the case, you will map all mmio hole below 4g.
>>>
>>
>> OK, dropping this patch for now, at least from -urgent.
>>
>> We really need to restrict the memory types we map, at least without
>> ioremap() called on them.  In theory, on x86-64, we could have a
>> dedicated "1:1" address for each physical address, but there is no good
>> reason we should ever map memory types other than RAM, ACPI and EFI by
>> default -- with the possible exception of the low 1 MiB legacy area.
> 
> please check attach patch for tip/efi branch.

That doesn't do anything like what I noted above.

We should get rid of dependencies on legacy PC memory layouts, not add
more hacks.  What is so hard about "when we create the initial mappings,
only create for RAM/ACPI/EFI regions" (if we even need to do so for
ACPI, I think ACPI might use ioremap() already)?

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-02-24  4:47         ` H. Peter Anvin
@ 2012-02-28  2:27           ` H. Peter Anvin
  2012-03-07 10:30             ` Matt Fleming
  0 siblings, 1 reply; 28+ messages in thread
From: H. Peter Anvin @ 2012-02-28  2:27 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: matt.fleming, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On 02/23/2012 08:47 PM, H. Peter Anvin wrote:
>>
>> please check attach patch for tip/efi branch.
> 
> That doesn't do anything like what I noted above.
> 
> We should get rid of dependencies on legacy PC memory layouts, not add
> more hacks.  What is so hard about "when we create the initial mappings,
> only create for RAM/ACPI/EFI regions" (if we even need to do so for
> ACPI, I think ACPI might use ioremap() already)?
> 

Hi Yinghai,

Can you please answer my question?

	-hpa


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

* Re: [PATCH] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-02-20 13:30 [PATCH] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops Matt Fleming
  2012-02-23  1:16 ` [tip:x86/urgent] " tip-bot for Matt Fleming
@ 2012-02-28  2:33 ` H. Peter Anvin
  2012-02-28 17:35   ` Matt Fleming
  1 sibling, 1 reply; 28+ messages in thread
From: H. Peter Anvin @ 2012-02-28  2:33 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Ingo Molnar, linux-kernel, Matthew Garrett, Zhang Rui,
	Huang Ying, Keith Packard, Matt Fleming, Thomas Gleixner

On 02/20/2012 05:30 AM, Matt Fleming wrote:
> 
> Despite first impressions, it's not possible to use ioremap_cache() to
> map all cached memory regions on CONFIG_X86_64 because of the way that
> the memory map might be configured as detailed in the following bug
> report,
> 
> 	https://bugzilla.redhat.com/show_bug.cgi?id=748516
> 
> Therefore, we need to ensure that any regions requiring a runtime
> mapping are covered by the direct kernel mapping table. Previously,
> this was taken care of by efi_ioremap() but if we handle this case
> earlier, in setup_arch(), we can delete the CONFIG_X86_32 and
> CONFIG_X86_64 efi_ioremap() implementations entirely.
> 

I went through the bug report but it's not entirely clear to me what the
fundamental root cause of the problem is, as opposed to what are
symptoms.  We need to straighten this out, and we need to do so fairly soon.

It would seem logical that we include in the kernel memory mapping the
regions we need, and *ONLY* the regions necessary; in particular we
shouldn't include *any* memory holes except for the < 1 MiB legacy
region (which is okay because of fixed MTRRs, but even that should be
eventually nuked.  That will require driver work hough.)

As I said, in a lot of ways the right thing would be for ioremap() to
manifest mappings in the standard 1:1 position, but when I very very
briefly looked at it it look ed like that would require core changes
which probably makes it too much work.

	-hpa



-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: [PATCH] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-02-28  2:33 ` [PATCH] " H. Peter Anvin
@ 2012-02-28 17:35   ` Matt Fleming
  0 siblings, 0 replies; 28+ messages in thread
From: Matt Fleming @ 2012-02-28 17:35 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, linux-kernel, Matthew Garrett, Zhang Rui,
	Huang Ying, Keith Packard, Thomas Gleixner

On Mon, 2012-02-27 at 18:33 -0800, H. Peter Anvin wrote:
> On 02/20/2012 05:30 AM, Matt Fleming wrote:
> > 
> > Despite first impressions, it's not possible to use ioremap_cache() to
> > map all cached memory regions on CONFIG_X86_64 because of the way that
> > the memory map might be configured as detailed in the following bug
> > report,
> > 
> > 	https://bugzilla.redhat.com/show_bug.cgi?id=748516
> > 
> > Therefore, we need to ensure that any regions requiring a runtime
> > mapping are covered by the direct kernel mapping table. Previously,
> > this was taken care of by efi_ioremap() but if we handle this case
> > earlier, in setup_arch(), we can delete the CONFIG_X86_32 and
> > CONFIG_X86_64 efi_ioremap() implementations entirely.
> > 
> 
> I went through the bug report but it's not entirely clear to me what the
> fundamental root cause of the problem is, as opposed to what are
> symptoms.  We need to straighten this out, and we need to do so fairly soon.

Right. Honestly, I'm not sure what the root cause is. What is clear is
that we can't arbitrarily map EFI_RUNTIME_SERVICES* regions with
ioremap(), but not why we can't do that. I suspect the only way to
deduce the root cause is to figure out how to make it work.

It might be possible to map the EFI runtime regions with ioremap() as
long as we maintain the same distance between regions as in the initial
physical memory map. But I don't have a Macbook Air to test that idea
out on and trying to solicit testers for previous patches hasn't gone
very well.

> It would seem logical that we include in the kernel memory mapping the
> regions we need, and *ONLY* the regions necessary; in particular we
> shouldn't include *any* memory holes except for the < 1 MiB legacy
> region (which is okay because of fixed MTRRs, but even that should be
> eventually nuked.  That will require driver work hough.)

Seems fair enough. Note that this patch doesn't change that behaviour,
the holes were mapped prior to this.

-- 
Matt Fleming, Intel Open Source Technology Center


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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-02-23  1:16 ` [tip:x86/urgent] " tip-bot for Matt Fleming
  2012-02-23  2:20   ` Yinghai Lu
@ 2012-03-04  0:12   ` Keith Packard
  2012-03-04  0:27     ` H. Peter Anvin
  1 sibling, 1 reply; 28+ messages in thread
From: Keith Packard @ 2012-03-04  0:12 UTC (permalink / raw)
  To: mingo, hpa, mjg, linux-kernel, rui.zhang, huang.ying.caritas,
	stable, matt.fleming, tglx, linux-tip-commits
  Cc: linux-kernel, mjg, hpa, mingo, rui.zhang, stable,
	huang.ying.caritas, matt.fleming, tglx

<#part sign=pgpmime>
On Wed, 22 Feb 2012 17:16:49 -0800, tip-bot for Matt Fleming <matt.fleming@intel.com> wrote:

> x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops

This seems no different from the old fix -- I get 'Loading ...' and then
a nice black screen on my MacBook Air.

-- 
keith.packard@intel.com

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-04  0:12   ` Keith Packard
@ 2012-03-04  0:27     ` H. Peter Anvin
  2012-03-04  1:33       ` Keith Packard
  0 siblings, 1 reply; 28+ messages in thread
From: H. Peter Anvin @ 2012-03-04  0:27 UTC (permalink / raw)
  To: Keith Packard
  Cc: mingo, mjg, linux-kernel, rui.zhang, huang.ying.caritas, stable,
	matt.fleming, tglx, linux-tip-commits

On 03/03/2012 04:12 PM, Keith Packard wrote:
> <#part sign=pgpmime>
> On Wed, 22 Feb 2012 17:16:49 -0800, tip-bot for Matt Fleming <matt.fleming@intel.com> wrote:
> 
>> x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
> 
> This seems no different from the old fix -- I get 'Loading ...' and then
> a nice black screen on my MacBook Air.
> 

Do you have the dmesg from your MBA?  I'm wondering what the memory map
looks like...

	-hpa


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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-04  0:27     ` H. Peter Anvin
@ 2012-03-04  1:33       ` Keith Packard
  2012-03-05 10:45         ` Ingo Molnar
  2012-03-05 11:48         ` Matt Fleming
  0 siblings, 2 replies; 28+ messages in thread
From: Keith Packard @ 2012-03-04  1:33 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: mingo, mjg, linux-kernel, rui.zhang, huang.ying.caritas, stable,
	matt.fleming, tglx, linux-tip-commits

<#part sign=pgpmime>
On Sat, 03 Mar 2012 16:27:28 -0800, "H. Peter Anvin" <hpa@zytor.com> wrote:

> Do you have the dmesg from your MBA?  I'm wondering what the memory map
> looks like...

Here's the first part of dmesg from a running kernel (3.3-rc1 plus some
DRM patches). Let me know if I cut this off too soon...

[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.3.0-rc1-00289-ga4ea430 (keithp@sumi) (gcc version 4.6.2 (Debian 4.6.2-11) ) #252 SMP Mon Jan 30 19:49:20 PST 2012
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.3.0-rc1-00289-ga4ea430 root=/dev/sda4 ro
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000008f000 (usable)
[    0.000000]  BIOS-e820: 000000000008f000 - 0000000000090000 (reserved)
[    0.000000]  BIOS-e820: 0000000000090000 - 00000000000a0000 (usable)
[    0.000000]  BIOS-e820: 00000000000a0000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 0000000020000000 (usable)
[    0.000000]  BIOS-e820: 0000000020000000 - 0000000020200000 (reserved)
[    0.000000]  BIOS-e820: 0000000020200000 - 0000000040000000 (usable)
[    0.000000]  BIOS-e820: 0000000040000000 - 0000000040200000 (reserved)
[    0.000000]  BIOS-e820: 0000000040200000 - 000000008ad36000 (usable)
[    0.000000]  BIOS-e820: 000000008ad36000 - 000000008ad5f000 (ACPI NVS)
[    0.000000]  BIOS-e820: 000000008ad5f000 - 000000008ad6f000 (usable)
[    0.000000]  BIOS-e820: 000000008ad6f000 - 000000008ad8f000 (ACPI data)
[    0.000000]  BIOS-e820: 000000008ad8f000 - 000000008ae33000 (usable)
[    0.000000]  BIOS-e820: 000000008ae33000 - 000000008ae8f000 (reserved)
[    0.000000]  BIOS-e820: 000000008ae8f000 - 000000008aed2000 (usable)
[    0.000000]  BIOS-e820: 000000008aed2000 - 000000008aeff000 (reserved)
[    0.000000]  BIOS-e820: 000000008aeff000 - 000000008afa2000 (usable)
[    0.000000]  BIOS-e820: 000000008afa2000 - 000000008fa00000 (reserved)
[    0.000000]  BIOS-e820: 00000000e00f8000 - 00000000e00f9000 (reserved)
[    0.000000]  BIOS-e820: 00000000fed1c000 - 00000000fed20000 (reserved)
[    0.000000]  BIOS-e820: 00000000ffed0000 - 00000000fff00000 (reserved)
[    0.000000]  BIOS-e820: 0000000100000000 - 000000016fe00000 (usable)
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] EFI v1.10 by Apple
[    0.000000]  ACPI=0x8ad8e000  ACPI 2.0=0x8ad8e014  SMBIOS=0x8ad3d000 
[    0.000000] Kernel-defined memdesc doesn't match the one from EFI!
[    0.000000] EFI: mem00: type=7, attr=0x80000000000000f, range=[0x0000000000000000-0x000000000008f000) (0MB)
[    0.000000] EFI: mem01: type=0, attr=0x80000000000000f, range=[0x000000000008f000-0x0000000000090000) (0MB)
[    0.000000] EFI: mem02: type=7, attr=0x80000000000000f, range=[0x0000000000090000-0x00000000000a0000) (0MB)
[    0.000000] EFI: mem03: type=2, attr=0xf, range=[0x0000000000100000-0x000000000044f000) (3MB)
[    0.000000] EFI: mem04: type=7, attr=0xf, range=[0x000000000044f000-0x0000000020000000) (507MB)
[    0.000000] EFI: mem05: type=0, attr=0xf, range=[0x0000000020000000-0x0000000020200000) (2MB)
[    0.000000] EFI: mem06: type=7, attr=0xf, range=[0x0000000020200000-0x0000000040000000) (510MB)
[    0.000000] EFI: mem07: type=0, attr=0xf, range=[0x0000000040000000-0x0000000040200000) (2MB)
[    0.000000] EFI: mem08: type=7, attr=0xf, range=[0x0000000040200000-0x0000000065b77000) (601MB)
[    0.000000] EFI: mem09: type=2, attr=0xf, range=[0x0000000065b77000-0x0000000087d1e000) (545MB)
[    0.000000] EFI: mem10: type=4, attr=0xf, range=[0x0000000087d1e000-0x0000000087d30000) (0MB)
[    0.000000] EFI: mem11: type=7, attr=0xf, range=[0x0000000087d30000-0x00000000889d2000) (12MB)
[    0.000000] EFI: mem12: type=1, attr=0xf, range=[0x00000000889d2000-0x00000000889f3000) (0MB)
[    0.000000] EFI: mem13: type=7, attr=0xf, range=[0x00000000889f3000-0x0000000088a10000) (0MB)
[    0.000000] EFI: mem14: type=4, attr=0xf, range=[0x0000000088a10000-0x0000000088a23000) (0MB)
[    0.000000] EFI: mem15: type=2, attr=0xf, range=[0x0000000088a23000-0x0000000088a82000) (0MB)
[    0.000000] EFI: mem16: type=4, attr=0xf, range=[0x0000000088a82000-0x0000000088a85000) (0MB)
[    0.000000] EFI: mem17: type=2, attr=0xf, range=[0x0000000088a85000-0x0000000088acd000) (0MB)
[    0.000000] EFI: mem18: type=4, attr=0xf, range=[0x0000000088acd000-0x0000000088ad4000) (0MB)
[    0.000000] EFI: mem19: type=2, attr=0xf, range=[0x0000000088ad4000-0x0000000088ad6000) (0MB)
[    0.000000] EFI: mem20: type=4, attr=0xf, range=[0x0000000088ad6000-0x0000000088af3000) (0MB)
[    0.000000] EFI: mem21: type=1, attr=0xf, range=[0x0000000088af3000-0x0000000088b10000) (0MB)
[    0.000000] EFI: mem22: type=4, attr=0xf, range=[0x0000000088b10000-0x0000000088b28000) (0MB)
[    0.000000] EFI: mem23: type=2, attr=0xf, range=[0x0000000088b28000-0x0000000088b2d000) (0MB)
[    0.000000] EFI: mem24: type=4, attr=0xf, range=[0x0000000088b2d000-0x0000000088b3b000) (0MB)
[    0.000000] EFI: mem25: type=2, attr=0xf, range=[0x0000000088b3b000-0x0000000088b3c000) (0MB)
[    0.000000] EFI: mem26: type=4, attr=0xf, range=[0x0000000088b3c000-0x0000000088b3d000) (0MB)
[    0.000000] EFI: mem27: type=2, attr=0xf, range=[0x0000000088b3d000-0x0000000088b45000) (0MB)
[    0.000000] EFI: mem28: type=4, attr=0xf, range=[0x0000000088b45000-0x0000000089491000) (9MB)
[    0.000000] EFI: mem29: type=3, attr=0xf, range=[0x0000000089491000-0x0000000089492000) (0MB)
[    0.000000] EFI: mem30: type=4, attr=0xf, range=[0x0000000089492000-0x000000008960b000) (1MB)
[    0.000000] EFI: mem31: type=3, attr=0xf, range=[0x000000008960b000-0x0000000089610000) (0MB)
[    0.000000] EFI: mem32: type=4, attr=0xf, range=[0x0000000089610000-0x000000008962c000) (0MB)
[    0.000000] EFI: mem33: type=3, attr=0xf, range=[0x000000008962c000-0x0000000089635000) (0MB)
[    0.000000] EFI: mem34: type=4, attr=0xf, range=[0x0000000089635000-0x0000000089637000) (0MB)
[    0.000000] EFI: mem35: type=3, attr=0xf, range=[0x0000000089637000-0x0000000089638000) (0MB)
[    0.000000] EFI: mem36: type=4, attr=0xf, range=[0x0000000089638000-0x0000000089639000) (0MB)
[    0.000000] EFI: mem37: type=3, attr=0xf, range=[0x0000000089639000-0x000000008963a000) (0MB)
[    0.000000] EFI: mem38: type=4, attr=0xf, range=[0x000000008963a000-0x000000008963c000) (0MB)
[    0.000000] EFI: mem39: type=3, attr=0xf, range=[0x000000008963c000-0x0000000089641000) (0MB)
[    0.000000] EFI: mem40: type=4, attr=0xf, range=[0x0000000089641000-0x0000000089655000) (0MB)
[    0.000000] EFI: mem41: type=3, attr=0xf, range=[0x0000000089655000-0x0000000089659000) (0MB)
[    0.000000] EFI: mem42: type=4, attr=0xf, range=[0x0000000089659000-0x0000000089660000) (0MB)
[    0.000000] EFI: mem43: type=3, attr=0xf, range=[0x0000000089660000-0x0000000089661000) (0MB)
[    0.000000] EFI: mem44: type=4, attr=0xf, range=[0x0000000089661000-0x0000000089664000) (0MB)
[    0.000000] EFI: mem45: type=3, attr=0xf, range=[0x0000000089664000-0x000000008966e000) (0MB)
[    0.000000] EFI: mem46: type=4, attr=0xf, range=[0x000000008966e000-0x0000000089673000) (0MB)
[    0.000000] EFI: mem47: type=3, attr=0xf, range=[0x0000000089673000-0x0000000089675000) (0MB)
[    0.000000] EFI: mem48: type=4, attr=0xf, range=[0x0000000089675000-0x000000008969a000) (0MB)
[    0.000000] EFI: mem49: type=3, attr=0xf, range=[0x000000008969a000-0x000000008969d000) (0MB)
[    0.000000] EFI: mem50: type=4, attr=0xf, range=[0x000000008969d000-0x00000000896ad000) (0MB)
[    0.000000] EFI: mem51: type=3, attr=0xf, range=[0x00000000896ad000-0x00000000896b1000) (0MB)
[    0.000000] EFI: mem52: type=4, attr=0xf, range=[0x00000000896b1000-0x00000000896d6000) (0MB)
[    0.000000] EFI: mem53: type=3, attr=0xf, range=[0x00000000896d6000-0x00000000896eb000) (0MB)
[    0.000000] EFI: mem54: type=4, attr=0xf, range=[0x00000000896eb000-0x00000000896f6000) (0MB)
[    0.000000] EFI: mem55: type=3, attr=0xf, range=[0x00000000896f6000-0x000000008970b000) (0MB)
[    0.000000] EFI: mem56: type=4, attr=0xf, range=[0x000000008970b000-0x0000000089710000) (0MB)
[    0.000000] EFI: mem57: type=3, attr=0xf, range=[0x0000000089710000-0x0000000089719000) (0MB)
[    0.000000] EFI: mem58: type=4, attr=0xf, range=[0x0000000089719000-0x0000000089726000) (0MB)
[    0.000000] EFI: mem59: type=3, attr=0xf, range=[0x0000000089726000-0x0000000089739000) (0MB)
[    0.000000] EFI: mem60: type=4, attr=0xf, range=[0x0000000089739000-0x000000008973a000) (0MB)
[    0.000000] EFI: mem61: type=3, attr=0xf, range=[0x000000008973a000-0x000000008973c000) (0MB)
[    0.000000] EFI: mem62: type=4, attr=0xf, range=[0x000000008973c000-0x0000000089742000) (0MB)
[    0.000000] EFI: mem63: type=3, attr=0xf, range=[0x0000000089742000-0x0000000089743000) (0MB)
[    0.000000] EFI: mem64: type=4, attr=0xf, range=[0x0000000089743000-0x0000000089744000) (0MB)
[    0.000000] EFI: mem65: type=3, attr=0xf, range=[0x0000000089744000-0x0000000089748000) (0MB)
[    0.000000] EFI: mem66: type=4, attr=0xf, range=[0x0000000089748000-0x000000008974a000) (0MB)
[    0.000000] EFI: mem67: type=3, attr=0xf, range=[0x000000008974a000-0x000000008974b000) (0MB)
[    0.000000] EFI: mem68: type=4, attr=0xf, range=[0x000000008974b000-0x000000008974f000) (0MB)
[    0.000000] EFI: mem69: type=3, attr=0xf, range=[0x000000008974f000-0x0000000089752000) (0MB)
[    0.000000] EFI: mem70: type=4, attr=0xf, range=[0x0000000089752000-0x0000000089753000) (0MB)
[    0.000000] EFI: mem71: type=3, attr=0xf, range=[0x0000000089753000-0x0000000089754000) (0MB)
[    0.000000] EFI: mem72: type=4, attr=0xf, range=[0x0000000089754000-0x0000000089755000) (0MB)
[    0.000000] EFI: mem73: type=3, attr=0xf, range=[0x0000000089755000-0x0000000089759000) (0MB)
[    0.000000] EFI: mem74: type=4, attr=0xf, range=[0x0000000089759000-0x000000008975c000) (0MB)
[    0.000000] EFI: mem75: type=3, attr=0xf, range=[0x000000008975c000-0x000000008975d000) (0MB)
[    0.000000] EFI: mem76: type=4, attr=0xf, range=[0x000000008975d000-0x000000008975f000) (0MB)
[    0.000000] EFI: mem77: type=3, attr=0xf, range=[0x000000008975f000-0x0000000089761000) (0MB)
[    0.000000] EFI: mem78: type=4, attr=0xf, range=[0x0000000089761000-0x0000000089765000) (0MB)
[    0.000000] EFI: mem79: type=3, attr=0xf, range=[0x0000000089765000-0x0000000089769000) (0MB)
[    0.000000] EFI: mem80: type=4, attr=0xf, range=[0x0000000089769000-0x000000008976a000) (0MB)
[    0.000000] EFI: mem81: type=3, attr=0xf, range=[0x000000008976a000-0x000000008976b000) (0MB)
[    0.000000] EFI: mem82: type=4, attr=0xf, range=[0x000000008976b000-0x000000008976e000) (0MB)
[    0.000000] EFI: mem83: type=3, attr=0xf, range=[0x000000008976e000-0x0000000089775000) (0MB)
[    0.000000] EFI: mem84: type=4, attr=0xf, range=[0x0000000089775000-0x0000000089776000) (0MB)
[    0.000000] EFI: mem85: type=3, attr=0xf, range=[0x0000000089776000-0x000000008977b000) (0MB)
[    0.000000] EFI: mem86: type=4, attr=0xf, range=[0x000000008977b000-0x000000008977f000) (0MB)
[    0.000000] EFI: mem87: type=3, attr=0xf, range=[0x000000008977f000-0x0000000089780000) (0MB)
[    0.000000] EFI: mem88: type=4, attr=0xf, range=[0x0000000089780000-0x0000000089781000) (0MB)
[    0.000000] EFI: mem89: type=3, attr=0xf, range=[0x0000000089781000-0x0000000089786000) (0MB)
[    0.000000] EFI: mem90: type=4, attr=0xf, range=[0x0000000089786000-0x0000000089788000) (0MB)
[    0.000000] EFI: mem91: type=3, attr=0xf, range=[0x0000000089788000-0x000000008978a000) (0MB)
[    0.000000] EFI: mem92: type=4, attr=0xf, range=[0x000000008978a000-0x000000008978b000) (0MB)
[    0.000000] EFI: mem93: type=3, attr=0xf, range=[0x000000008978b000-0x000000008978f000) (0MB)
[    0.000000] EFI: mem94: type=4, attr=0xf, range=[0x000000008978f000-0x00000000897a7000) (0MB)
[    0.000000] EFI: mem95: type=3, attr=0xf, range=[0x00000000897a7000-0x00000000897bb000) (0MB)
[    0.000000] EFI: mem96: type=4, attr=0xf, range=[0x00000000897bb000-0x00000000897be000) (0MB)
[    0.000000] EFI: mem97: type=3, attr=0xf, range=[0x00000000897be000-0x00000000897c2000) (0MB)
[    0.000000] EFI: mem98: type=4, attr=0xf, range=[0x00000000897c2000-0x00000000897c3000) (0MB)
[    0.000000] EFI: mem99: type=3, attr=0xf, range=[0x00000000897c3000-0x00000000897c5000) (0MB)
[    0.000000] EFI: mem100: type=4, attr=0xf, range=[0x00000000897c5000-0x00000000897c7000) (0MB)
[    0.000000] EFI: mem101: type=3, attr=0xf, range=[0x00000000897c7000-0x00000000897c9000) (0MB)
[    0.000000] EFI: mem102: type=4, attr=0xf, range=[0x00000000897c9000-0x00000000897ca000) (0MB)
[    0.000000] EFI: mem103: type=3, attr=0xf, range=[0x00000000897ca000-0x00000000897d7000) (0MB)
[    0.000000] EFI: mem104: type=4, attr=0xf, range=[0x00000000897d7000-0x00000000897d9000) (0MB)
[    0.000000] EFI: mem105: type=3, attr=0xf, range=[0x00000000897d9000-0x00000000897db000) (0MB)
[    0.000000] EFI: mem106: type=4, attr=0xf, range=[0x00000000897db000-0x00000000897e3000) (0MB)
[    0.000000] EFI: mem107: type=3, attr=0xf, range=[0x00000000897e3000-0x00000000897e6000) (0MB)
[    0.000000] EFI: mem108: type=4, attr=0xf, range=[0x00000000897e6000-0x00000000897e8000) (0MB)
[    0.000000] EFI: mem109: type=3, attr=0xf, range=[0x00000000897e8000-0x00000000897ea000) (0MB)
[    0.000000] EFI: mem110: type=4, attr=0xf, range=[0x00000000897ea000-0x00000000897ef000) (0MB)
[    0.000000] EFI: mem111: type=3, attr=0xf, range=[0x00000000897ef000-0x00000000897f5000) (0MB)
[    0.000000] EFI: mem112: type=4, attr=0xf, range=[0x00000000897f5000-0x00000000897f7000) (0MB)
[    0.000000] EFI: mem113: type=3, attr=0xf, range=[0x00000000897f7000-0x00000000897fe000) (0MB)
[    0.000000] EFI: mem114: type=4, attr=0xf, range=[0x00000000897fe000-0x0000000089800000) (0MB)
[    0.000000] EFI: mem115: type=3, attr=0xf, range=[0x0000000089800000-0x0000000089806000) (0MB)
[    0.000000] EFI: mem116: type=4, attr=0xf, range=[0x0000000089806000-0x000000008980a000) (0MB)
[    0.000000] EFI: mem117: type=3, attr=0xf, range=[0x000000008980a000-0x000000008980b000) (0MB)
[    0.000000] EFI: mem118: type=4, attr=0xf, range=[0x000000008980b000-0x000000008980c000) (0MB)
[    0.000000] EFI: mem119: type=3, attr=0xf, range=[0x000000008980c000-0x0000000089813000) (0MB)
[    0.000000] EFI: mem120: type=4, attr=0xf, range=[0x0000000089813000-0x0000000089815000) (0MB)
[    0.000000] EFI: mem121: type=3, attr=0xf, range=[0x0000000089815000-0x000000008981b000) (0MB)
[    0.000000] EFI: mem122: type=4, attr=0xf, range=[0x000000008981b000-0x000000008981f000) (0MB)
[    0.000000] EFI: mem123: type=3, attr=0xf, range=[0x000000008981f000-0x000000008982e000) (0MB)
[    0.000000] EFI: mem124: type=4, attr=0xf, range=[0x000000008982e000-0x000000008982f000) (0MB)
[    0.000000] EFI: mem125: type=3, attr=0xf, range=[0x000000008982f000-0x0000000089848000) (0MB)
[    0.000000] EFI: mem126: type=4, attr=0xf, range=[0x0000000089848000-0x0000000089849000) (0MB)
[    0.000000] EFI: mem127: type=3, attr=0xf, range=[0x0000000089849000-0x000000008984f000) (0MB)
[    0.000000] EFI: mem128: type=4, attr=0xf, range=[0x000000008984f000-0x0000000089853000) (0MB)
[    0.000000] EFI: mem129: type=3, attr=0xf, range=[0x0000000089853000-0x0000000089859000) (0MB)
[    0.000000] EFI: mem130: type=4, attr=0xf, range=[0x0000000089859000-0x000000008985a000) (0MB)
[    0.000000] EFI: mem131: type=3, attr=0xf, range=[0x000000008985a000-0x000000008985b000) (0MB)
[    0.000000] EFI: mem132: type=4, attr=0xf, range=[0x000000008985b000-0x000000008985f000) (0MB)
[    0.000000] EFI: mem133: type=3, attr=0xf, range=[0x000000008985f000-0x0000000089860000) (0MB)
[    0.000000] EFI: mem134: type=4, attr=0xf, range=[0x0000000089860000-0x0000000089865000) (0MB)
[    0.000000] EFI: mem135: type=3, attr=0xf, range=[0x0000000089865000-0x0000000089867000) (0MB)
[    0.000000] EFI: mem136: type=4, attr=0xf, range=[0x0000000089867000-0x0000000089869000) (0MB)
[    0.000000] EFI: mem137: type=3, attr=0xf, range=[0x0000000089869000-0x000000008986a000) (0MB)
[    0.000000] EFI: mem138: type=4, attr=0xf, range=[0x000000008986a000-0x000000008986d000) (0MB)
[    0.000000] EFI: mem139: type=3, attr=0xf, range=[0x000000008986d000-0x000000008986e000) (0MB)
[    0.000000] EFI: mem140: type=4, attr=0xf, range=[0x000000008986e000-0x000000008986f000) (0MB)
[    0.000000] EFI: mem141: type=3, attr=0xf, range=[0x000000008986f000-0x0000000089871000) (0MB)
[    0.000000] EFI: mem142: type=4, attr=0xf, range=[0x0000000089871000-0x0000000089873000) (0MB)
[    0.000000] EFI: mem143: type=3, attr=0xf, range=[0x0000000089873000-0x0000000089875000) (0MB)
[    0.000000] EFI: mem144: type=4, attr=0xf, range=[0x0000000089875000-0x0000000089877000) (0MB)
[    0.000000] EFI: mem145: type=3, attr=0xf, range=[0x0000000089877000-0x0000000089880000) (0MB)
[    0.000000] EFI: mem146: type=4, attr=0xf, range=[0x0000000089880000-0x0000000089881000) (0MB)
[    0.000000] EFI: mem147: type=3, attr=0xf, range=[0x0000000089881000-0x0000000089883000) (0MB)
[    0.000000] EFI: mem148: type=4, attr=0xf, range=[0x0000000089883000-0x0000000089884000) (0MB)
[    0.000000] EFI: mem149: type=3, attr=0xf, range=[0x0000000089884000-0x0000000089885000) (0MB)
[    0.000000] EFI: mem150: type=4, attr=0xf, range=[0x0000000089885000-0x000000008988a000) (0MB)
[    0.000000] EFI: mem151: type=3, attr=0xf, range=[0x000000008988a000-0x000000008988b000) (0MB)
[    0.000000] EFI: mem152: type=4, attr=0xf, range=[0x000000008988b000-0x0000000089890000) (0MB)
[    0.000000] EFI: mem153: type=3, attr=0xf, range=[0x0000000089890000-0x0000000089891000) (0MB)
[    0.000000] EFI: mem154: type=4, attr=0xf, range=[0x0000000089891000-0x0000000089892000) (0MB)
[    0.000000] EFI: mem155: type=3, attr=0xf, range=[0x0000000089892000-0x0000000089899000) (0MB)
[    0.000000] EFI: mem156: type=4, attr=0xf, range=[0x0000000089899000-0x000000008989e000) (0MB)
[    0.000000] EFI: mem157: type=3, attr=0xf, range=[0x000000008989e000-0x00000000898a0000) (0MB)
[    0.000000] EFI: mem158: type=4, attr=0xf, range=[0x00000000898a0000-0x00000000898a6000) (0MB)
[    0.000000] EFI: mem159: type=3, attr=0xf, range=[0x00000000898a6000-0x00000000898a7000) (0MB)
[    0.000000] EFI: mem160: type=4, attr=0xf, range=[0x00000000898a7000-0x00000000898a9000) (0MB)
[    0.000000] EFI: mem161: type=3, attr=0xf, range=[0x00000000898a9000-0x00000000898aa000) (0MB)
[    0.000000] EFI: mem162: type=4, attr=0xf, range=[0x00000000898aa000-0x00000000898db000) (0MB)
[    0.000000] EFI: mem163: type=3, attr=0xf, range=[0x00000000898db000-0x00000000898ee000) (0MB)
[    0.000000] EFI: mem164: type=4, attr=0xf, range=[0x00000000898ee000-0x0000000089934000) (0MB)
[    0.000000] EFI: mem165: type=3, attr=0xf, range=[0x0000000089934000-0x0000000089948000) (0MB)
[    0.000000] EFI: mem166: type=4, attr=0xf, range=[0x0000000089948000-0x0000000089949000) (0MB)
[    0.000000] EFI: mem167: type=3, attr=0xf, range=[0x0000000089949000-0x000000008994c000) (0MB)
[    0.000000] EFI: mem168: type=4, attr=0xf, range=[0x000000008994c000-0x0000000089968000) (0MB)
[    0.000000] EFI: mem169: type=3, attr=0xf, range=[0x0000000089968000-0x000000008996d000) (0MB)
[    0.000000] EFI: mem170: type=4, attr=0xf, range=[0x000000008996d000-0x000000008997a000) (0MB)
[    0.000000] EFI: mem171: type=3, attr=0xf, range=[0x000000008997a000-0x000000008997b000) (0MB)
[    0.000000] EFI: mem172: type=4, attr=0xf, range=[0x000000008997b000-0x000000008997c000) (0MB)
[    0.000000] EFI: mem173: type=3, attr=0xf, range=[0x000000008997c000-0x000000008997d000) (0MB)
[    0.000000] EFI: mem174: type=4, attr=0xf, range=[0x000000008997d000-0x000000008998f000) (0MB)
[    0.000000] EFI: mem175: type=3, attr=0xf, range=[0x000000008998f000-0x00000000899a4000) (0MB)
[    0.000000] EFI: mem176: type=4, attr=0xf, range=[0x00000000899a4000-0x00000000899a5000) (0MB)
[    0.000000] EFI: mem177: type=3, attr=0xf, range=[0x00000000899a5000-0x00000000899b1000) (0MB)
[    0.000000] EFI: mem178: type=4, attr=0xf, range=[0x00000000899b1000-0x00000000899b4000) (0MB)
[    0.000000] EFI: mem179: type=3, attr=0xf, range=[0x00000000899b4000-0x00000000899b8000) (0MB)
[    0.000000] EFI: mem180: type=4, attr=0xf, range=[0x00000000899b8000-0x0000000089dd9000) (4MB)
[    0.000000] EFI: mem181: type=3, attr=0xf, range=[0x0000000089dd9000-0x0000000089dde000) (0MB)
[    0.000000] EFI: mem182: type=4, attr=0xf, range=[0x0000000089dde000-0x0000000089ddf000) (0MB)
[    0.000000] EFI: mem183: type=3, attr=0xf, range=[0x0000000089ddf000-0x0000000089de1000) (0MB)
[    0.000000] EFI: mem184: type=4, attr=0xf, range=[0x0000000089de1000-0x0000000089de2000) (0MB)
[    0.000000] EFI: mem185: type=3, attr=0xf, range=[0x0000000089de2000-0x0000000089de5000) (0MB)
[    0.000000] EFI: mem186: type=4, attr=0xf, range=[0x0000000089de5000-0x0000000089de6000) (0MB)
[    0.000000] EFI: mem187: type=3, attr=0xf, range=[0x0000000089de6000-0x0000000089df3000) (0MB)
[    0.000000] EFI: mem188: type=4, attr=0xf, range=[0x0000000089df3000-0x0000000089df5000) (0MB)
[    0.000000] EFI: mem189: type=3, attr=0xf, range=[0x0000000089df5000-0x0000000089e02000) (0MB)
[    0.000000] EFI: mem190: type=4, attr=0xf, range=[0x0000000089e02000-0x0000000089e03000) (0MB)
[    0.000000] EFI: mem191: type=3, attr=0xf, range=[0x0000000089e03000-0x0000000089e06000) (0MB)
[    0.000000] EFI: mem192: type=4, attr=0xf, range=[0x0000000089e06000-0x0000000089e07000) (0MB)
[    0.000000] EFI: mem193: type=3, attr=0xf, range=[0x0000000089e07000-0x0000000089e08000) (0MB)
[    0.000000] EFI: mem194: type=4, attr=0xf, range=[0x0000000089e08000-0x000000008ad0f000) (15MB)
[    0.000000] EFI: mem195: type=7, attr=0xf, range=[0x000000008ad0f000-0x000000008ad36000) (0MB)
[    0.000000] EFI: mem196: type=10, attr=0xf, range=[0x000000008ad36000-0x000000008ad5f000) (0MB)
[    0.000000] EFI: mem197: type=7, attr=0xf, range=[0x000000008ad5f000-0x000000008ad6f000) (0MB)
[    0.000000] EFI: mem198: type=9, attr=0xf, range=[0x000000008ad6f000-0x000000008ad8f000) (0MB)
[    0.000000] EFI: mem199: type=7, attr=0xf, range=[0x000000008ad8f000-0x000000008ae33000) (0MB)
[    0.000000] EFI: mem200: type=6, attr=0x800000000000000f, range=[0x000000008ae33000-0x000000008ae8f000) (0MB)
[    0.000000] EFI: mem201: type=7, attr=0xf, range=[0x000000008ae8f000-0x000000008aed2000) (0MB)
[    0.000000] EFI: mem202: type=5, attr=0x800000000000000f, range=[0x000000008aed2000-0x000000008aeff000) (0MB)
[    0.000000] EFI: mem203: type=7, attr=0xf, range=[0x000000008aeff000-0x000000008af9a000) (0MB)
[    0.000000] EFI: mem204: type=2, attr=0xf, range=[0x000000008af9a000-0x000000008afa2000) (0MB)
[    0.000000] EFI: mem205: type=0, attr=0xf, range=[0x000000008afa2000-0x000000008afff000) (0MB)
[    0.000000] EFI: mem206: type=6, attr=0x800000000000000f, range=[0x000000008afff000-0x000000008b000000) (0MB)
[    0.000000] EFI: mem207: type=7, attr=0xf, range=[0x0000000100000000-0x000000016fe00000) (1790MB)
[    0.000000] EFI: mem208: type=0, attr=0x8000000000000000, range=[0x00000000000a0000-0x0000000000100000) (0MB)
[    0.000000] EFI: mem209: type=0, attr=0x8000000000000000, range=[0x000000008b000000-0x000000008fa00000) (74MB)
[    0.000000] EFI: mem210: type=11, attr=0x8000000000000000, range=[0x00000000e00f8000-0x00000000e00f9000) (0MB)
[    0.000000] EFI: mem211: type=11, attr=0x8000000000000000, range=[0x00000000fed1c000-0x00000000fed20000) (0MB)
[    0.000000] EFI: mem212: type=11, attr=0x8000000000000000, range=[0x00000000ffed0000-0x00000000fff00000) (0MB)
[    0.000000] DMI 2.4 present.
[    0.000000] DMI: Apple Inc. MacBookAir4,1/Mac-C08A6BB70A942AC2, BIOS MBA41.88Z.0077.B00.1106300929 06/30/2011
[    0.000000] e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
[    0.000000] e820 remove range: 00000000000a0000 - 0000000000100000 (usable)
[    0.000000] No AGP bridge found
[    0.000000] last_pfn = 0x16fe00 max_arch_pfn = 0x400000000
[    0.000000] MTRR default type: write-back
[    0.000000] MTRR fixed ranges enabled:
[    0.000000]   00000-9FFFF write-back
[    0.000000]   A0000-BFFFF uncachable
[    0.000000]   C0000-DFFFF write-protect
[    0.000000]   E0000-FFFFF uncachable
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 base 0C0000000 mask FC0000000 uncachable
[    0.000000]   1 base 0A0000000 mask FE0000000 uncachable
[    0.000000]   2 base 090000000 mask FF0000000 uncachable
[    0.000000]   3 base 08C000000 mask FFC000000 uncachable
[    0.000000]   4 base 08B800000 mask FFF800000 uncachable
[    0.000000]   5 disabled
[    0.000000]   6 disabled
[    0.000000]   7 disabled
[    0.000000]   8 disabled
[    0.000000]   9 disabled
[    0.000000] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
[    0.000000] last_pfn = 0x8afa2 max_arch_pfn = 0x400000000
[    0.000000] initial memory mapped : 0 - 20000000
[    0.000000] Base memory trampoline at [ffff88000009a000] 9a000 size 20480
[    0.000000] init_memory_mapping: 0000000000000000-000000008afa2000
[    0.000000]  0000000000 - 008ae00000 page 2M
[    0.000000]  008ae00000 - 008afa2000 page 4k
[    0.000000] kernel direct mapping tables up to 8afa2000 @ 1fffb000-20000000
[    0.000000] init_memory_mapping: 0000000100000000-000000016fe00000
[    0.000000]  0100000000 - 016fe00000 page 2M
[    0.000000] kernel direct mapping tables up to 16fe00000 @ 8af9b000-8afa2000

-- 
keith.packard@intel.com

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-04  1:33       ` Keith Packard
@ 2012-03-05 10:45         ` Ingo Molnar
  2012-03-07 18:31           ` Yinghai Lu
  2012-03-05 11:48         ` Matt Fleming
  1 sibling, 1 reply; 28+ messages in thread
From: Ingo Molnar @ 2012-03-05 10:45 UTC (permalink / raw)
  To: Keith Packard, Yinghai Lu
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, rui.zhang,
	huang.ying.caritas, stable, matt.fleming, tglx,
	linux-tip-commits, Linus Torvalds, Andrew Morton


( Cc:-ed Yinghai - he can spot memory layout related bugs with
  amazing efficiency. )

 n/t

* Keith Packard <keithp@keithp.com> wrote:

> <#part sign=pgpmime>
> On Sat, 03 Mar 2012 16:27:28 -0800, "H. Peter Anvin" <hpa@zytor.com> wrote:
> 
> > Do you have the dmesg from your MBA?  I'm wondering what the memory map
> > looks like...
> 
> Here's the first part of dmesg from a running kernel (3.3-rc1 plus some
> DRM patches). Let me know if I cut this off too soon...
> 
> [    0.000000] Initializing cgroup subsys cpuset
> [    0.000000] Initializing cgroup subsys cpu
> [    0.000000] Linux version 3.3.0-rc1-00289-ga4ea430 (keithp@sumi) (gcc version 4.6.2 (Debian 4.6.2-11) ) #252 SMP Mon Jan 30 19:49:20 PST 2012
> [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.3.0-rc1-00289-ga4ea430 root=/dev/sda4 ro
> [    0.000000] BIOS-provided physical RAM map:
> [    0.000000]  BIOS-e820: 0000000000000000 - 000000000008f000 (usable)
> [    0.000000]  BIOS-e820: 000000000008f000 - 0000000000090000 (reserved)
> [    0.000000]  BIOS-e820: 0000000000090000 - 00000000000a0000 (usable)
> [    0.000000]  BIOS-e820: 00000000000a0000 - 0000000000100000 (reserved)
> [    0.000000]  BIOS-e820: 0000000000100000 - 0000000020000000 (usable)
> [    0.000000]  BIOS-e820: 0000000020000000 - 0000000020200000 (reserved)
> [    0.000000]  BIOS-e820: 0000000020200000 - 0000000040000000 (usable)
> [    0.000000]  BIOS-e820: 0000000040000000 - 0000000040200000 (reserved)
> [    0.000000]  BIOS-e820: 0000000040200000 - 000000008ad36000 (usable)
> [    0.000000]  BIOS-e820: 000000008ad36000 - 000000008ad5f000 (ACPI NVS)
> [    0.000000]  BIOS-e820: 000000008ad5f000 - 000000008ad6f000 (usable)
> [    0.000000]  BIOS-e820: 000000008ad6f000 - 000000008ad8f000 (ACPI data)
> [    0.000000]  BIOS-e820: 000000008ad8f000 - 000000008ae33000 (usable)
> [    0.000000]  BIOS-e820: 000000008ae33000 - 000000008ae8f000 (reserved)
> [    0.000000]  BIOS-e820: 000000008ae8f000 - 000000008aed2000 (usable)
> [    0.000000]  BIOS-e820: 000000008aed2000 - 000000008aeff000 (reserved)
> [    0.000000]  BIOS-e820: 000000008aeff000 - 000000008afa2000 (usable)
> [    0.000000]  BIOS-e820: 000000008afa2000 - 000000008fa00000 (reserved)
> [    0.000000]  BIOS-e820: 00000000e00f8000 - 00000000e00f9000 (reserved)
> [    0.000000]  BIOS-e820: 00000000fed1c000 - 00000000fed20000 (reserved)
> [    0.000000]  BIOS-e820: 00000000ffed0000 - 00000000fff00000 (reserved)
> [    0.000000]  BIOS-e820: 0000000100000000 - 000000016fe00000 (usable)
> [    0.000000] NX (Execute Disable) protection: active
> [    0.000000] EFI v1.10 by Apple
> [    0.000000]  ACPI=0x8ad8e000  ACPI 2.0=0x8ad8e014  SMBIOS=0x8ad3d000 
> [    0.000000] Kernel-defined memdesc doesn't match the one from EFI!
> [    0.000000] EFI: mem00: type=7, attr=0x80000000000000f, range=[0x0000000000000000-0x000000000008f000) (0MB)
> [    0.000000] EFI: mem01: type=0, attr=0x80000000000000f, range=[0x000000000008f000-0x0000000000090000) (0MB)
> [    0.000000] EFI: mem02: type=7, attr=0x80000000000000f, range=[0x0000000000090000-0x00000000000a0000) (0MB)
> [    0.000000] EFI: mem03: type=2, attr=0xf, range=[0x0000000000100000-0x000000000044f000) (3MB)
> [    0.000000] EFI: mem04: type=7, attr=0xf, range=[0x000000000044f000-0x0000000020000000) (507MB)
> [    0.000000] EFI: mem05: type=0, attr=0xf, range=[0x0000000020000000-0x0000000020200000) (2MB)
> [    0.000000] EFI: mem06: type=7, attr=0xf, range=[0x0000000020200000-0x0000000040000000) (510MB)
> [    0.000000] EFI: mem07: type=0, attr=0xf, range=[0x0000000040000000-0x0000000040200000) (2MB)
> [    0.000000] EFI: mem08: type=7, attr=0xf, range=[0x0000000040200000-0x0000000065b77000) (601MB)
> [    0.000000] EFI: mem09: type=2, attr=0xf, range=[0x0000000065b77000-0x0000000087d1e000) (545MB)
> [    0.000000] EFI: mem10: type=4, attr=0xf, range=[0x0000000087d1e000-0x0000000087d30000) (0MB)
> [    0.000000] EFI: mem11: type=7, attr=0xf, range=[0x0000000087d30000-0x00000000889d2000) (12MB)
> [    0.000000] EFI: mem12: type=1, attr=0xf, range=[0x00000000889d2000-0x00000000889f3000) (0MB)
> [    0.000000] EFI: mem13: type=7, attr=0xf, range=[0x00000000889f3000-0x0000000088a10000) (0MB)
> [    0.000000] EFI: mem14: type=4, attr=0xf, range=[0x0000000088a10000-0x0000000088a23000) (0MB)
> [    0.000000] EFI: mem15: type=2, attr=0xf, range=[0x0000000088a23000-0x0000000088a82000) (0MB)
> [    0.000000] EFI: mem16: type=4, attr=0xf, range=[0x0000000088a82000-0x0000000088a85000) (0MB)
> [    0.000000] EFI: mem17: type=2, attr=0xf, range=[0x0000000088a85000-0x0000000088acd000) (0MB)
> [    0.000000] EFI: mem18: type=4, attr=0xf, range=[0x0000000088acd000-0x0000000088ad4000) (0MB)
> [    0.000000] EFI: mem19: type=2, attr=0xf, range=[0x0000000088ad4000-0x0000000088ad6000) (0MB)
> [    0.000000] EFI: mem20: type=4, attr=0xf, range=[0x0000000088ad6000-0x0000000088af3000) (0MB)
> [    0.000000] EFI: mem21: type=1, attr=0xf, range=[0x0000000088af3000-0x0000000088b10000) (0MB)
> [    0.000000] EFI: mem22: type=4, attr=0xf, range=[0x0000000088b10000-0x0000000088b28000) (0MB)
> [    0.000000] EFI: mem23: type=2, attr=0xf, range=[0x0000000088b28000-0x0000000088b2d000) (0MB)
> [    0.000000] EFI: mem24: type=4, attr=0xf, range=[0x0000000088b2d000-0x0000000088b3b000) (0MB)
> [    0.000000] EFI: mem25: type=2, attr=0xf, range=[0x0000000088b3b000-0x0000000088b3c000) (0MB)
> [    0.000000] EFI: mem26: type=4, attr=0xf, range=[0x0000000088b3c000-0x0000000088b3d000) (0MB)
> [    0.000000] EFI: mem27: type=2, attr=0xf, range=[0x0000000088b3d000-0x0000000088b45000) (0MB)
> [    0.000000] EFI: mem28: type=4, attr=0xf, range=[0x0000000088b45000-0x0000000089491000) (9MB)
> [    0.000000] EFI: mem29: type=3, attr=0xf, range=[0x0000000089491000-0x0000000089492000) (0MB)
> [    0.000000] EFI: mem30: type=4, attr=0xf, range=[0x0000000089492000-0x000000008960b000) (1MB)
> [    0.000000] EFI: mem31: type=3, attr=0xf, range=[0x000000008960b000-0x0000000089610000) (0MB)
> [    0.000000] EFI: mem32: type=4, attr=0xf, range=[0x0000000089610000-0x000000008962c000) (0MB)
> [    0.000000] EFI: mem33: type=3, attr=0xf, range=[0x000000008962c000-0x0000000089635000) (0MB)
> [    0.000000] EFI: mem34: type=4, attr=0xf, range=[0x0000000089635000-0x0000000089637000) (0MB)
> [    0.000000] EFI: mem35: type=3, attr=0xf, range=[0x0000000089637000-0x0000000089638000) (0MB)
> [    0.000000] EFI: mem36: type=4, attr=0xf, range=[0x0000000089638000-0x0000000089639000) (0MB)
> [    0.000000] EFI: mem37: type=3, attr=0xf, range=[0x0000000089639000-0x000000008963a000) (0MB)
> [    0.000000] EFI: mem38: type=4, attr=0xf, range=[0x000000008963a000-0x000000008963c000) (0MB)
> [    0.000000] EFI: mem39: type=3, attr=0xf, range=[0x000000008963c000-0x0000000089641000) (0MB)
> [    0.000000] EFI: mem40: type=4, attr=0xf, range=[0x0000000089641000-0x0000000089655000) (0MB)
> [    0.000000] EFI: mem41: type=3, attr=0xf, range=[0x0000000089655000-0x0000000089659000) (0MB)
> [    0.000000] EFI: mem42: type=4, attr=0xf, range=[0x0000000089659000-0x0000000089660000) (0MB)
> [    0.000000] EFI: mem43: type=3, attr=0xf, range=[0x0000000089660000-0x0000000089661000) (0MB)
> [    0.000000] EFI: mem44: type=4, attr=0xf, range=[0x0000000089661000-0x0000000089664000) (0MB)
> [    0.000000] EFI: mem45: type=3, attr=0xf, range=[0x0000000089664000-0x000000008966e000) (0MB)
> [    0.000000] EFI: mem46: type=4, attr=0xf, range=[0x000000008966e000-0x0000000089673000) (0MB)
> [    0.000000] EFI: mem47: type=3, attr=0xf, range=[0x0000000089673000-0x0000000089675000) (0MB)
> [    0.000000] EFI: mem48: type=4, attr=0xf, range=[0x0000000089675000-0x000000008969a000) (0MB)
> [    0.000000] EFI: mem49: type=3, attr=0xf, range=[0x000000008969a000-0x000000008969d000) (0MB)
> [    0.000000] EFI: mem50: type=4, attr=0xf, range=[0x000000008969d000-0x00000000896ad000) (0MB)
> [    0.000000] EFI: mem51: type=3, attr=0xf, range=[0x00000000896ad000-0x00000000896b1000) (0MB)
> [    0.000000] EFI: mem52: type=4, attr=0xf, range=[0x00000000896b1000-0x00000000896d6000) (0MB)
> [    0.000000] EFI: mem53: type=3, attr=0xf, range=[0x00000000896d6000-0x00000000896eb000) (0MB)
> [    0.000000] EFI: mem54: type=4, attr=0xf, range=[0x00000000896eb000-0x00000000896f6000) (0MB)
> [    0.000000] EFI: mem55: type=3, attr=0xf, range=[0x00000000896f6000-0x000000008970b000) (0MB)
> [    0.000000] EFI: mem56: type=4, attr=0xf, range=[0x000000008970b000-0x0000000089710000) (0MB)
> [    0.000000] EFI: mem57: type=3, attr=0xf, range=[0x0000000089710000-0x0000000089719000) (0MB)
> [    0.000000] EFI: mem58: type=4, attr=0xf, range=[0x0000000089719000-0x0000000089726000) (0MB)
> [    0.000000] EFI: mem59: type=3, attr=0xf, range=[0x0000000089726000-0x0000000089739000) (0MB)
> [    0.000000] EFI: mem60: type=4, attr=0xf, range=[0x0000000089739000-0x000000008973a000) (0MB)
> [    0.000000] EFI: mem61: type=3, attr=0xf, range=[0x000000008973a000-0x000000008973c000) (0MB)
> [    0.000000] EFI: mem62: type=4, attr=0xf, range=[0x000000008973c000-0x0000000089742000) (0MB)
> [    0.000000] EFI: mem63: type=3, attr=0xf, range=[0x0000000089742000-0x0000000089743000) (0MB)
> [    0.000000] EFI: mem64: type=4, attr=0xf, range=[0x0000000089743000-0x0000000089744000) (0MB)
> [    0.000000] EFI: mem65: type=3, attr=0xf, range=[0x0000000089744000-0x0000000089748000) (0MB)
> [    0.000000] EFI: mem66: type=4, attr=0xf, range=[0x0000000089748000-0x000000008974a000) (0MB)
> [    0.000000] EFI: mem67: type=3, attr=0xf, range=[0x000000008974a000-0x000000008974b000) (0MB)
> [    0.000000] EFI: mem68: type=4, attr=0xf, range=[0x000000008974b000-0x000000008974f000) (0MB)
> [    0.000000] EFI: mem69: type=3, attr=0xf, range=[0x000000008974f000-0x0000000089752000) (0MB)
> [    0.000000] EFI: mem70: type=4, attr=0xf, range=[0x0000000089752000-0x0000000089753000) (0MB)
> [    0.000000] EFI: mem71: type=3, attr=0xf, range=[0x0000000089753000-0x0000000089754000) (0MB)
> [    0.000000] EFI: mem72: type=4, attr=0xf, range=[0x0000000089754000-0x0000000089755000) (0MB)
> [    0.000000] EFI: mem73: type=3, attr=0xf, range=[0x0000000089755000-0x0000000089759000) (0MB)
> [    0.000000] EFI: mem74: type=4, attr=0xf, range=[0x0000000089759000-0x000000008975c000) (0MB)
> [    0.000000] EFI: mem75: type=3, attr=0xf, range=[0x000000008975c000-0x000000008975d000) (0MB)
> [    0.000000] EFI: mem76: type=4, attr=0xf, range=[0x000000008975d000-0x000000008975f000) (0MB)
> [    0.000000] EFI: mem77: type=3, attr=0xf, range=[0x000000008975f000-0x0000000089761000) (0MB)
> [    0.000000] EFI: mem78: type=4, attr=0xf, range=[0x0000000089761000-0x0000000089765000) (0MB)
> [    0.000000] EFI: mem79: type=3, attr=0xf, range=[0x0000000089765000-0x0000000089769000) (0MB)
> [    0.000000] EFI: mem80: type=4, attr=0xf, range=[0x0000000089769000-0x000000008976a000) (0MB)
> [    0.000000] EFI: mem81: type=3, attr=0xf, range=[0x000000008976a000-0x000000008976b000) (0MB)
> [    0.000000] EFI: mem82: type=4, attr=0xf, range=[0x000000008976b000-0x000000008976e000) (0MB)
> [    0.000000] EFI: mem83: type=3, attr=0xf, range=[0x000000008976e000-0x0000000089775000) (0MB)
> [    0.000000] EFI: mem84: type=4, attr=0xf, range=[0x0000000089775000-0x0000000089776000) (0MB)
> [    0.000000] EFI: mem85: type=3, attr=0xf, range=[0x0000000089776000-0x000000008977b000) (0MB)
> [    0.000000] EFI: mem86: type=4, attr=0xf, range=[0x000000008977b000-0x000000008977f000) (0MB)
> [    0.000000] EFI: mem87: type=3, attr=0xf, range=[0x000000008977f000-0x0000000089780000) (0MB)
> [    0.000000] EFI: mem88: type=4, attr=0xf, range=[0x0000000089780000-0x0000000089781000) (0MB)
> [    0.000000] EFI: mem89: type=3, attr=0xf, range=[0x0000000089781000-0x0000000089786000) (0MB)
> [    0.000000] EFI: mem90: type=4, attr=0xf, range=[0x0000000089786000-0x0000000089788000) (0MB)
> [    0.000000] EFI: mem91: type=3, attr=0xf, range=[0x0000000089788000-0x000000008978a000) (0MB)
> [    0.000000] EFI: mem92: type=4, attr=0xf, range=[0x000000008978a000-0x000000008978b000) (0MB)
> [    0.000000] EFI: mem93: type=3, attr=0xf, range=[0x000000008978b000-0x000000008978f000) (0MB)
> [    0.000000] EFI: mem94: type=4, attr=0xf, range=[0x000000008978f000-0x00000000897a7000) (0MB)
> [    0.000000] EFI: mem95: type=3, attr=0xf, range=[0x00000000897a7000-0x00000000897bb000) (0MB)
> [    0.000000] EFI: mem96: type=4, attr=0xf, range=[0x00000000897bb000-0x00000000897be000) (0MB)
> [    0.000000] EFI: mem97: type=3, attr=0xf, range=[0x00000000897be000-0x00000000897c2000) (0MB)
> [    0.000000] EFI: mem98: type=4, attr=0xf, range=[0x00000000897c2000-0x00000000897c3000) (0MB)
> [    0.000000] EFI: mem99: type=3, attr=0xf, range=[0x00000000897c3000-0x00000000897c5000) (0MB)
> [    0.000000] EFI: mem100: type=4, attr=0xf, range=[0x00000000897c5000-0x00000000897c7000) (0MB)
> [    0.000000] EFI: mem101: type=3, attr=0xf, range=[0x00000000897c7000-0x00000000897c9000) (0MB)
> [    0.000000] EFI: mem102: type=4, attr=0xf, range=[0x00000000897c9000-0x00000000897ca000) (0MB)
> [    0.000000] EFI: mem103: type=3, attr=0xf, range=[0x00000000897ca000-0x00000000897d7000) (0MB)
> [    0.000000] EFI: mem104: type=4, attr=0xf, range=[0x00000000897d7000-0x00000000897d9000) (0MB)
> [    0.000000] EFI: mem105: type=3, attr=0xf, range=[0x00000000897d9000-0x00000000897db000) (0MB)
> [    0.000000] EFI: mem106: type=4, attr=0xf, range=[0x00000000897db000-0x00000000897e3000) (0MB)
> [    0.000000] EFI: mem107: type=3, attr=0xf, range=[0x00000000897e3000-0x00000000897e6000) (0MB)
> [    0.000000] EFI: mem108: type=4, attr=0xf, range=[0x00000000897e6000-0x00000000897e8000) (0MB)
> [    0.000000] EFI: mem109: type=3, attr=0xf, range=[0x00000000897e8000-0x00000000897ea000) (0MB)
> [    0.000000] EFI: mem110: type=4, attr=0xf, range=[0x00000000897ea000-0x00000000897ef000) (0MB)
> [    0.000000] EFI: mem111: type=3, attr=0xf, range=[0x00000000897ef000-0x00000000897f5000) (0MB)
> [    0.000000] EFI: mem112: type=4, attr=0xf, range=[0x00000000897f5000-0x00000000897f7000) (0MB)
> [    0.000000] EFI: mem113: type=3, attr=0xf, range=[0x00000000897f7000-0x00000000897fe000) (0MB)
> [    0.000000] EFI: mem114: type=4, attr=0xf, range=[0x00000000897fe000-0x0000000089800000) (0MB)
> [    0.000000] EFI: mem115: type=3, attr=0xf, range=[0x0000000089800000-0x0000000089806000) (0MB)
> [    0.000000] EFI: mem116: type=4, attr=0xf, range=[0x0000000089806000-0x000000008980a000) (0MB)
> [    0.000000] EFI: mem117: type=3, attr=0xf, range=[0x000000008980a000-0x000000008980b000) (0MB)
> [    0.000000] EFI: mem118: type=4, attr=0xf, range=[0x000000008980b000-0x000000008980c000) (0MB)
> [    0.000000] EFI: mem119: type=3, attr=0xf, range=[0x000000008980c000-0x0000000089813000) (0MB)
> [    0.000000] EFI: mem120: type=4, attr=0xf, range=[0x0000000089813000-0x0000000089815000) (0MB)
> [    0.000000] EFI: mem121: type=3, attr=0xf, range=[0x0000000089815000-0x000000008981b000) (0MB)
> [    0.000000] EFI: mem122: type=4, attr=0xf, range=[0x000000008981b000-0x000000008981f000) (0MB)
> [    0.000000] EFI: mem123: type=3, attr=0xf, range=[0x000000008981f000-0x000000008982e000) (0MB)
> [    0.000000] EFI: mem124: type=4, attr=0xf, range=[0x000000008982e000-0x000000008982f000) (0MB)
> [    0.000000] EFI: mem125: type=3, attr=0xf, range=[0x000000008982f000-0x0000000089848000) (0MB)
> [    0.000000] EFI: mem126: type=4, attr=0xf, range=[0x0000000089848000-0x0000000089849000) (0MB)
> [    0.000000] EFI: mem127: type=3, attr=0xf, range=[0x0000000089849000-0x000000008984f000) (0MB)
> [    0.000000] EFI: mem128: type=4, attr=0xf, range=[0x000000008984f000-0x0000000089853000) (0MB)
> [    0.000000] EFI: mem129: type=3, attr=0xf, range=[0x0000000089853000-0x0000000089859000) (0MB)
> [    0.000000] EFI: mem130: type=4, attr=0xf, range=[0x0000000089859000-0x000000008985a000) (0MB)
> [    0.000000] EFI: mem131: type=3, attr=0xf, range=[0x000000008985a000-0x000000008985b000) (0MB)
> [    0.000000] EFI: mem132: type=4, attr=0xf, range=[0x000000008985b000-0x000000008985f000) (0MB)
> [    0.000000] EFI: mem133: type=3, attr=0xf, range=[0x000000008985f000-0x0000000089860000) (0MB)
> [    0.000000] EFI: mem134: type=4, attr=0xf, range=[0x0000000089860000-0x0000000089865000) (0MB)
> [    0.000000] EFI: mem135: type=3, attr=0xf, range=[0x0000000089865000-0x0000000089867000) (0MB)
> [    0.000000] EFI: mem136: type=4, attr=0xf, range=[0x0000000089867000-0x0000000089869000) (0MB)
> [    0.000000] EFI: mem137: type=3, attr=0xf, range=[0x0000000089869000-0x000000008986a000) (0MB)
> [    0.000000] EFI: mem138: type=4, attr=0xf, range=[0x000000008986a000-0x000000008986d000) (0MB)
> [    0.000000] EFI: mem139: type=3, attr=0xf, range=[0x000000008986d000-0x000000008986e000) (0MB)
> [    0.000000] EFI: mem140: type=4, attr=0xf, range=[0x000000008986e000-0x000000008986f000) (0MB)
> [    0.000000] EFI: mem141: type=3, attr=0xf, range=[0x000000008986f000-0x0000000089871000) (0MB)
> [    0.000000] EFI: mem142: type=4, attr=0xf, range=[0x0000000089871000-0x0000000089873000) (0MB)
> [    0.000000] EFI: mem143: type=3, attr=0xf, range=[0x0000000089873000-0x0000000089875000) (0MB)
> [    0.000000] EFI: mem144: type=4, attr=0xf, range=[0x0000000089875000-0x0000000089877000) (0MB)
> [    0.000000] EFI: mem145: type=3, attr=0xf, range=[0x0000000089877000-0x0000000089880000) (0MB)
> [    0.000000] EFI: mem146: type=4, attr=0xf, range=[0x0000000089880000-0x0000000089881000) (0MB)
> [    0.000000] EFI: mem147: type=3, attr=0xf, range=[0x0000000089881000-0x0000000089883000) (0MB)
> [    0.000000] EFI: mem148: type=4, attr=0xf, range=[0x0000000089883000-0x0000000089884000) (0MB)
> [    0.000000] EFI: mem149: type=3, attr=0xf, range=[0x0000000089884000-0x0000000089885000) (0MB)
> [    0.000000] EFI: mem150: type=4, attr=0xf, range=[0x0000000089885000-0x000000008988a000) (0MB)
> [    0.000000] EFI: mem151: type=3, attr=0xf, range=[0x000000008988a000-0x000000008988b000) (0MB)
> [    0.000000] EFI: mem152: type=4, attr=0xf, range=[0x000000008988b000-0x0000000089890000) (0MB)
> [    0.000000] EFI: mem153: type=3, attr=0xf, range=[0x0000000089890000-0x0000000089891000) (0MB)
> [    0.000000] EFI: mem154: type=4, attr=0xf, range=[0x0000000089891000-0x0000000089892000) (0MB)
> [    0.000000] EFI: mem155: type=3, attr=0xf, range=[0x0000000089892000-0x0000000089899000) (0MB)
> [    0.000000] EFI: mem156: type=4, attr=0xf, range=[0x0000000089899000-0x000000008989e000) (0MB)
> [    0.000000] EFI: mem157: type=3, attr=0xf, range=[0x000000008989e000-0x00000000898a0000) (0MB)
> [    0.000000] EFI: mem158: type=4, attr=0xf, range=[0x00000000898a0000-0x00000000898a6000) (0MB)
> [    0.000000] EFI: mem159: type=3, attr=0xf, range=[0x00000000898a6000-0x00000000898a7000) (0MB)
> [    0.000000] EFI: mem160: type=4, attr=0xf, range=[0x00000000898a7000-0x00000000898a9000) (0MB)
> [    0.000000] EFI: mem161: type=3, attr=0xf, range=[0x00000000898a9000-0x00000000898aa000) (0MB)
> [    0.000000] EFI: mem162: type=4, attr=0xf, range=[0x00000000898aa000-0x00000000898db000) (0MB)
> [    0.000000] EFI: mem163: type=3, attr=0xf, range=[0x00000000898db000-0x00000000898ee000) (0MB)
> [    0.000000] EFI: mem164: type=4, attr=0xf, range=[0x00000000898ee000-0x0000000089934000) (0MB)
> [    0.000000] EFI: mem165: type=3, attr=0xf, range=[0x0000000089934000-0x0000000089948000) (0MB)
> [    0.000000] EFI: mem166: type=4, attr=0xf, range=[0x0000000089948000-0x0000000089949000) (0MB)
> [    0.000000] EFI: mem167: type=3, attr=0xf, range=[0x0000000089949000-0x000000008994c000) (0MB)
> [    0.000000] EFI: mem168: type=4, attr=0xf, range=[0x000000008994c000-0x0000000089968000) (0MB)
> [    0.000000] EFI: mem169: type=3, attr=0xf, range=[0x0000000089968000-0x000000008996d000) (0MB)
> [    0.000000] EFI: mem170: type=4, attr=0xf, range=[0x000000008996d000-0x000000008997a000) (0MB)
> [    0.000000] EFI: mem171: type=3, attr=0xf, range=[0x000000008997a000-0x000000008997b000) (0MB)
> [    0.000000] EFI: mem172: type=4, attr=0xf, range=[0x000000008997b000-0x000000008997c000) (0MB)
> [    0.000000] EFI: mem173: type=3, attr=0xf, range=[0x000000008997c000-0x000000008997d000) (0MB)
> [    0.000000] EFI: mem174: type=4, attr=0xf, range=[0x000000008997d000-0x000000008998f000) (0MB)
> [    0.000000] EFI: mem175: type=3, attr=0xf, range=[0x000000008998f000-0x00000000899a4000) (0MB)
> [    0.000000] EFI: mem176: type=4, attr=0xf, range=[0x00000000899a4000-0x00000000899a5000) (0MB)
> [    0.000000] EFI: mem177: type=3, attr=0xf, range=[0x00000000899a5000-0x00000000899b1000) (0MB)
> [    0.000000] EFI: mem178: type=4, attr=0xf, range=[0x00000000899b1000-0x00000000899b4000) (0MB)
> [    0.000000] EFI: mem179: type=3, attr=0xf, range=[0x00000000899b4000-0x00000000899b8000) (0MB)
> [    0.000000] EFI: mem180: type=4, attr=0xf, range=[0x00000000899b8000-0x0000000089dd9000) (4MB)
> [    0.000000] EFI: mem181: type=3, attr=0xf, range=[0x0000000089dd9000-0x0000000089dde000) (0MB)
> [    0.000000] EFI: mem182: type=4, attr=0xf, range=[0x0000000089dde000-0x0000000089ddf000) (0MB)
> [    0.000000] EFI: mem183: type=3, attr=0xf, range=[0x0000000089ddf000-0x0000000089de1000) (0MB)
> [    0.000000] EFI: mem184: type=4, attr=0xf, range=[0x0000000089de1000-0x0000000089de2000) (0MB)
> [    0.000000] EFI: mem185: type=3, attr=0xf, range=[0x0000000089de2000-0x0000000089de5000) (0MB)
> [    0.000000] EFI: mem186: type=4, attr=0xf, range=[0x0000000089de5000-0x0000000089de6000) (0MB)
> [    0.000000] EFI: mem187: type=3, attr=0xf, range=[0x0000000089de6000-0x0000000089df3000) (0MB)
> [    0.000000] EFI: mem188: type=4, attr=0xf, range=[0x0000000089df3000-0x0000000089df5000) (0MB)
> [    0.000000] EFI: mem189: type=3, attr=0xf, range=[0x0000000089df5000-0x0000000089e02000) (0MB)
> [    0.000000] EFI: mem190: type=4, attr=0xf, range=[0x0000000089e02000-0x0000000089e03000) (0MB)
> [    0.000000] EFI: mem191: type=3, attr=0xf, range=[0x0000000089e03000-0x0000000089e06000) (0MB)
> [    0.000000] EFI: mem192: type=4, attr=0xf, range=[0x0000000089e06000-0x0000000089e07000) (0MB)
> [    0.000000] EFI: mem193: type=3, attr=0xf, range=[0x0000000089e07000-0x0000000089e08000) (0MB)
> [    0.000000] EFI: mem194: type=4, attr=0xf, range=[0x0000000089e08000-0x000000008ad0f000) (15MB)
> [    0.000000] EFI: mem195: type=7, attr=0xf, range=[0x000000008ad0f000-0x000000008ad36000) (0MB)
> [    0.000000] EFI: mem196: type=10, attr=0xf, range=[0x000000008ad36000-0x000000008ad5f000) (0MB)
> [    0.000000] EFI: mem197: type=7, attr=0xf, range=[0x000000008ad5f000-0x000000008ad6f000) (0MB)
> [    0.000000] EFI: mem198: type=9, attr=0xf, range=[0x000000008ad6f000-0x000000008ad8f000) (0MB)
> [    0.000000] EFI: mem199: type=7, attr=0xf, range=[0x000000008ad8f000-0x000000008ae33000) (0MB)
> [    0.000000] EFI: mem200: type=6, attr=0x800000000000000f, range=[0x000000008ae33000-0x000000008ae8f000) (0MB)
> [    0.000000] EFI: mem201: type=7, attr=0xf, range=[0x000000008ae8f000-0x000000008aed2000) (0MB)
> [    0.000000] EFI: mem202: type=5, attr=0x800000000000000f, range=[0x000000008aed2000-0x000000008aeff000) (0MB)
> [    0.000000] EFI: mem203: type=7, attr=0xf, range=[0x000000008aeff000-0x000000008af9a000) (0MB)
> [    0.000000] EFI: mem204: type=2, attr=0xf, range=[0x000000008af9a000-0x000000008afa2000) (0MB)
> [    0.000000] EFI: mem205: type=0, attr=0xf, range=[0x000000008afa2000-0x000000008afff000) (0MB)
> [    0.000000] EFI: mem206: type=6, attr=0x800000000000000f, range=[0x000000008afff000-0x000000008b000000) (0MB)
> [    0.000000] EFI: mem207: type=7, attr=0xf, range=[0x0000000100000000-0x000000016fe00000) (1790MB)
> [    0.000000] EFI: mem208: type=0, attr=0x8000000000000000, range=[0x00000000000a0000-0x0000000000100000) (0MB)
> [    0.000000] EFI: mem209: type=0, attr=0x8000000000000000, range=[0x000000008b000000-0x000000008fa00000) (74MB)
> [    0.000000] EFI: mem210: type=11, attr=0x8000000000000000, range=[0x00000000e00f8000-0x00000000e00f9000) (0MB)
> [    0.000000] EFI: mem211: type=11, attr=0x8000000000000000, range=[0x00000000fed1c000-0x00000000fed20000) (0MB)
> [    0.000000] EFI: mem212: type=11, attr=0x8000000000000000, range=[0x00000000ffed0000-0x00000000fff00000) (0MB)
> [    0.000000] DMI 2.4 present.
> [    0.000000] DMI: Apple Inc. MacBookAir4,1/Mac-C08A6BB70A942AC2, BIOS MBA41.88Z.0077.B00.1106300929 06/30/2011
> [    0.000000] e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
> [    0.000000] e820 remove range: 00000000000a0000 - 0000000000100000 (usable)
> [    0.000000] No AGP bridge found
> [    0.000000] last_pfn = 0x16fe00 max_arch_pfn = 0x400000000
> [    0.000000] MTRR default type: write-back
> [    0.000000] MTRR fixed ranges enabled:
> [    0.000000]   00000-9FFFF write-back
> [    0.000000]   A0000-BFFFF uncachable
> [    0.000000]   C0000-DFFFF write-protect
> [    0.000000]   E0000-FFFFF uncachable
> [    0.000000] MTRR variable ranges enabled:
> [    0.000000]   0 base 0C0000000 mask FC0000000 uncachable
> [    0.000000]   1 base 0A0000000 mask FE0000000 uncachable
> [    0.000000]   2 base 090000000 mask FF0000000 uncachable
> [    0.000000]   3 base 08C000000 mask FFC000000 uncachable
> [    0.000000]   4 base 08B800000 mask FFF800000 uncachable
> [    0.000000]   5 disabled
> [    0.000000]   6 disabled
> [    0.000000]   7 disabled
> [    0.000000]   8 disabled
> [    0.000000]   9 disabled
> [    0.000000] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
> [    0.000000] last_pfn = 0x8afa2 max_arch_pfn = 0x400000000
> [    0.000000] initial memory mapped : 0 - 20000000
> [    0.000000] Base memory trampoline at [ffff88000009a000] 9a000 size 20480
> [    0.000000] init_memory_mapping: 0000000000000000-000000008afa2000
> [    0.000000]  0000000000 - 008ae00000 page 2M
> [    0.000000]  008ae00000 - 008afa2000 page 4k
> [    0.000000] kernel direct mapping tables up to 8afa2000 @ 1fffb000-20000000
> [    0.000000] init_memory_mapping: 0000000100000000-000000016fe00000
> [    0.000000]  0100000000 - 016fe00000 page 2M
> [    0.000000] kernel direct mapping tables up to 16fe00000 @ 8af9b000-8afa2000
> 
> -- 
> keith.packard@intel.com
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Thanks,

	Ingo

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-04  1:33       ` Keith Packard
  2012-03-05 10:45         ` Ingo Molnar
@ 2012-03-05 11:48         ` Matt Fleming
  1 sibling, 0 replies; 28+ messages in thread
From: Matt Fleming @ 2012-03-05 11:48 UTC (permalink / raw)
  To: Keith Packard
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Sat, 2012-03-03 at 17:33 -0800, Keith Packard wrote:
> <#part sign=pgpmime>
> On Sat, 03 Mar 2012 16:27:28 -0800, "H. Peter Anvin" <hpa@zytor.com> wrote:
> 
> > Do you have the dmesg from your MBA?  I'm wondering what the memory map
> > looks like...
> 
> Here's the first part of dmesg from a running kernel (3.3-rc1 plus some
> DRM patches). Let me know if I cut this off too soon...

Have you tried adding 'add_efi_memmap' to your kernel command line?



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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-02-28  2:27           ` H. Peter Anvin
@ 2012-03-07 10:30             ` Matt Fleming
  2012-03-07 18:05               ` Yinghai Lu
  2012-03-07 18:14               ` Yinghai Lu
  0 siblings, 2 replies; 28+ messages in thread
From: Matt Fleming @ 2012-03-07 10:30 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Yinghai Lu, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Mon, 2012-02-27 at 18:27 -0800, H. Peter Anvin wrote:
> On 02/23/2012 08:47 PM, H. Peter Anvin wrote:
> >>
> >> please check attach patch for tip/efi branch.
> > 
> > That doesn't do anything like what I noted above.
> > 
> > We should get rid of dependencies on legacy PC memory layouts, not add
> > more hacks.  What is so hard about "when we create the initial mappings,
> > only create for RAM/ACPI/EFI regions" (if we even need to do so for
> > ACPI, I think ACPI might use ioremap() already)?
> > 
> 
> Hi Yinghai,
> 
> Can you please answer my question?

Did you have something like this in mind? Note that it doesn't go all
the way to removing the add_do_memmap boot parameter because I'm not
sure how to do that for GPL exported symbols.

The only testing I've done with this is to ensure that it boots under
qemu (both for EFI and BIOS) on 32/64-bit.

This is on top of tip/x86/efi.

diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h
index bce688d..4f95f23 100644
--- a/arch/x86/include/asm/page_types.h
+++ b/arch/x86/include/asm/page_types.h
@@ -51,8 +51,9 @@ static inline phys_addr_t get_max_mapped(void)
 	return (phys_addr_t)max_pfn_mapped << PAGE_SHIFT;
 }
 
-extern unsigned long init_memory_mapping(unsigned long start,
-					 unsigned long end);
+extern unsigned long init_memory_mapping(void);
+extern unsigned long __init_memory_mapping(unsigned long start,
+					   unsigned long end);
 
 extern void initmem_init(void);
 extern void free_initmem(void);
diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
index b1e7c7f..f52ced2 100644
--- a/arch/x86/kernel/amd_gart_64.c
+++ b/arch/x86/kernel/amd_gart_64.c
@@ -769,7 +769,7 @@ int __init gart_iommu_init(void)
 
 	if (end_pfn > max_low_pfn_mapped) {
 		start_pfn = (aper_base>>PAGE_SHIFT);
-		init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
+		__init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
 	}
 
 	pr_info("PCI-DMA: using GART IOMMU.\n");
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index e22bb08..b65d287 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -690,8 +690,6 @@ early_param("reservelow", parse_reservelow);
 
 void __init setup_arch(char **cmdline_p)
 {
-	unsigned long end_pfn;
-
 #ifdef CONFIG_X86_32
 	memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
 	visws_early_detect();
@@ -927,31 +925,11 @@ void __init setup_arch(char **cmdline_p)
 
 	init_gbpages();
 
-	/* max_pfn_mapped is updated here */
-	end_pfn = max_low_pfn;
-
-#ifdef CONFIG_X86_64
-	/*
-	 * There may be regions after the last E820_RAM region that we
-	 * want to include in the kernel direct mapping because their
-	 * contents are needed at runtime.
-	 */
-	if (efi_enabled) {
-		unsigned long efi_end;
-
-		efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI);
-		if (efi_end > end_pfn)
-			end_pfn = efi_end;
-	}
-#endif
-
-	max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
-	max_pfn_mapped = max_low_pfn_mapped;
+	/* max_low_pfn_mapped is updated here */
+	max_pfn_mapped = init_memory_mapping();
 
 #ifdef CONFIG_X86_64
 	if (max_pfn > max_low_pfn) {
-		max_pfn_mapped = init_memory_mapping(1UL<<32,
-						     max_pfn<<PAGE_SHIFT);
 		/* can we preseve max_low_pfn ?*/
 		max_low_pfn = max_pfn;
 	}
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 6cabf65..f1835e9 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -118,8 +118,8 @@ static int __meminit save_mr(struct map_range *mr, int nr_range,
  * This runs before bootmem is initialized and gets pages directly from
  * the physical memory. To access them they are temporarily mapped.
  */
-unsigned long __init_refok init_memory_mapping(unsigned long start,
-					       unsigned long end)
+unsigned long __init_refok __init_memory_mapping(unsigned long start,
+						 unsigned long end)
 {
 	unsigned long page_size_mask = 0;
 	unsigned long start_pfn, end_pfn;
@@ -301,6 +301,59 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
 	return ret >> PAGE_SHIFT;
 }
 
+/*
+ * Traverse the E820 memory map and add RAM/ACPI/EFI regions to the
+ * initial memory mapping.
+ */
+unsigned long __init_refok init_memory_mapping(void)
+{
+	struct e820entry *entry;
+	unsigned long last_pfn_mapped = 0;
+	unsigned long start, end;
+	int i;
+
+	/* Map the legacy region until we fix all drivers */
+	__init_memory_mapping(0, 1 << 20);
+
+	for (i = 0; i < e820.nr_map; i++) {
+		entry = &e820.map[i];
+		start = entry->addr;
+		end = start + entry->size;
+
+		/* We've already mapped below 1MB */
+		if (end < (1 << 20))
+			continue;
+
+		if (start < (1 << 20))
+			start = 1 << 20;
+#ifdef CONFIG_X86_32
+		/*
+		 * The map is sorted, so bail once we hit a region
+		 * that's above max_low_pfn.
+		 */
+		if (start >= max_low_pfn << PAGE_SHIFT)
+			break;
+
+		if (end > max_low_pfn << PAGE_SHIFT)
+			end = max_low_pfn << PAGE_SHIFT;
+#endif
+		switch (entry->type) {
+		case E820_RAM:
+		case E820_RESERVED_EFI:
+		case E820_ACPI:
+		case E820_NVS:
+			last_pfn_mapped = __init_memory_mapping(start, end);
+			break;
+		default:
+			continue;
+		}
+
+		if (end <= max_low_pfn << PAGE_SHIFT)
+			max_low_pfn_mapped = last_pfn_mapped;
+	}
+
+	return last_pfn_mapped;
+}
 
 /*
  * devmem_is_allowed() checks to see if /dev/mem access to a certain address
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 436a030..e86e370 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -659,7 +659,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
 	unsigned long nr_pages = size >> PAGE_SHIFT;
 	int ret;
 
-	last_mapped_pfn = init_memory_mapping(start, start + size);
+	last_mapped_pfn = __init_memory_mapping(start, start + size);
 	if (last_mapped_pfn > max_pfn_mapped)
 		max_pfn_mapped = last_mapped_pfn;
 
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 264cc6e..ef0a725 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -573,8 +573,7 @@ void __init efi_init(void)
 		printk(KERN_WARNING
 		  "Kernel-defined memdesc doesn't match the one from EFI!\n");
 
-	if (add_efi_memmap)
-		do_add_efi_memmap();
+	do_add_efi_memmap();
 
 #ifdef CONFIG_X86_32
 	x86_platform.get_wallclock = efi_get_time;



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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-07 10:30             ` Matt Fleming
@ 2012-03-07 18:05               ` Yinghai Lu
  2012-03-08 11:28                 ` Matt Fleming
  2012-03-07 18:14               ` Yinghai Lu
  1 sibling, 1 reply; 28+ messages in thread
From: Yinghai Lu @ 2012-03-07 18:05 UTC (permalink / raw)
  To: Matt Fleming
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Wed, Mar 7, 2012 at 2:30 AM, Matt Fleming <matt.fleming@intel.com> wrote:
> On Mon, 2012-02-27 at 18:27 -0800, H. Peter Anvin wrote:
>> On 02/23/2012 08:47 PM, H. Peter Anvin wrote:
>> >>
>> >> please check attach patch for tip/efi branch.
>> >
>> > That doesn't do anything like what I noted above.
>> >
>> > We should get rid of dependencies on legacy PC memory layouts, not add
>> > more hacks.  What is so hard about "when we create the initial mappings,
>> > only create for RAM/ACPI/EFI regions" (if we even need to do so for
>> > ACPI, I think ACPI might use ioremap() already)?
>> >
>>
>> Hi Yinghai,
>>
>> Can you please answer my question?
>
> Did you have something like this in mind? Note that it doesn't go all
> the way to removing the add_do_memmap boot parameter because I'm not
> sure how to do that for GPL exported symbols.
>
> The only testing I've done with this is to ensure that it boots under
> qemu (both for EFI and BIOS) on 32/64-bit.
>
> This is on top of tip/x86/efi.
>
> diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h
> index bce688d..4f95f23 100644
> --- a/arch/x86/include/asm/page_types.h
> +++ b/arch/x86/include/asm/page_types.h
> @@ -51,8 +51,9 @@ static inline phys_addr_t get_max_mapped(void)
>        return (phys_addr_t)max_pfn_mapped << PAGE_SHIFT;
>  }
>
> -extern unsigned long init_memory_mapping(unsigned long start,
> -                                        unsigned long end);
> +extern unsigned long init_memory_mapping(void);
> +extern unsigned long __init_memory_mapping(unsigned long start,
> +                                          unsigned long end);
>
>  extern void initmem_init(void);
>  extern void free_initmem(void);
> diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
> index b1e7c7f..f52ced2 100644
> --- a/arch/x86/kernel/amd_gart_64.c
> +++ b/arch/x86/kernel/amd_gart_64.c
> @@ -769,7 +769,7 @@ int __init gart_iommu_init(void)
>
>        if (end_pfn > max_low_pfn_mapped) {
>                start_pfn = (aper_base>>PAGE_SHIFT);
> -               init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
> +               __init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
>        }
>
>        pr_info("PCI-DMA: using GART IOMMU.\n");
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index e22bb08..b65d287 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -690,8 +690,6 @@ early_param("reservelow", parse_reservelow);
>
>  void __init setup_arch(char **cmdline_p)
>  {
> -       unsigned long end_pfn;
> -
>  #ifdef CONFIG_X86_32
>        memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
>        visws_early_detect();
> @@ -927,31 +925,11 @@ void __init setup_arch(char **cmdline_p)
>
>        init_gbpages();
>
> -       /* max_pfn_mapped is updated here */
> -       end_pfn = max_low_pfn;
> -
> -#ifdef CONFIG_X86_64
> -       /*
> -        * There may be regions after the last E820_RAM region that we
> -        * want to include in the kernel direct mapping because their
> -        * contents are needed at runtime.
> -        */
> -       if (efi_enabled) {
> -               unsigned long efi_end;
> -
> -               efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI);
> -               if (efi_end > end_pfn)
> -                       end_pfn = efi_end;
> -       }
> -#endif
> -
> -       max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
> -       max_pfn_mapped = max_low_pfn_mapped;
> +       /* max_low_pfn_mapped is updated here */
> +       max_pfn_mapped = init_memory_mapping();
>
>  #ifdef CONFIG_X86_64
>        if (max_pfn > max_low_pfn) {
> -               max_pfn_mapped = init_memory_mapping(1UL<<32,
> -                                                    max_pfn<<PAGE_SHIFT);
>                /* can we preseve max_low_pfn ?*/
>                max_low_pfn = max_pfn;
>        }

you may need to move those three lines before
max_pfn_mapped = init_memory_mapping()

otherwise for x86_64, memory from [4G, TOMH) will not be directly mapped.

Yinghai

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-07 10:30             ` Matt Fleming
  2012-03-07 18:05               ` Yinghai Lu
@ 2012-03-07 18:14               ` Yinghai Lu
  2012-03-07 18:18                 ` Matthew Garrett
  2012-03-08 12:09                 ` Matt Fleming
  1 sibling, 2 replies; 28+ messages in thread
From: Yinghai Lu @ 2012-03-07 18:14 UTC (permalink / raw)
  To: Matt Fleming
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Wed, Mar 7, 2012 at 2:30 AM, Matt Fleming <matt.fleming@intel.com> wrote:
> On Mon, 2012-02-27 at 18:27 -0800, H. Peter Anvin wrote:
>> On 02/23/2012 08:47 PM, H. Peter Anvin wrote:
>> >>
>> >> please check attach patch for tip/efi branch.
>> >
>> > That doesn't do anything like what I noted above.
>> >
>> > We should get rid of dependencies on legacy PC memory layouts, not add
>> > more hacks.  What is so hard about "when we create the initial mappings,
>> > only create for RAM/ACPI/EFI regions" (if we even need to do so for
>> > ACPI, I think ACPI might use ioremap() already)?
>> >
>>
>> Hi Yinghai,
>>
>> Can you please answer my question?
>
> Did you have something like this in mind? Note that it doesn't go all
> the way to removing the add_do_memmap boot parameter because I'm not
> sure how to do that for GPL exported symbols.
>
> The only testing I've done with this is to ensure that it boots under
> qemu (both for EFI and BIOS) on 32/64-bit.
>
> This is on top of tip/x86/efi.
>
> diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h
> index bce688d..4f95f23 100644
> --- a/arch/x86/include/asm/page_types.h
> +++ b/arch/x86/include/asm/page_types.h
> @@ -51,8 +51,9 @@ static inline phys_addr_t get_max_mapped(void)
>        return (phys_addr_t)max_pfn_mapped << PAGE_SHIFT;
>  }
>
> -extern unsigned long init_memory_mapping(unsigned long start,
> -                                        unsigned long end);
> +extern unsigned long init_memory_mapping(void);
> +extern unsigned long __init_memory_mapping(unsigned long start,
> +                                          unsigned long end);
>
>  extern void initmem_init(void);
>  extern void free_initmem(void);
> diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
> index b1e7c7f..f52ced2 100644
> --- a/arch/x86/kernel/amd_gart_64.c
> +++ b/arch/x86/kernel/amd_gart_64.c
> @@ -769,7 +769,7 @@ int __init gart_iommu_init(void)
>
>        if (end_pfn > max_low_pfn_mapped) {
>                start_pfn = (aper_base>>PAGE_SHIFT);
> -               init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
> +               __init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
>        }
>
>        pr_info("PCI-DMA: using GART IOMMU.\n");
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index e22bb08..b65d287 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -690,8 +690,6 @@ early_param("reservelow", parse_reservelow);
>
>  void __init setup_arch(char **cmdline_p)
>  {
> -       unsigned long end_pfn;
> -
>  #ifdef CONFIG_X86_32
>        memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
>        visws_early_detect();
> @@ -927,31 +925,11 @@ void __init setup_arch(char **cmdline_p)
>
>        init_gbpages();
>
> -       /* max_pfn_mapped is updated here */
> -       end_pfn = max_low_pfn;
> -
> -#ifdef CONFIG_X86_64
> -       /*
> -        * There may be regions after the last E820_RAM region that we
> -        * want to include in the kernel direct mapping because their
> -        * contents are needed at runtime.
> -        */
> -       if (efi_enabled) {
> -               unsigned long efi_end;
> -
> -               efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI);
> -               if (efi_end > end_pfn)
> -                       end_pfn = efi_end;
> -       }
> -#endif
> -
> -       max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
> -       max_pfn_mapped = max_low_pfn_mapped;
> +       /* max_low_pfn_mapped is updated here */
> +       max_pfn_mapped = init_memory_mapping();
>
>  #ifdef CONFIG_X86_64
>        if (max_pfn > max_low_pfn) {
> -               max_pfn_mapped = init_memory_mapping(1UL<<32,
> -                                                    max_pfn<<PAGE_SHIFT);
>                /* can we preseve max_low_pfn ?*/
>                max_low_pfn = max_pfn;
>        }
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index 6cabf65..f1835e9 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -118,8 +118,8 @@ static int __meminit save_mr(struct map_range *mr, int nr_range,
>  * This runs before bootmem is initialized and gets pages directly from
>  * the physical memory. To access them they are temporarily mapped.
>  */
> -unsigned long __init_refok init_memory_mapping(unsigned long start,
> -                                              unsigned long end)
> +unsigned long __init_refok __init_memory_mapping(unsigned long start,
> +                                                unsigned long end)
>  {
>        unsigned long page_size_mask = 0;
>        unsigned long start_pfn, end_pfn;
> @@ -301,6 +301,59 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
>        return ret >> PAGE_SHIFT;
>  }
>
> +/*
> + * Traverse the E820 memory map and add RAM/ACPI/EFI regions to the
> + * initial memory mapping.
> + */
> +unsigned long __init_refok init_memory_mapping(void)
> +{
> +       struct e820entry *entry;
> +       unsigned long last_pfn_mapped = 0;
> +       unsigned long start, end;
> +       int i;
> +
> +       /* Map the legacy region until we fix all drivers */
> +       __init_memory_mapping(0, 1 << 20);
> +
> +       for (i = 0; i < e820.nr_map; i++) {
> +               entry = &e820.map[i];
> +               start = entry->addr;
> +               end = start + entry->size;
> +
> +               /* We've already mapped below 1MB */
> +               if (end < (1 << 20))
> +                       continue;
> +
> +               if (start < (1 << 20))
> +                       start = 1 << 20;
> +#ifdef CONFIG_X86_32
> +               /*
> +                * The map is sorted, so bail once we hit a region
> +                * that's above max_low_pfn.
> +                */
> +               if (start >= max_low_pfn << PAGE_SHIFT)
> +                       break;
> +
> +               if (end > max_low_pfn << PAGE_SHIFT)
> +                       end = max_low_pfn << PAGE_SHIFT;
> +#endif
> +               switch (entry->type) {
> +               case E820_RAM:
> +               case E820_RESERVED_EFI:
> +               case E820_ACPI:
> +               case E820_NVS:
> +                       last_pfn_mapped = __init_memory_mapping(start, end);
> +                       break;
> +               default:
> +                       continue;
> +               }
> +
> +               if (end <= max_low_pfn << PAGE_SHIFT)
> +                       max_low_pfn_mapped = last_pfn_mapped;

those two line could be dropped if you have
            last_pfn_mapped = 1<<(20 - 12);
before the loop


Also you can not use  max_low_pfn here...

you need to update e820_end_pfn to search max pfn for several types like
> +               case E820_RAM:
> +               case E820_RESERVED_EFI:
> +               case E820_ACPI:
> +               case E820_NVS:

but my question is:
is there any system that will put EFI runtime, or ACPI or NVS above
4G? is that legal?

Yinghai

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-07 18:14               ` Yinghai Lu
@ 2012-03-07 18:18                 ` Matthew Garrett
  2012-03-08 12:09                 ` Matt Fleming
  1 sibling, 0 replies; 28+ messages in thread
From: Matthew Garrett @ 2012-03-07 18:18 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Matt Fleming, H. Peter Anvin, mingo, linux-kernel, keithp,
	rui.zhang, huang.ying.caritas, stable, tglx, linux-tip-commits

On Wed, Mar 07, 2012 at 10:14:15AM -0800, Yinghai Lu wrote:

> but my question is:
> is there any system that will put EFI runtime, or ACPI or NVS above
> 4G? is that legal?

You can't run a 32-bit EFI OS on a 64-bit EFI system, so there's no 
obvious reason why there couldn't be runtime regions above 4GB.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-05 10:45         ` Ingo Molnar
@ 2012-03-07 18:31           ` Yinghai Lu
  0 siblings, 0 replies; 28+ messages in thread
From: Yinghai Lu @ 2012-03-07 18:31 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Keith Packard, H. Peter Anvin, mingo, mjg, linux-kernel,
	rui.zhang, huang.ying.caritas, stable, matt.fleming, tglx,
	linux-tip-commits, Linus Torvalds, Andrew Morton

On Mon, Mar 5, 2012 at 2:45 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> ( Cc:-ed Yinghai - he can spot memory layout related bugs with
>  amazing efficiency. )
>
>  n/t
>
> * Keith Packard <keithp@keithp.com> wrote:
>
>> <#part sign=pgpmime>
>> On Sat, 03 Mar 2012 16:27:28 -0800, "H. Peter Anvin" <hpa@zytor.com> wrote:
>>
>> > Do you have the dmesg from your MBA?  I'm wondering what the memory map
>> > looks like...
>>
>> Here's the first part of dmesg from a running kernel (3.3-rc1 plus some
>> DRM patches). Let me know if I cut this off too soon...

hi, Keith,

What is problem there? your system can not boot with latest kernel
when EFI is used?

Thanks

Yinghai

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-07 18:05               ` Yinghai Lu
@ 2012-03-08 11:28                 ` Matt Fleming
  2012-03-08 18:59                   ` Yinghai Lu
  0 siblings, 1 reply; 28+ messages in thread
From: Matt Fleming @ 2012-03-08 11:28 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Wed, 2012-03-07 at 10:05 -0800, Yinghai Lu wrote:
> > -
> > -       max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
> > -       max_pfn_mapped = max_low_pfn_mapped;
> > +       /* max_low_pfn_mapped is updated here */
> > +       max_pfn_mapped = init_memory_mapping();
> >
> >  #ifdef CONFIG_X86_64
> >        if (max_pfn > max_low_pfn) {
> > -               max_pfn_mapped = init_memory_mapping(1UL<<32,
> > -                                                    max_pfn<<PAGE_SHIFT);
> >                /* can we preseve max_low_pfn ?*/
> >                max_low_pfn = max_pfn;
> >        }
> 
> you may need to move those three lines before
> max_pfn_mapped = init_memory_mapping()
> 
> otherwise for x86_64, memory from [4G, TOMH) will not be directly mapped.

I'm afraid I don't understand what you mean. The changes in my patch
mean that init_memory_mapping() doesn't work the way it previously did.
It will map all the regions in the e820 table and presumably the top of
memory is contained within one of those regions.

Could you clarify what you think the problem is? Unfortunately I don't
have a test machine with large amounts of RAM so it's entirely possible
I've made a mistake somewhere.


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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-07 18:14               ` Yinghai Lu
  2012-03-07 18:18                 ` Matthew Garrett
@ 2012-03-08 12:09                 ` Matt Fleming
  1 sibling, 0 replies; 28+ messages in thread
From: Matt Fleming @ 2012-03-08 12:09 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Wed, 2012-03-07 at 10:14 -0800, Yinghai Lu wrote:
> > +
> > +               if (end <= max_low_pfn << PAGE_SHIFT)
> > +                       max_low_pfn_mapped = last_pfn_mapped;
> 
> those two line could be dropped if you have
>             last_pfn_mapped = 1<<(20 - 12);
> before the loop

When you say "dropped" do you mean "not executed" or "deleted because
they are unnecessary"?

> Also you can not use  max_low_pfn here...

Why not? Please explain.

> you need to update e820_end_pfn to search max pfn for several types like
> > +               case E820_RAM:
> > +               case E820_RESERVED_EFI:
> > +               case E820_ACPI:
> > +               case E820_NVS:

Yeah, that's a good point. I'll make that change.

> but my question is:
> is there any system that will put EFI runtime, or ACPI or NVS above
> 4G? is that legal?

Matthew already answered this. I think it's entirely possible that EFI
runtime regions can reside above 4G.


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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-08 11:28                 ` Matt Fleming
@ 2012-03-08 18:59                   ` Yinghai Lu
  2012-03-12 12:38                     ` Matt Fleming
  0 siblings, 1 reply; 28+ messages in thread
From: Yinghai Lu @ 2012-03-08 18:59 UTC (permalink / raw)
  To: Matt Fleming
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Thu, Mar 8, 2012 at 3:28 AM, Matt Fleming <matt.fleming@intel.com> wrote:
> On Wed, 2012-03-07 at 10:05 -0800, Yinghai Lu wrote:
>> > -
>> > -       max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
>> > -       max_pfn_mapped = max_low_pfn_mapped;
>> > +       /* max_low_pfn_mapped is updated here */
>> > +       max_pfn_mapped = init_memory_mapping();
>> >
>> >  #ifdef CONFIG_X86_64
>> >        if (max_pfn > max_low_pfn) {
>> > -               max_pfn_mapped = init_memory_mapping(1UL<<32,
>> > -                                                    max_pfn<<PAGE_SHIFT);
>> >                /* can we preseve max_low_pfn ?*/
>> >                max_low_pfn = max_pfn;
>> >        }
>>
>> you may need to move those three lines before
>> max_pfn_mapped = init_memory_mapping()
>>
>> otherwise for x86_64, memory from [4G, TOMH) will not be directly mapped.
>
> I'm afraid I don't understand what you mean. The changes in my patch
> mean that init_memory_mapping() doesn't work the way it previously did.
> It will map all the regions in the e820 table and presumably the top of
> memory is contained within one of those regions.
>
> Could you clarify what you think the problem is? Unfortunately I don't
> have a test machine with large amounts of RAM so it's entirely possible
> I've made a mistake somewhere.

in your new init_memory_mapping will only map memory below max_low_pfn.

but the max_low_pfn is under 4g.

So it will be ended up with 4G above memory is not mapped.


Yinghai

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-08 18:59                   ` Yinghai Lu
@ 2012-03-12 12:38                     ` Matt Fleming
  2012-03-13  5:39                       ` Yinghai Lu
  0 siblings, 1 reply; 28+ messages in thread
From: Matt Fleming @ 2012-03-12 12:38 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Thu, 2012-03-08 at 10:59 -0800, Yinghai Lu wrote:
> On Thu, Mar 8, 2012 at 3:28 AM, Matt Fleming <matt.fleming@intel.com> wrote:
> > On Wed, 2012-03-07 at 10:05 -0800, Yinghai Lu wrote:
> >> > -
> >> > -       max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
> >> > -       max_pfn_mapped = max_low_pfn_mapped;
> >> > +       /* max_low_pfn_mapped is updated here */
> >> > +       max_pfn_mapped = init_memory_mapping();
> >> >
> >> >  #ifdef CONFIG_X86_64
> >> >        if (max_pfn > max_low_pfn) {
> >> > -               max_pfn_mapped = init_memory_mapping(1UL<<32,
> >> > -                                                    max_pfn<<PAGE_SHIFT);
> >> >                /* can we preseve max_low_pfn ?*/
> >> >                max_low_pfn = max_pfn;
> >> >        }
> >>
> >> you may need to move those three lines before
> >> max_pfn_mapped = init_memory_mapping()
> >>
> >> otherwise for x86_64, memory from [4G, TOMH) will not be directly mapped.
> >
> > I'm afraid I don't understand what you mean. The changes in my patch
> > mean that init_memory_mapping() doesn't work the way it previously did.
> > It will map all the regions in the e820 table and presumably the top of
> > memory is contained within one of those regions.
> >
> > Could you clarify what you think the problem is? Unfortunately I don't
> > have a test machine with large amounts of RAM so it's entirely possible
> > I've made a mistake somewhere.
> 
> in your new init_memory_mapping will only map memory below max_low_pfn.

That's true on CONFIG_X86_32. But on CONFIG_X86_64 we map anything in
the e820 map.

> but the max_low_pfn is under 4g.
> 
> So it will be ended up with 4G above memory is not mapped.

Have you tested my patch? Have you hit this bug or is it just from code
inspection. I'm starting to feel a bit silly now because I can't see the
problem you're describing.


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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-12 12:38                     ` Matt Fleming
@ 2012-03-13  5:39                       ` Yinghai Lu
  2012-03-15 12:40                         ` Matt Fleming
  0 siblings, 1 reply; 28+ messages in thread
From: Yinghai Lu @ 2012-03-13  5:39 UTC (permalink / raw)
  To: Matt Fleming
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Mon, Mar 12, 2012 at 5:38 AM, Matt Fleming <matt.fleming@intel.com> wrote:

> Have you tested my patch? Have you hit this bug or is it just from code
> inspection. I'm starting to feel a bit silly now because I can't see the
> problem you're describing.

from code inspection.

your new init_memory_mapping() will only map mem under max_low_pfn ?

and before that calling for x86_64, max_low_pfn is not updated to max_pfn yet.

+       max_pfn_mapped = init_memory_mapping();

 #ifdef CONFIG_X86_64
       if (max_pfn > max_low_pfn) {
-               max_pfn_mapped = init_memory_mapping(1UL<<32,
-                                                    max_pfn<<PAGE_SHIFT);
               /* can we preseve max_low_pfn ?*/
               max_low_pfn = max_pfn;
       }

Please do find one system with more than 4G to test the code.

Thanks

Yinghai

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-13  5:39                       ` Yinghai Lu
@ 2012-03-15 12:40                         ` Matt Fleming
  2012-03-15 17:54                           ` Yinghai Lu
  0 siblings, 1 reply; 28+ messages in thread
From: Matt Fleming @ 2012-03-15 12:40 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Mon, 2012-03-12 at 22:39 -0700, Yinghai Lu wrote:
> On Mon, Mar 12, 2012 at 5:38 AM, Matt Fleming <matt.fleming@intel.com> wrote:
> 
> > Have you tested my patch? Have you hit this bug or is it just from code
> > inspection. I'm starting to feel a bit silly now because I can't see the
> > problem you're describing.
> 
> from code inspection.
> 
> your new init_memory_mapping() will only map mem under max_low_pfn ?

No, that's not true for x86_64, look,

        for (i = 0; i < e820.nr_map; i++) {
                entry = &e820.map[i];
                start = entry->addr;
                end = start + entry->size;

                /* We've already mapped below 1MB */
                if (end < (1 << 20))
                        continue;

                if (start < (1 << 20))
                        start = 1 << 20;
#ifdef CONFIG_X86_32
                /*
                 * The map is sorted, so bail once we hit a region
                 * that's above max_low_pfn.
                 */
                if (start >= max_low_pfn << PAGE_SHIFT)
                        break;

                if (end > max_low_pfn << PAGE_SHIFT)
                        end = max_low_pfn << PAGE_SHIFT;
#endif
                switch (entry->type) {
                case E820_RAM:
                case E820_RESERVED_EFI:
                case E820_ACPI:
                case E820_NVS:
                        last_pfn_mapped = __init_memory_mapping(start, end);
                        break;
                default:
                        continue;
                }

                if (end <= max_low_pfn << PAGE_SHIFT)
                        max_low_pfn_mapped = last_pfn_mapped;
        }

The max_low_pfn checks are only for CONFIG_X86_32 so that the behaviour
is the same as before this patch, i.e. we don't try to map above
max_low_pfn.

> and before that calling for x86_64, max_low_pfn is not updated to max_pfn yet.
> 
> +       max_pfn_mapped = init_memory_mapping();
> 
>  #ifdef CONFIG_X86_64
>        if (max_pfn > max_low_pfn) {
> -               max_pfn_mapped = init_memory_mapping(1UL<<32,
> -                                                    max_pfn<<PAGE_SHIFT);
>                /* can we preseve max_low_pfn ?*/
>                max_low_pfn = max_pfn;
>        }
> 
> Please do find one system with more than 4G to test the code.

I'm ordering some parts so that I can test this out.



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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-15 12:40                         ` Matt Fleming
@ 2012-03-15 17:54                           ` Yinghai Lu
  2012-03-16 18:36                             ` Matt Fleming
  0 siblings, 1 reply; 28+ messages in thread
From: Yinghai Lu @ 2012-03-15 17:54 UTC (permalink / raw)
  To: Matt Fleming
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Thu, Mar 15, 2012 at 5:40 AM, Matt Fleming <matt.fleming@intel.com> wrote:
> On Mon, 2012-03-12 at 22:39 -0700, Yinghai Lu wrote:
>> On Mon, Mar 12, 2012 at 5:38 AM, Matt Fleming <matt.fleming@intel.com> wrote:
>>
>> > Have you tested my patch? Have you hit this bug or is it just from code
>> > inspection. I'm starting to feel a bit silly now because I can't see the
>> > problem you're describing.
>>
>> from code inspection.
>>
>> your new init_memory_mapping() will only map mem under max_low_pfn ?
>
> No, that's not true for x86_64, look,
>
>        for (i = 0; i < e820.nr_map; i++) {
>                entry = &e820.map[i];
>                start = entry->addr;
>                end = start + entry->size;
>
>                /* We've already mapped below 1MB */
>                if (end < (1 << 20))
>                        continue;
>
>                if (start < (1 << 20))
>                        start = 1 << 20;
> #ifdef CONFIG_X86_32
>                /*
>                 * The map is sorted, so bail once we hit a region
>                 * that's above max_low_pfn.
>                 */
>                if (start >= max_low_pfn << PAGE_SHIFT)
>                        break;
>
>                if (end > max_low_pfn << PAGE_SHIFT)
>                        end = max_low_pfn << PAGE_SHIFT;
> #endif
>                switch (entry->type) {
>                case E820_RAM:
>                case E820_RESERVED_EFI:
>                case E820_ACPI:
>                case E820_NVS:
>                        last_pfn_mapped = __init_memory_mapping(start, end);
>                        break;
>                default:
>                        continue;
>                }
>
>                if (end <= max_low_pfn << PAGE_SHIFT)
>                        max_low_pfn_mapped = last_pfn_mapped;

why max_low_pfn is used here?

>        }
>
> The max_low_pfn checks are only for CONFIG_X86_32 so that the behaviour
> is the same as before this patch, i.e. we don't try to map above
> max_low_pfn.

ok, to simplify the code, in setup.c you could move
#ifdef CONFIG_X86_64
        if (max_pfn > max_low_pfn) {
                /* can we preseve max_low_pfn ?*/
                max_low_pfn = max_pfn;
        }
#endif

before calling new init_memory_mapping()...

so you could remove the #idef. in init_memory_mapping.

Yinghai

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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-15 17:54                           ` Yinghai Lu
@ 2012-03-16 18:36                             ` Matt Fleming
  2012-03-16 19:01                               ` Yinghai Lu
  0 siblings, 1 reply; 28+ messages in thread
From: Matt Fleming @ 2012-03-16 18:36 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Thu, 2012-03-15 at 10:54 -0700, Yinghai Lu wrote:
> >                if (end <= max_low_pfn << PAGE_SHIFT)
> >                        max_low_pfn_mapped = last_pfn_mapped;
> 
> why max_low_pfn is used here?

The idea is that we only want to update max_low_pfn_mapped when we've
mapped a region at or below max_low_pfn. This maintains compatibility
with behaviour prior to this patch.

> > The max_low_pfn checks are only for CONFIG_X86_32 so that the behaviour
> > is the same as before this patch, i.e. we don't try to map above
> > max_low_pfn.
> 
> ok, to simplify the code, in setup.c you could move
> #ifdef CONFIG_X86_64
>         if (max_pfn > max_low_pfn) {
>                 /* can we preseve max_low_pfn ?*/
>                 max_low_pfn = max_pfn;
>         }
> #endif
> 
> before calling new init_memory_mapping()...
> 
> so you could remove the #idef. in init_memory_mapping.

Hmm.. if we do this then max_low_pfn_mapped will be set to max_pfn on
CONFIG_X86_64 by the time we've finished looping in
init_memory_mapping(). This is not how things work currently. Will that
cause a problem?


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

* Re: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
  2012-03-16 18:36                             ` Matt Fleming
@ 2012-03-16 19:01                               ` Yinghai Lu
  0 siblings, 0 replies; 28+ messages in thread
From: Yinghai Lu @ 2012-03-16 19:01 UTC (permalink / raw)
  To: Matt Fleming
  Cc: H. Peter Anvin, mingo, mjg, linux-kernel, keithp, rui.zhang,
	huang.ying.caritas, stable, tglx, linux-tip-commits

On Fri, Mar 16, 2012 at 11:36 AM, Matt Fleming <matt.fleming@intel.com> wrote:
> On Thu, 2012-03-15 at 10:54 -0700, Yinghai Lu wrote:
>> >                if (end <= max_low_pfn << PAGE_SHIFT)
>> >                        max_low_pfn_mapped = last_pfn_mapped;
>>
>> why max_low_pfn is used here?
>
> The idea is that we only want to update max_low_pfn_mapped when we've
> mapped a region at or below max_low_pfn. This maintains compatibility
> with behaviour prior to this patch.
>
>> > The max_low_pfn checks are only for CONFIG_X86_32 so that the behaviour
>> > is the same as before this patch, i.e. we don't try to map above
>> > max_low_pfn.
>>
>> ok, to simplify the code, in setup.c you could move
>> #ifdef CONFIG_X86_64
>>         if (max_pfn > max_low_pfn) {
>>                 /* can we preseve max_low_pfn ?*/
>>                 max_low_pfn = max_pfn;
>>         }
>> #endif
>>
>> before calling new init_memory_mapping()...
>>
>> so you could remove the #idef. in init_memory_mapping.
>
> Hmm.. if we do this then max_low_pfn_mapped will be set to max_pfn on
> CONFIG_X86_64 by the time we've finished looping in
> init_memory_mapping(). This is not how things work currently. Will that
> cause a problem?

oh, before this patch could be applied, you need to make sure all
max_low_pfn_mapped reference
is removed.
current assumption is under max_low_pfn_mapped all mem is mapped.
now with this patch, that assumption is not right anymore.

Yinghai

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

end of thread, other threads:[~2012-03-16 19:01 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-20 13:30 [PATCH] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops Matt Fleming
2012-02-23  1:16 ` [tip:x86/urgent] " tip-bot for Matt Fleming
2012-02-23  2:20   ` Yinghai Lu
2012-02-23  3:32     ` H. Peter Anvin
2012-02-23 10:36       ` Yinghai Lu
2012-02-24  4:47         ` H. Peter Anvin
2012-02-28  2:27           ` H. Peter Anvin
2012-03-07 10:30             ` Matt Fleming
2012-03-07 18:05               ` Yinghai Lu
2012-03-08 11:28                 ` Matt Fleming
2012-03-08 18:59                   ` Yinghai Lu
2012-03-12 12:38                     ` Matt Fleming
2012-03-13  5:39                       ` Yinghai Lu
2012-03-15 12:40                         ` Matt Fleming
2012-03-15 17:54                           ` Yinghai Lu
2012-03-16 18:36                             ` Matt Fleming
2012-03-16 19:01                               ` Yinghai Lu
2012-03-07 18:14               ` Yinghai Lu
2012-03-07 18:18                 ` Matthew Garrett
2012-03-08 12:09                 ` Matt Fleming
2012-03-04  0:12   ` Keith Packard
2012-03-04  0:27     ` H. Peter Anvin
2012-03-04  1:33       ` Keith Packard
2012-03-05 10:45         ` Ingo Molnar
2012-03-07 18:31           ` Yinghai Lu
2012-03-05 11:48         ` Matt Fleming
2012-02-28  2:33 ` [PATCH] " H. Peter Anvin
2012-02-28 17:35   ` Matt Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).