RE: [RFC PATCH V2] PM / hibernate: Fix hibernation panic caused by inconsistent e820 memory map
From: "Chen, Yu C" <yu.c.chen@intel.com>
Date: 2015-08-21 16:11:51
Seems there's no reply from https://patchwork.kernel.org/patch/6887991/, and most of our stress test on hibernation are blocked, I'm considering also doing stress testing with this patch applied, we need a solution to fix it after all.. Best Regards, Yu
-----Original Message----- From: yhlu.kernel@gmail.com [mailto:yhlu.kernel@gmail.com] On Behalf Of Yinghai Lu Sent: Thursday, July 23, 2015 7:57 AM To: Chen, Yu C Cc: Linux PM list; Lee, Chun-Yi; Wysocki, Rafael J; Zhang, Rui; Tian, YeX Subject: Re: [RFC PATCH V2] PM / hibernate: Fix hibernation panic caused by inconsistent e820 memory map On Wed, Jul 22, 2015 at 1:29 AM, Chen Yu [off-list ref] wrote:quoted
Commit 84c91b7ae07c ("PM / hibernate: avoid unsafe pages in e820 reserved regions") was reverted, because this patch makes resume from hibernation on Lenovo x230 unreliable. But reverting may bring back the kernel exception firstly reported in former patch. In general, there are three problems in current code when resuming from hibernation: 1.Resuming page may also be in second kernel's e820 reserved region. BIOS-e820: [mem 0x0000000069d4f000-0x0000000069e12fff] reserved this causes kernel exception described in Commit 84c91b7ae07c ("PM / hibernate: avoid unsafe pages in e820 reserved regions") 2.If Commit 84c91b7ae07c ("PM / hibernate: avoid unsafe pages in e820 reserved regions") is applied to fix problem 1, and if E820_RESERVED_KERN regions causes some regions at e820 table not page aligned, e820_mark_nosave_regions will misjudgment the non-page aligned space to be "hole" space and add to nosave regions, this causesresuming failed.quoted
Refer to https://bugzilla.kernel.org/show_bug.cgi?id=96111 for detail. 3.e820 memory map inconsistence. Sometimes resuming system may have larger memory capacity than the one before hibernation. If a strict superset relationship is satisfied, it should be allowed to resume. For example, use case of memory hotplug after hibernation. e820 memory map before hibernation: BIOS-e820: [mem 0x0000000020200000-0x0000000077517fff] usable BIOS-e820: [mem 0x0000000077518000-0x0000000077567fff] reserved e820 memory map during resuming: BIOS-e820: [mem 0x0000000020200000-0x000000007753ffff] usable BIOS-e820: [mem 0x0000000077540000-0x0000000077567fff] reserved This patch is based on Lee, Chun-Yi's original patch Commit 84c91b7ae07c ("PM / hibernate: avoid unsafe pages in e820 reserved regions"), then treats any ajacent E820_RAM/E820_RESERVED_KERNregionsquoted
as one region, this can prevent any non-page aligned address in ajacent E820_RAM/E820_RESERVED regions, from being added to nosave regions, thus allow system to restore the hibernation image, for example: three E820_RAM/E820_RESERVED_KERN regions, [a,b] [b+1,c] [c+1,d], should be treated as a whole: [a,d]. For the bug reported at https://bugzilla.kernel.org/show_bug.cgi?id=96111 reserve setup_data: [mem 0x000000005baff000-0x000000009d3e0017]usablequoted
reserve setup_data: [mem 0x000000009d3e0018-0x000000009d3f0057]usablequoted
reserve setup_data: [mem 0x000000009d3f0058-0x00000000d684ffff]usablequoted
these regions will be treated as one: [mem 0x000000005baff000-0x00000000d684ffff] usable. Tested-by: Tian Ye <redacted> Tested-by: Wendy, Wang <redacted> Signed-off-by: Chen Yu <yu.c.chen@intel.com>Is this same as: https://bugzilla.opensuse.org/show_bug.cgi?id=913885 that could be fixed by: https://lkml.org/lkml/2015/7/7/982