From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>
Cc: "Brian Geffon" <bgeffon@google.com>,
kernel@collabora.com, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Nícolas F. R. A. Prado" <nfraprado@collabora.com>
Subject: [PATCH 2/3] PM: hibernate: Add platform_enter hibernation test level
Date: Mon, 18 May 2026 17:34:23 -0400 [thread overview]
Message-ID: <20260518-hibernation-decrease-time-in-copy-data-pages-v1-2-3998bdf90ee5@collabora.com> (raw)
In-Reply-To: <20260518-hibernation-decrease-time-in-copy-data-pages-v1-0-3998bdf90ee5@collabora.com>
Add a 'platform_enter' hibernation test level to allow testing the full
hibernation path up until the last point of return in
hibernation_platform_enter().
In particular this allows seeing print messages from the code run after
the hibernation image is created on platforms that don't have an easily
accessible serial console, since these messages are not present upon
hibernation resume.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
kernel/power/hibernate.c | 13 +++++++++++--
kernel/power/main.c | 1 +
kernel/power/power.h | 1 +
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 001e4556b137..15cb7a090770 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -75,6 +75,7 @@ enum {
static int hibernation_mode = HIBERNATION_SHUTDOWN;
bool freezer_test_done;
+bool platform_enter_test_done;
static const struct platform_hibernation_ops *hibernation_ops;
@@ -636,6 +637,11 @@ int hibernation_platform_enter(void)
goto Power_up;
}
+ if (hibernation_test(TEST_PLATFORM_ENTER)) {
+ platform_enter_test_done = true;
+ goto Power_up;
+ }
+
hibernation_ops->enter();
/* We should never get here */
while (1);
@@ -700,6 +706,8 @@ static int power_down(void)
break;
case HIBERNATION_PLATFORM:
error = hibernation_platform_enter();
+ if (platform_enter_test_done)
+ goto exit;
if (error == -EAGAIN || error == -EBUSY) {
events_check_enabled = false;
pr_info("Wakeup event detected during hibernation, rolling back.\n");
@@ -848,7 +856,7 @@ int hibernate(void)
else
error = power_down();
}
- if (error) {
+ if (error || platform_enter_test_done) {
/* recover any devices that refused to thaw */
dpm_resume_suspended_devices(PMSG_RECOVER);
}
@@ -870,8 +878,9 @@ int hibernate(void)
}
thaw_processes();
- /* Don't bother checking whether freezer_test_done is true */
+ /* Don't bother checking whether any of the test_done flags are true */
freezer_test_done = false;
+ platform_enter_test_done = false;
Exit:
filesystems_thaw();
pm_notifier_call_chain(PM_POST_HIBERNATION);
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 7f53ef65b789..04f0c429519c 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -273,6 +273,7 @@ static const char * const pm_tests[__TEST_AFTER_LAST] = {
[TEST_PLATFORM] = "platform",
[TEST_DEVICES] = "devices",
[TEST_FREEZER] = "freezer",
+ [TEST_PLATFORM_ENTER] = "platform_enter",
};
static ssize_t pm_test_show(struct kobject *kobj, struct kobj_attribute *attr,
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 7ccd709af93f..0d33d0e46ed0 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -259,6 +259,7 @@ enum {
TEST_PLATFORM,
TEST_DEVICES,
TEST_FREEZER,
+ TEST_PLATFORM_ENTER,
/* keep last */
__TEST_AFTER_LAST
};
--
2.53.0
next prev parent reply other threads:[~2026-05-18 21:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 21:34 [PATCH 0/3] Shrink time spent in copy_data_pages() Nícolas F. R. A. Prado
2026-05-18 21:34 ` [PATCH 1/3] PM: hibernate: Print speed statistics of copy_data_pages() Nícolas F. R. A. Prado
2026-05-18 21:34 ` Nícolas F. R. A. Prado [this message]
2026-05-18 21:34 ` [PATCH 3/3] PM: hibernate: Allow disabling zero page check in copy_data_pages() Nícolas F. R. A. Prado
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260518-hibernation-decrease-time-in-copy-data-pages-v1-2-3998bdf90ee5@collabora.com \
--to=nfraprado@collabora.com \
--cc=bgeffon@google.com \
--cc=kernel@collabora.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox