linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] watchdog: Fix a watchdog crash in some configurations
       [not found] <55491ef8.oLKEdMAPkQJVpO38%akpm@linux-foundation.org>
@ 2015-05-05 20:20 ` john.hubbard
  2015-05-05 20:42   ` John Hubbard
  0 siblings, 1 reply; 2+ messages in thread
From: john.hubbard @ 2015-05-05 20:20 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Stephen Rothwell, linux-next, mm-commits, John Hubbard

From: John Hubbard <jhubbard@nvidia.com>

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.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 kernel/watchdog.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 40fda2f..e8caf09 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -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();
-- 
2.3.7

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] watchdog: Fix a watchdog crash in some configurations
  2015-05-05 20:20 ` [PATCH v3] watchdog: Fix a watchdog crash in some configurations john.hubbard
@ 2015-05-05 20:42   ` John Hubbard
  0 siblings, 0 replies; 2+ messages in thread
From: John Hubbard @ 2015-05-05 20:42 UTC (permalink / raw)
  To: john.hubbard; +Cc: Andrew Morton, Stephen Rothwell, linux-next, mm-commits

> +	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.)

>  
>  	if (watchdog_enabled)
>  		watchdog_enable_all_cpus();
> -- 
> 2.3.7
> 
> 

thanks,
John H.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-05 20:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <55491ef8.oLKEdMAPkQJVpO38%akpm@linux-foundation.org>
2015-05-05 20:20 ` [PATCH v3] watchdog: Fix a watchdog crash in some configurations john.hubbard
2015-05-05 20:42   ` John Hubbard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).