Message ID | 20220930010821.221381-1-luoxueqin@kylinos.cn |
---|---|
State | Superseded |
Headers | show |
Series | [-next] kernel/power : add pr_err() for debugging "Error -14 resuming" error | expand |
On Fri, Sep 30, 2022 at 3:09 AM Xueqin Luo <luoxueqin66@gmail.com> wrote: > > As the machine boots normally, bios initializes the memblock and sets the > flags of some memblocks to 0x1. During the S4, the bios once again > initializes the memblock.This initialization may change the flags value > of some blocks, for example, changing the flags value from 0x1 to 0x4. > 0x4 means do not add to kernel direct mapping. These changed addresses do > not pass the validity check of the pfn_valid() function, resulting in the > following "Error -14 resuming" error. I suppose that you wanted to say that the system memory map can change over a hibernation-restore cycle and some of the page frames used by the kernel before hibernation may not be available any more during the subsequent restore which leads to the error below. It would be good to also note that this can be regarded as a platform firmware defect. > [ T357] PM: Image loading progress: 0% > [ T357] PM: Read 2681596 kbytes in 0.03 seconds (89386.53 MB/s) > [ T357] PM: Error -14 resuming > [ T357] PM: Failed to load hibernation image, recovering. > [ T357] PM: Basic memory bitmaps freed > [ T357] OOM killer enabled. > [ T357] Restarting tasks ... done. > [ T357] PM: resume from hibernation failed (-14) > [ T357] PM: Hibernation image not present or could not be loaded. > > Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn> > --- > kernel/power/snapshot.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c > index 2a406753af90..2be2e9f5a060 100644 > --- a/kernel/power/snapshot.c > +++ b/kernel/power/snapshot.c > @@ -2259,10 +2259,13 @@ static int unpack_orig_pfns(unsigned long *buf, struct memory_bitmap *bm) > if (unlikely(buf[j] == BM_END_OF_MAP)) > break; > > - if (pfn_valid(buf[j]) && memory_bm_pfn_present(bm, buf[j])) > + if (pfn_valid(buf[j]) && memory_bm_pfn_present(bm, buf[j])) { > memory_bm_set_bit(bm, buf[j]); > - else > + } else { > + if (!pfn_valid(buf[j])) > + pr_err("Address %lx is not valid.\n", buf[j]); buf[j] is not an address here. It is a page frame number. The message is still a bit cryptic IMV, it doesn't explain what's the problem and cannot be understood without reading the code. > return -EFAULT; > + } > } > > return 0; > --
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 2a406753af90..2be2e9f5a060 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -2259,10 +2259,13 @@ static int unpack_orig_pfns(unsigned long *buf, struct memory_bitmap *bm) if (unlikely(buf[j] == BM_END_OF_MAP)) break; - if (pfn_valid(buf[j]) && memory_bm_pfn_present(bm, buf[j])) + if (pfn_valid(buf[j]) && memory_bm_pfn_present(bm, buf[j])) { memory_bm_set_bit(bm, buf[j]); - else + } else { + if (!pfn_valid(buf[j])) + pr_err("Address %lx is not valid.\n", buf[j]); return -EFAULT; + } } return 0;
As the machine boots normally, bios initializes the memblock and sets the flags of some memblocks to 0x1. During the S4, the bios once again initializes the memblock.This initialization may change the flags value of some blocks, for example, changing the flags value from 0x1 to 0x4. 0x4 means do not add to kernel direct mapping. These changed addresses do not pass the validity check of the pfn_valid() function, resulting in the following "Error -14 resuming" error. [ T357] PM: Image loading progress: 0% [ T357] PM: Read 2681596 kbytes in 0.03 seconds (89386.53 MB/s) [ T357] PM: Error -14 resuming [ T357] PM: Failed to load hibernation image, recovering. [ T357] PM: Basic memory bitmaps freed [ T357] OOM killer enabled. [ T357] Restarting tasks ... done. [ T357] PM: resume from hibernation failed (-14) [ T357] PM: Hibernation image not present or could not be loaded. Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn> --- kernel/power/snapshot.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)