Skip to contentSkip to conversation

hrtimer: support hrtimer suspend when CPU suspend

RFC PATCH New Wang Qing 1 participant 1 message Jun 21, 2021 High-resolution timers, timer wheel, clockevents

lore
Share & tools
lore

Wang Qing

author
#0 lore raw

RFC PATCH 1/1 hrtimer: support hrtimer suspend when CPU suspend

When the CPU suspend, in order to achieve a more power-saving effect, it is hoped that the CPU sleeps as long as possible, but the timer is an important reason for the CPU to wake up.

In some cases, when the CPU suspend, the timer doesn’t have to work either, such as watchdog hrtimer. The maximum suspend time of the CPU is 4s if enable lockup detector, which is unacceptable on some products, and in fact, watchdog timer can suspend when the cpu suspend.

This is a patch for comments, I'm not sure if there any ill-considerations. If this feature is really needed, I will continue to develop.

---
 include/linux/hrtimer.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/hrtimer.h +2 -0
index bb5e7b0..6d8e4f3
@@ -112,6 +112,7 @@ enum hrtimer_restart {
  * @is_soft:	Set if hrtimer will be expired in soft interrupt context.
  * @is_hard:	Set if hrtimer will be expired in hard interrupt context
  *		even on RT.
+ * @allow_suspend:	Set if hrtimer will suspend when CPU suspend
  *
  * The hrtimer structure must be initialized by hrtimer_init()
  */
@@ -124,6 +125,7 @@ struct hrtimer {
 	u8				is_rel;
 	u8				is_soft;
 	u8				is_hard;
+	u8				allow_suspend;
 };
 
 /**
Signature · 1 line
2.7.4