PM: sleep: Print PM debug messages during hibernation

[ Upstream commit 1b17d4525bca3916644c41e01522df8fa0f8b90b ]

Commit cdb8c100d8 ("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: cdb8c100d8 ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Rafael J. Wysocki
2025-05-09 14:51:47 +02:00
committed by Greg Kroah-Hartman
parent aa7b90057b
commit fca08cfadd
3 changed files with 11 additions and 1 deletions

View File

@@ -80,6 +80,11 @@ void hibernate_release(void)
atomic_inc(&hibernate_atomic); atomic_inc(&hibernate_atomic);
} }
bool hibernation_in_progress(void)
{
return !atomic_read(&hibernate_atomic);
}
bool hibernation_available(void) bool hibernation_available(void)
{ {
return nohibernate == 0 && return nohibernate == 0 &&

View File

@@ -585,7 +585,8 @@ bool pm_debug_messages_on __read_mostly;
bool pm_debug_messages_should_print(void) 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); EXPORT_SYMBOL_GPL(pm_debug_messages_should_print);

View File

@@ -66,10 +66,14 @@ extern void enable_restore_image_protection(void);
static inline void enable_restore_image_protection(void) {} static inline void enable_restore_image_protection(void) {}
#endif /* CONFIG_STRICT_KERNEL_RWX */ #endif /* CONFIG_STRICT_KERNEL_RWX */
extern bool hibernation_in_progress(void);
#else /* !CONFIG_HIBERNATION */ #else /* !CONFIG_HIBERNATION */
static inline void hibernate_reserved_size_init(void) {} static inline void hibernate_reserved_size_init(void) {}
static inline void hibernate_image_size_init(void) {} static inline void hibernate_image_size_init(void) {}
static inline bool hibernation_in_progress(void) { return false; }
#endif /* !CONFIG_HIBERNATION */ #endif /* !CONFIG_HIBERNATION */
#define power_attr(_name) \ #define power_attr(_name) \