public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [tip:x86/mm] x86, mm: Move reserving low memory later in initialization
@ 2013-02-14 23:31 tip-bot for H. Peter Anvin
  2014-03-21  8:37 ` ivory
  0 siblings, 1 reply; 2+ messages in thread
From: tip-bot for H. Peter Anvin @ 2013-02-14 23:31 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  95c9608478d639dcffc14ea47b31bff021a99ed1
Gitweb:     http://git.kernel.org/tip/95c9608478d639dcffc14ea47b31bff021a99ed1
Author:     H. Peter Anvin <hpa@zytor.com>
AuthorDate: Thu, 14 Feb 2013 14:02:52 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Thu, 14 Feb 2013 15:21:25 -0800

x86, mm: Move reserving low memory later in initialization

Move the reservation of low memory, except for the 4K which actually
does belong to the BIOS, later in the initialization; in particular,
after we have already reserved the trampoline.

The current code locates the trampoline as high as possible, so by
deferring the allocation we will still be able to reserve as much
memory as is possible.  This allows us to run with reservelow=640k
without getting a crash on system startup.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/n/tip-0y9dqmmsousf69wutxwl3kkf@git.kernel.org
---
 arch/x86/kernel/setup.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 8354399..0aebd77 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -608,8 +608,6 @@ static __init void reserve_ibft_region(void)
 		memblock_reserve(addr, size);
 }
 
-static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
-
 static bool __init snb_gfx_workaround_needed(void)
 {
 #ifdef CONFIG_PCI
@@ -698,8 +696,7 @@ static void __init trim_bios_range(void)
 	 * since some BIOSes are known to corrupt low memory.  See the
 	 * Kconfig help text for X86_RESERVE_LOW.
 	 */
-	e820_update_range(0, ALIGN(reserve_low, PAGE_SIZE),
-			  E820_RAM, E820_RESERVED);
+	e820_update_range(0, PAGE_SIZE, E820_RAM, E820_RESERVED);
 
 	/*
 	 * special case: Some BIOSen report the PC BIOS
@@ -711,6 +708,8 @@ static void __init trim_bios_range(void)
 	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
 }
 
+static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
+
 static int __init parse_reservelow(char *p)
 {
 	unsigned long long size;
@@ -733,6 +732,11 @@ static int __init parse_reservelow(char *p)
 
 early_param("reservelow", parse_reservelow);
 
+static void __init trim_low_memory_range(void)
+{
+	memblock_reserve(0, ALIGN(reserve_low, PAGE_SIZE));
+}
+	
 /*
  * 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
@@ -987,6 +991,7 @@ void __init setup_arch(char **cmdline_p)
 	setup_real_mode();
 
 	trim_platform_memory_ranges();
+	trim_low_memory_range();
 
 	init_gbpages();
 

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

* Re: [tip:x86/mm] x86, mm: Move reserving low memory later in initialization
  2013-02-14 23:31 [tip:x86/mm] x86, mm: Move reserving low memory later in initialization tip-bot for H. Peter Anvin
@ 2014-03-21  8:37 ` ivory
  0 siblings, 0 replies; 2+ messages in thread
From: ivory @ 2014-03-21  8:37 UTC (permalink / raw)
  To: linux-kernel

This patch seems to make the bios_corruption_check not to cover the lowest
64kB of memory anymore but only the lowest 4kB. Was this deliberate?
When I use kernel 3.9 or higher I always get low mem corruption message from
the bios corruption checker when I resume from suspend.

Below kernel 3.9 I see this boot message:
e820 update range: 0000000000000000 - 0000000000010000 (usable) ==>
(reserved)
... which is the 64kB.

But on newer kernels the message changed to:
e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
... which is only 4kB.

The corrupted low mem areas I get the message for after resuming from
suspend is this:
 Corrupted low memory at c0002d00 (2d00 phys) = 11060000
 Corrupted low memory at c0002d04 (2d04 phys) = 80805122
 Corrupted low memory at c0002d08 (2d08 phys) = 00860003

How to fix this in kernel 3.9 and higher?

Thanks for your help and best regards.



--
View this message in context: http://linux-kernel.2935.n7.nabble.com/tip-x86-mm-x86-mm-Move-reserving-low-memory-later-in-initialization-tp601280p827938.html
Sent from the Linux Kernel mailing list archive at Nabble.com.

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

end of thread, other threads:[~2014-03-21  8:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-14 23:31 [tip:x86/mm] x86, mm: Move reserving low memory later in initialization tip-bot for H. Peter Anvin
2014-03-21  8:37 ` ivory

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