Skip to content

Commit 1b17d45

Browse files
committed
PM: sleep: Print PM debug messages during hibernation
Commit cdb8c10 ("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: cdb8c10 ("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
1 parent d559335 commit 1b17d45

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

kernel/power/hibernate.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ void hibernate_release(void)
9090
atomic_inc(&hibernate_atomic);
9191
}
9292

93+
bool hibernation_in_progress(void)
94+
{
95+
return !atomic_read(&hibernate_atomic);
96+
}
97+
9398
bool hibernation_available(void)
9499
{
95100
return nohibernate == 0 &&

kernel/power/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,8 @@ bool pm_debug_messages_on __read_mostly;
613613

614614
bool pm_debug_messages_should_print(void)
615615
{
616-
return pm_debug_messages_on && pm_suspend_target_state != PM_SUSPEND_ON;
616+
return pm_debug_messages_on && (hibernation_in_progress() ||
617+
pm_suspend_target_state != PM_SUSPEND_ON);
617618
}
618619
EXPORT_SYMBOL_GPL(pm_debug_messages_should_print);
619620

kernel/power/power.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ extern void enable_restore_image_protection(void);
7171
static inline void enable_restore_image_protection(void) {}
7272
#endif /* CONFIG_STRICT_KERNEL_RWX */
7373

74+
extern bool hibernation_in_progress(void);
75+
7476
#else /* !CONFIG_HIBERNATION */
7577

7678
static inline void hibernate_reserved_size_init(void) {}
7779
static inline void hibernate_image_size_init(void) {}
80+
81+
static inline bool hibernation_in_progress(void) { return false; }
7882
#endif /* !CONFIG_HIBERNATION */
7983

8084
#define power_attr(_name) \

0 commit comments

Comments
 (0)