Skip to contentSkip to conversation

power: suspend: Move dpm_watchdog to suspend.c and enhance it

PATCH [email protected] 1 participant 1 message Mar 16, 2021

lore
Share & tools
lore
#0 lore raw
Quoted 57 lines

Since dpm_watchdog just cover two functions __device_suspend() and device_resume(), we proposed to move it to core power suspend.c to extend its coverage and monitor more devices suspend hand issues.

We propose to use new name suspend watchdog and new timeout handler to cover more sleep hang issues. The new timeout handler will dump disk sleep task call trace at first round timeout and trigger kernel panic at second round timeout.
The default timer for each round is defined in CONFIG_PM_SUSPEND_WATCHDOG_TIMEOUT.

---
Changes since v5:
- Remove MAINTAINERS update since we current MAINTAINERS already cover
kernel/power/

  drivers/base/power/main.c       | 69 ---------------------------
  kernel/power/Kconfig            | 27 +++++------
  kernel/power/Makefile           |  1 +
  kernel/power/suspend.c          | 19 ++++++++
  kernel/power/suspend_watchdog.c | 84 +++++++++++++++++++++++++++++++++
  kernel/power/suspend_watchdog.h | 40 ++++++++++++++++
  kernel/printk/printk.c          |  2 +-
  7 files changed, 158 insertions(+), 84 deletions(-)

create mode 100644 kernel/power/suspend_watchdog.c create mode 100644 kernel/power/suspend_watchdog.h

(quoted diff) +1 -0
@@ -916,7 +852,6 @@ static int device_resume(struct device *dev,  
 pm_message_t state, bool async)
         if (!dpm_wait_for_superior(dev, async))
                 goto Complete;
 
+
  /**
   * pm_suspend_default_s2idle - Check if suspend-to-idle is the default  

suspend.
*

(quoted diff) +2 -0
@@ -89,6 +92,8 @@ static void s2idle_enter(void)
  {
         trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_TO_IDLE,  
 true);
 
+       stop_suspend_watchdog(&suspend_wd);
+
         raw_spin_lock_irq(&s2idle_lock);
         if (pm_wakeup_pending())
                 goto out;
(quoted diff) +2 -0
@@ -114,6 +119,8 @@ static void s2idle_enter(void)
         s2idle_state = S2IDLE_STATE_NONE;
         raw_spin_unlock_irq(&s2idle_lock);
 
+       start_suspend_watchdog(&suspend_wd);
+
         trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_TO_IDLE,  
 false);
  }
Quoted 1 line

2.30.0.365.g02bc693789-goog

Hi Greg and Rafael,

Sorry for the interrupt ~
Since this patch is really help us to narrow down many problems at our platform. May I know if you could help to take a look at PATCH#6 again ?

Thank you,
Joseph.