[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1561567.ev2pEO8C5v@vostro.rjw.lan>
Date: Tue, 09 Sep 2014 00:52:55 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: "Lee, Chun-Yi" <joeyli.kernel@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>
Cc: Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
Takashi Iwai <tiwai@...e.de>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, "Lee, Chun-Yi" <jlee@...e.com>
Subject: Re: [PATCH] Hibernate: Do not assume the first e820 area to be RAM
On Monday, August 11, 2014 06:50:52 PM Lee, Chun-Yi wrote:
> In arch/x86/kernel/setup.c::trim_bios_range(), the codes introduced
> by 1b5576e6 (base on d8a9e6a5), 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:
>
> [ 0.000000] e820: BIOS-provided physical RAM map:
> [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x0000000000096fff] usable
> [ 0.000000] BIOS-e820: [mem 0x0000000000097000-0x0000000000097fff] reserved
> ...
> [ 0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
> [ 0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable
>
> But the region of first 4Kb didn't register to nosave memory:
>
> [ 0.000000] PM: Registered nosave memory: [mem 0x00097000-0x00097fff]
> [ 0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000fffff]
>
> The codes 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.
>
> Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>
> Cc: Len Brown <len.brown@...el.com>
> Cc: Pavel Machek <pavel@....cz>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Signed-off-by: Lee, Chun-Yi <jlee@...e.com>
Thomas, Ingo, Peter, any objections here?
If not, do you want to handle it or do you want me to do that?
> ---
> arch/x86/kernel/e820.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
> index 988c00a..d595240 100644
> --- a/arch/x86/kernel/e820.c
> +++ b/arch/x86/kernel/e820.c
> @@ -682,18 +682,17 @@ void __init parse_e820_ext(u64 phys_addr, u32 data_len)
> * hibernation (32 bit) or software suspend and suspend to RAM (64 bit).
> *
> * This function requires the e820 map to be sorted and without any
> - * overlapping entries and assumes the first e820 area to be RAM.
> + * overlapping entries.
> */
> void __init e820_mark_nosave_regions(unsigned long limit_pfn)
> {
> int i;
> unsigned long pfn;
>
> - pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
> - for (i = 1; i < e820.nr_map; i++) {
> + for (i = 0; i < e820.nr_map; i++) {
> struct e820entry *ei = &e820.map[i];
>
> - if (pfn < PFN_UP(ei->addr))
> + if (i > 0 && pfn < PFN_UP(ei->addr))
> register_nosave_region(pfn, PFN_UP(ei->addr));
>
> pfn = PFN_DOWN(ei->addr + ei->size);
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists