mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Puyou Lu <puyou.lu@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Puyou Lu <puyou.lu@gmail.com>, Petr Mladek <pmladek@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Xiaoming Ni <nixiaoming@huawei.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Frederic Weisbecker <frederic@kernel.org>,
	Laurent Dufour <ldufour@linux.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] watchdog: don't enable watchdog if user disabled it
Date: Sun,  7 Aug 2022 23:18:44 +0800	[thread overview]
Message-ID: <20220807151845.18597-1-puyou.lu@gmail.com> (raw)

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


                 reply	other threads:[~2022-08-07 15:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220807151845.18597-1-puyou.lu@gmail.com \
    --to=puyou.lu@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=frederic@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=ldufour@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mcgrof@kernel.org \
    --cc=nixiaoming@huawei.com \
    --cc=pmladek@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®