Skip to contentSkip to conversation

watchdog: ignore nohz_full cores in new cpumask

PATCH Superseded Zqiang 2 participants 3 messages Nov 12, 2021 – Nov 16, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Zqiang

author
#0 lore raw

PATCH 1/1 watchdog: ignore nohz_full cores in new cpumask

If the nohz_full is enabled, when update watchdog_mask, the nohz_full cores should be ignored.

---
 kernel/watchdog.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/watchdog.c +3 -1
index ad912511a0c0..3ef11a94783c 100644
@@ -628,7 +628,9 @@ void lockup_detector_soft_poweroff(void)
 static void proc_watchdog_update(void)
 {
 	/* Remove impossible cpus to keep sysctl output clean. */
-	cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask);
+	cpumask_and(&watchdog_cpumask, &watchdog_cpumask, housekeeping_cpumask(HK_FLAG_TIMER));
+	if (cpumask_empty(&watchdog_cpumask))
+		return;
 	lockup_detector_reconfigure();
 }
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 13 lines · Zqiang

If the nohz_full is enabled, when update watchdog_mask, the nohz_full cores should be ignored.

---
 kernel/watchdog.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/watchdog.c +0 -0
index ad912511a0c0..3ef11a94783c 100644

kernel/watchdog.c void lockup_detector_soft_poweroff(void) · line 632

Quoted 6 lines
kernel/watchdog.c +1 -1
@@ -628,7 +628,9 @@ void lockup_detector_soft_poweroff(void)
 static void proc_watchdog_update(void)
 {
 	/* Remove impossible cpus to keep sysctl output clean. */
-	cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask);
+	cpumask_and(&watchdog_cpumask, &watchdog_cpumask,
 housekeeping_cpumask(HK_FLAG_TIMER));

I am not familiar with nozh_full code but this looks fine.

kernel/watchdog.c void lockup_detector_soft_poweroff(void) · line 633

Quoted 2 lines
kernel/watchdog.c +2 -0
+	if (cpumask_empty(&watchdog_cpumask))
+		return;

But this looks looks wrong. Is there any reason for this?

We need to stop the watchdog when it was running before.

I mean that lockup_detector_reconfigure() must be called anytime when the mask has changed even when it became empty.

kernel/watchdog.c void lockup_detector_soft_poweroff(void) · line 635

Quoted 2 lines
kernel/watchdog.c +0 -0
 	lockup_detector_reconfigure();
 }

Best Regards,
Petr

author
#2 lore raw
Quoted 23 lines · Petr Mladek
Quoted 13 lines · Zqiang

If the nohz_full is enabled, when update watchdog_mask, the nohz_full cores should be ignored.

---
  kernel/watchdog.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
kernel/watchdog.c +0 -0
index ad912511a0c0..3ef11a94783c 100644

kernel/watchdog.c void lockup_detector_soft_poweroff(void) · line 632

Quoted 6 lines
kernel/watchdog.c +1 -1
@@ -628,7 +628,9 @@ void lockup_detector_soft_poweroff(void)
  static void proc_watchdog_update(void)
  {
  	/* Remove impossible cpus to keep sysctl output clean. */
-	cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask);
+	cpumask_and(&watchdog_cpumask, &watchdog_cpumask,
 housekeeping_cpumask(HK_FLAG_TIMER));

I am not familiar with nozh_full code but this looks fine.

Quoted 8 lines

kernel/watchdog.c void lockup_detector_soft_poweroff(void) · line 633

Quoted 2 lines
kernel/watchdog.c +2 -0
+	if (cpumask_empty(&watchdog_cpumask))
+		return;

But this looks looks wrong. Is there any reason for this?

We need to stop the watchdog when it was running before.

I mean that lockup_detector_reconfigure() must be called anytime when the mask has changed even when it became empty.

Thanks Petr

I will resend patch v2.

Quoted 6 lines

kernel/watchdog.c void lockup_detector_soft_poweroff(void) · line 635

Quoted 4 lines
kernel/watchdog.c +0 -0
  	lockup_detector_reconfigure();
  }

Best Regards,
Petr