Skip to content

Commit 8477957

Browse files
Lee, Chun-Yiingomolnar
authored andcommitted
x86/mm, hibernate: Do not assume the first e820 area to be RAM
In arch/x86/kernel/setup.c::trim_bios_range(), the codes introduced by 1b5576e (base on d8a9e6a), it updates the first 4Kb of memory to be E820_RESERVED region. That's because it's a BIOS owned area but generally not listed in the E820 table: e820: BIOS-provided physical RAM map: BIOS-e820: [mem 0x0000000000000000-0x0000000000096fff] usable BIOS-e820: [mem 0x0000000000097000-0x0000000000097fff] reserved ... e820: update [mem 0x00000000-0x00000fff] usable ==> reserved e820: remove [mem 0x000a0000-0x000fffff] usable But the region of first 4Kb didn't register to nosave memory: PM: Registered nosave memory: [mem 0x00097000-0x00097fff] PM: Registered nosave memory: [mem 0x000a0000-0x000fffff] The code in e820_mark_nosave_regions() assumes the first e820 area to be RAM, so it causes the first 4Kb E820_RESERVED region ignored when register to nosave. This patch removed assumption of the first e820 area. Signed-off-by: Lee, Chun-Yi <jlee@suse.com> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Len Brown <len.brown@intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Takashi Iwai <tiwai@suse.de> Link: http://lkml.kernel.org/r/1410491038-17576-1-git-send-email-jlee@suse.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 8b375f6 commit 8477957

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎arch/x86/kernel/e820.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,15 +682,14 @@ void __init parse_e820_ext(u64 phys_addr, u32 data_len)
682682
* hibernation (32 bit) or software suspend and suspend to RAM (64 bit).
683683
*
684684
* This function requires the e820 map to be sorted and without any
685-
* overlapping entries and assumes the first e820 area to be RAM.
685+
* overlapping entries.
686686
*/
687687
void __init e820_mark_nosave_regions(unsigned long limit_pfn)
688688
{
689689
int i;
690-
unsigned long pfn;
690+
unsigned long pfn = 0;
691691

692-
pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
693-
for (i = 1; i < e820.nr_map; i++) {
692+
for (i = 0; i < e820.nr_map; i++) {
694693
struct e820entry *ei = &e820.map[i];
695694

696695
if (pfn < PFN_UP(ei->addr))

0 commit comments

Comments
 (0)