[PATCH RFC 2/2] watchdog: support watchdog hrtimer suspend when CPU suspend

From: Wang Qing
Date: Tue Jun 22 2021 - 05:07:31 EST


the watchdog hrtimer doesn’t have to work while CPU is suspend. Otherwise
the maximum suspend time of the CPU is 4s if enable lockup detector,
which is unacceptable on some products.

Signed-off-by: Wang Qing <wangqing@xxxxxxxx>
---
kernel/watchdog.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 7c39790..f68591f
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -455,7 +455,8 @@ static void watchdog_enable(unsigned int cpu)
* Start the timer first to prevent the NMI watchdog triggering
* before the timer has a chance to fire.
*/
- hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
+ hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD
+ | HRTIMER_MODE_SUSPEND);
hrtimer->function = watchdog_timer_fn;
hrtimer_start(hrtimer, ns_to_ktime(sample_period),
HRTIMER_MODE_REL_PINNED_HARD);
--
2.7.4