Skip to contentSkip to conversation

kernel/power : add pr_err() for debugging "Error -14 resuming" error

PATCH In review Luo Xueqin 2 participants 3 messages Oct 31, 2022 – Nov 10, 2022

Subsystems (2)
lore
Share & tools
lore

Luo Xueqin

author
#0 lore raw

PATCH v2 1/1 kernel/power : add pr_err() for debugging "Error -14 resuming" error

From: Xueqin Luo <[email protected]>

The system memory map can change over a hibernation-restore cycle due to a defect in the platform firmware, 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.

[  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.

So, by adding an Error message to the unpack () function, you can quickly navigate to the Error page number and analyze the cause when an "Error -14 resuming" error occurs in S4. This can save developers the cost of debugging time.

---

v2: Modify the commit message and pr_err() function output

 kernel/power/snapshot.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/power/snapshot.c +5 -2
index 2a406753af90..2be2e9f5a060 100644
@@ -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("The page frame number: %lx is not valid.\n", buf[j]);
 			return -EFAULT;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 36 lines · Luo Xueqin

From: Xueqin Luo <[email protected]>

The system memory map can change over a hibernation-restore cycle due to a defect in the platform firmware, 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.

[  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.

So, by adding an Error message to the unpack () function, you can quickly navigate to the Error page number and analyze the cause when an "Error -14 resuming" error occurs in S4. This can save developers the cost of debugging time.

---

v2: Modify the commit message and pr_err() function output

 kernel/power/snapshot.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/power/snapshot.c +0 -0
index 2a406753af90..2be2e9f5a060 100644

kernel/power/snapshot.c static int unpack_orig_pfns(unsigned long *buf, struct memory_bitmap *bm) · line 2266

Quoted 10 lines
kernel/power/snapshot.c +4 -2
@@ -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("The page frame number: %lx is not valid.\n", buf[j]);

What about printing this message instead:

pr_err(FW_BUG "Memory map mismatch at 0x%llx after hibernation\n", page_address(pfn_to_page(buf[j])));

Quoted 8 lines
kernel/power/snapshot.c +1 -1
                        return -EFAULT;
+               }
        }
 
        return 0;
--

2.25.1

#2 lore raw
Quoted 51 lines · Rafael J. Wysocki
Quoted 36 lines · Luo Xueqin

From: Xueqin Luo <[email protected]>

The system memory map can change over a hibernation-restore cycle due to a defect in the platform firmware, 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.

[  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.

So, by adding an Error message to the unpack () function, you can quickly navigate to the Error page number and analyze the cause when an "Error -14 resuming" error occurs in S4. This can save developers the cost of debugging time.

---

v2: Modify the commit message and pr_err() function output

 kernel/power/snapshot.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/power/snapshot.c +0 -0
index 2a406753af90..2be2e9f5a060 100644

kernel/power/snapshot.c static int unpack_orig_pfns(unsigned long *buf, struct memory_bitmap *bm) · line 2266

Quoted 10 lines
kernel/power/snapshot.c +4 -2
@@ -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("The page frame number: %lx is not valid.\n", buf[j]);

What about printing this message instead:

Quoted 2 lines

pr_err(FW_BUG "Memory map mismatch at 0x%llx after hibernation\n", page_address(pfn_to_page(buf[j])));

Actually, this should be

pr_err(FW_BUG "Memory map mismatch at 0x%llx after hibernation\n", PFN_PHYS(buf[j])));

Quoted 9 lines
Quoted 9 lines
kernel/power/snapshot.c +1 -1
                        return -EFAULT;
+               }
        }
 
        return 0;
--

2.25.1