mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2] watchdog: don't enable watchdog if user disabled it
@ 2022-08-07 15:18 Puyou Lu
  0 siblings, 0 replies; only message in thread
From: Puyou Lu @ 2022-08-07 15:18 UTC (permalink / raw)
  Cc: Puyou Lu, Petr Mladek, Andrew Morton, Luis Chamberlain,
	Juri Lelli, Xiaoming Ni, Rasmus Villemoes, Frederic Weisbecker,
	Laurent Dufour, linux-kernel

Take a check of watchdog_enabled before reconfigure/enable watchdog.

Signed-off-by: Puyou Lu <puyou.lu@gmail.com>
---
 kernel/watchdog.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index bed1fe7ecaea..791765c9bece 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -454,6 +454,9 @@ static void watchdog_enable(unsigned int cpu)
 
 	WARN_ON_ONCE(cpu != smp_processor_id());
 
+	if (!watchdog_enabled)
+		return;
+
 	init_completion(done);
 	complete(done);
 
@@ -546,6 +549,10 @@ static void __lockup_detector_reconfigure(void)
 
 	set_sample_period();
 	lockup_detector_update_enable();
+
+	if (!watchdog_enabled)
+		return;
+
 	if (watchdog_enabled & SOFT_WATCHDOG_ENABLED)
 		softlockup_start_all();
 
@@ -591,6 +598,10 @@ static void __lockup_detector_reconfigure(void)
 	cpus_read_lock();
 	watchdog_nmi_stop();
 	lockup_detector_update_enable();
+
+	if (!watchdog_enabled)
+		return;
+
 	watchdog_nmi_start();
 	cpus_read_unlock();
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-07 15:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-07 15:18 [PATCH 2/2] watchdog: don't enable watchdog if user disabled it Puyou Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®