]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PM: sleep: Print PM debug messages during hibernation
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 9 May 2025 12:51:47 +0000 (14:51 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 13 May 2025 12:00:20 +0000 (14:00 +0200)
Commit cdb8c100d8a4 ("include/linux/suspend.h: Only show pm_pr_dbg
messages at suspend/resume") caused PM debug messages to only be
printed during system-wide suspend and resume in progress, but it
forgot about hibernation.

Address this by adding a check for hibernation in progress to
pm_debug_messages_should_print().

Fixes: cdb8c100d8a4 ("include/linux/suspend.h: Only show pm_pr_dbg messages at suspend/resume")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/4998903.GXAFRqVoOG@rjwysocki.net
kernel/power/hibernate.c
kernel/power/main.c
kernel/power/power.h

index f4db2e82fd873316b28c6d2669eb7dedcc7f4d97..c503baf170aff67109a270fff79076b192864aea 100644 (file)
@@ -90,6 +90,11 @@ void hibernate_release(void)
        atomic_inc(&hibernate_atomic);
 }
 
+bool hibernation_in_progress(void)
+{
+       return !atomic_read(&hibernate_atomic);
+}
+
 bool hibernation_available(void)
 {
        return nohibernate == 0 &&
index 97746f08b762b4e34f661705880bc0b6a9f481e2..fb20a6e26fb6ae4669a572f9e0c0e4f528c74eb7 100644 (file)
@@ -613,7 +613,8 @@ bool pm_debug_messages_on __read_mostly;
 
 bool pm_debug_messages_should_print(void)
 {
-       return pm_debug_messages_on && pm_suspend_target_state != PM_SUSPEND_ON;
+       return pm_debug_messages_on && (hibernation_in_progress() ||
+               pm_suspend_target_state != PM_SUSPEND_ON);
 }
 EXPORT_SYMBOL_GPL(pm_debug_messages_should_print);
 
index c352dea2f67b56fb4ceae4500a8b67e51a465669..f8496f40b54fa594a75198bf166e6d433e894e08 100644 (file)
@@ -71,10 +71,14 @@ extern void enable_restore_image_protection(void);
 static inline void enable_restore_image_protection(void) {}
 #endif /* CONFIG_STRICT_KERNEL_RWX */
 
+extern bool hibernation_in_progress(void);
+
 #else /* !CONFIG_HIBERNATION */
 
 static inline void hibernate_reserved_size_init(void) {}
 static inline void hibernate_image_size_init(void) {}
+
+static inline bool hibernation_in_progress(void) { return false; }
 #endif /* !CONFIG_HIBERNATION */
 
 #define power_attr(_name) \