Skip to contentSkip to conversation

+ watchdog-add-watchdog_cpumask-sysctl-to-assist-nohz-fix.patch added to -mm tree

PATCH Superseded [email protected] 3 participants 3 messages May 5, 2015 Linux-next tree

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

[email protected]

author tree notice
#0 lore raw

The patch titled
Subject: watchdog: Fix a watchdog crash in some configurations
has been added to the -mm tree. Its filename is
watchdog-add-watchdog_cpumask-sysctl-to-assist-nohz-fix.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/watchdog-add-watchdog_cpumask-sysctl-to-assist-nohz-fix.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/watchdog-add-watchdog_cpumask-sysctl-to-assist-nohz-fix.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: John Hubbard <[email protected]>
Subject: watchdog: Fix a watchdog crash in some configurations

Commit 8fcf2cc768acd845c1fed837bf9cfe2d7106336d in linux-next introduced a regression in some configurations. Specifically, with CONFIG_NO_HZ_FULL set, and CONFIG_NO_HZ_FULL_ALL *not* set, the kernel will crash in lockup_detector_init(), due to a NULL tick_nohz_full_mask pointer.

This is because the above commit uses tick_nohz_full_mask (in lockup_detector_init), if CONFIG_NO_HZ_FULL is set, but tick_nohz_full_mask only gets allocated if either:

a) CONFIG_NO_HZ_FULL_ALL is set, or

b) Someone passes in nohz_full=<any_value> on the boot args line.

To correct this, change lockup_detector_init so that it does a runtime check instead of the ifdef check. This fix is simpler than my original proposed fix, thanks to Chris Metcalf for that.

---

 kernel/watchdog.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
kernel/watchdog.c renamed from kernel/watchdog.c~watchdog-add-watchdog_cpumask-sysctl-to-assist-nohz-fix +8 -8
diff -puN kernel/watchdog.c~watchdog-add-watchdog_cpumask-sysctl-to-assist-nohz-fix kernel/watchdog.c
@@ -920,14 +920,14 @@ void __init lockup_detector_init(void)
 {
 	set_sample_period();
 
-#ifdef CONFIG_NO_HZ_FULL
-	if (!cpumask_empty(tick_nohz_full_mask))
-		pr_info("Disabling watchdog on nohz_full cores by default\n");
-	cpumask_andnot(&watchdog_cpumask, cpu_possible_mask,
-		       tick_nohz_full_mask);
-#else
-	cpumask_copy(&watchdog_cpumask, cpu_possible_mask);
-#endif
+	if (tick_nohz_full_enabled()) {
+		if (!cpumask_empty(tick_nohz_full_mask))
+			pr_info("Disabling watchdog on nohz_full cores by default\n");
+		cpumask_andnot(&watchdog_cpumask, cpu_possible_mask,
+			       tick_nohz_full_mask);
+	}
+	else
+		cpumask_copy(&watchdog_cpumask, cpu_possible_mask);
 
 	if (watchdog_enabled)
 		watchdog_enable_all_cpus();

_

Patches currently in -mm which might be from [email protected] are

watchdog-add-watchdog_cpumask-sysctl-to-assist-nohz-fix.patch

#1 lore raw

PATCH v3 1/1 watchdog: Fix a watchdog crash in some configurations

From: John Hubbard <[email protected]>

Commit <8fcf2cc768acd845c> in linux-next
introduced a regression in some configurations. Specifically, with CONFIG_NO_HZ_FULL set, and CONFIG_NO_HZ_FULL_ALL *not* set, the kernel will crash in lockup_detector_init(), due to a NULL tick_nohz_full_mask pointer.

This is because the above commit uses tick_nohz_full_mask (in lockup_detector_init), if CONFIG_NO_HZ_FULL is set, but tick_nohz_full_mask only gets allocated if either:

a) CONFIG_NO_HZ_FULL_ALL is set, or

b) Someone passes in nohz_full=<any_value> on the boot args line.

To correct this, change lockup_detector_init so that it does a runtime check instead of the ifdef check. This fix is simpler than my original proposed fix, thanks to Chris Metcalf for that.

---
 kernel/watchdog.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
kernel/watchdog.c +7 -8
index 40fda2f..e8caf09 100644
@@ -920,14 +920,13 @@ void __init lockup_detector_init(void)
 {
 	set_sample_period();
 
-#ifdef CONFIG_NO_HZ_FULL
-	if (!cpumask_empty(tick_nohz_full_mask))
-		pr_info("Disabling watchdog on nohz_full cores by default\n");
-	cpumask_andnot(&watchdog_cpumask, cpu_possible_mask,
-		       tick_nohz_full_mask);
-#else
-	cpumask_copy(&watchdog_cpumask, cpu_possible_mask);
-#endif
+	if (tick_nohz_full_enabled()) {
+		if (!cpumask_empty(tick_nohz_full_mask))
+			pr_info("Disabling watchdog on nohz_full cores by default\n");
+		cpumask_andnot(&watchdog_cpumask, cpu_possible_mask,
+			       tick_nohz_full_mask);
+	} else
+		cpumask_copy(&watchdog_cpumask, cpu_possible_mask);
 
 	if (watchdog_enabled)
 		watchdog_enable_all_cpus();
Signature · 1 line
2.3.7
#2 lore raw

Re: [PATCH v3] watchdog: Fix a watchdog crash in some configurations

kernel/watchdog.c void __init lockup_detector_init(void) · line 929

Quoted 7 lines
kernel/watchdog.c +7 -0
+	if (tick_nohz_full_enabled()) {
+		if (!cpumask_empty(tick_nohz_full_mask))
+			pr_info("Disabling watchdog on nohz_full cores by default\n");
+		cpumask_andnot(&watchdog_cpumask, cpu_possible_mask,
+			       tick_nohz_full_mask);
+	} else
+		cpumask_copy(&watchdog_cpumask, cpu_possible_mask);

In case it's not clear, the only difference between v3 and v2 of this patch, is that v3 corrects the checkpatch.pl violations. (I apologize for the multiple emails required to get such a small patch perfected. I'll have the workflow going much smoother next time, I promise.)

Quoted 7 lines
kernel/watchdog.c +0 -0
 	if (watchdog_enabled)
 		watchdog_enable_all_cpus();
Signature · 1 line
2.3.7

thanks,
John H.