linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: Don Zickus <dzickus@redhat.com>
Cc: Nicholas Piggin <npiggin@gmail.com>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: [PATCH 4/4] watchdog: Provide watchdog_reconfigure() for arch watchdogs
Date: Tue, 30 May 2017 11:26:59 +1000	[thread overview]
Message-ID: <20170530012659.16791-5-npiggin@gmail.com> (raw)
In-Reply-To: <20170530012659.16791-1-npiggin@gmail.com>

After reconfiguring watchdog sysctls etc., architecture specific
watchdogs may not get all their parameters updated.

watchdog_reconfigure() can be implemented to pull the new values
in and set the arch NMI watchdog.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 kernel/watchdog.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index deb010505646..5397c637db2d 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -120,6 +120,11 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
 {
 }
 
+void __weak watchdog_nmi_reconfigure(void)
+{
+}
+
+
 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
 
 /* Helper for online, unparked cpus. */
@@ -597,6 +602,12 @@ static void watchdog_disable_all_cpus(void)
 	}
 }
 
+static int watchdog_update_cpus(void)
+{
+	return smpboot_update_cpumask_percpu_thread(
+		    &watchdog_threads, &watchdog_cpumask);
+}
+
 #else /* SOFTLOCKUP */
 static int watchdog_park_threads(void)
 {
@@ -616,6 +627,11 @@ static void watchdog_disable_all_cpus(void)
 {
 }
 
+static int watchdog_update_cpus(void)
+{
+	return 0;
+}
+
 static void set_sample_period(void)
 {
 }
@@ -648,6 +664,8 @@ int lockup_detector_suspend(void)
 		watchdog_enabled = 0;
 	}
 
+	watchdog_nmi_reconfigure();
+
 	mutex_unlock(&watchdog_proc_mutex);
 
 	return ret;
@@ -668,6 +686,8 @@ void lockup_detector_resume(void)
 	if (watchdog_running && !watchdog_suspended)
 		watchdog_unpark_threads();
 
+	watchdog_nmi_reconfigure();
+
 	mutex_unlock(&watchdog_proc_mutex);
 	put_online_cpus();
 }
@@ -693,6 +713,8 @@ static int proc_watchdog_update(void)
 	else
 		watchdog_disable_all_cpus();
 
+	watchdog_nmi_reconfigure();
+
 	return err;
 
 }
@@ -878,12 +900,11 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write,
 			 * a temporary cpumask, so we are likely not in a
 			 * position to do much else to make things better.
 			 */
-#ifdef CONFIG_SOFTLOCKUP_DETECTOR
-			if (smpboot_update_cpumask_percpu_thread(
-				    &watchdog_threads, &watchdog_cpumask) != 0)
+			if (watchdog_update_cpus() != 0)
 				pr_err("cpumask update failed\n");
-#endif
 		}
+
+		watchdog_nmi_reconfigure();
 	}
 out:
 	mutex_unlock(&watchdog_proc_mutex);
-- 
2.11.0

  parent reply	other threads:[~2017-05-30  1:27 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30  1:26 [PATCH 0/4][V3] Improve watchdog config for arch watchdogs Nicholas Piggin
2017-05-30  1:26 ` [PATCH 1/4] watchdog: remove unused declaration Nicholas Piggin
2017-05-30  1:26   ` Nicholas Piggin
2017-05-30  1:26 ` [PATCH 2/4] watchdog: Introduce arch_touch_nmi_watchdog() Nicholas Piggin
2017-05-30  1:26   ` Nicholas Piggin
2017-05-30  1:26 ` [PATCH 3/4] watchdog: Split up config options Nicholas Piggin
2017-05-30  1:26   ` Nicholas Piggin
2017-06-02 20:15   ` Don Zickus
2017-06-03  6:10     ` Nicholas Piggin
2017-06-06 16:49       ` Don Zickus
2017-06-07  3:50         ` Nicholas Piggin
2017-06-08 16:05           ` Don Zickus
2017-06-12  8:07             ` Nicholas Piggin
2017-06-12 20:41               ` Don Zickus
2017-06-13 16:11                 ` Nicholas Piggin
2017-06-14 14:09                   ` Don Zickus
2017-06-15  2:16                     ` Babu Moger
2017-06-15  3:04                       ` Nicholas Piggin
2017-06-15 15:14                         ` Babu Moger
2017-06-15 15:51                         ` Don Zickus
2017-06-15 15:59                           ` Nicholas Piggin
2017-06-15 15:59                             ` Nicholas Piggin
2017-06-15 18:42                             ` Don Zickus
2017-05-30  1:26 ` Nicholas Piggin [this message]
2017-06-06 16:08 ` [PATCH 0/4][V3] Improve watchdog config for arch watchdogs Don Zickus
2017-06-06 19:46   ` Babu Moger
2017-06-06 19:46     ` Babu Moger
2017-06-07 14:37     ` Don Zickus
2017-06-07 14:37       ` Don Zickus
  -- strict thread matches above, loose matches on Subject: below --
2017-05-25  8:28 [PATCH 0/4][V2] " Nicholas Piggin
2017-05-25  8:28 ` [PATCH 4/4] watchdog: provide watchdog_reconfigure() " Nicholas Piggin
2017-05-25  8:28   ` Nicholas Piggin
2017-05-25 14:08   ` Don Zickus
2017-05-26  0:39     ` Nicholas Piggin
2017-05-26  0:39       ` Nicholas Piggin
2017-05-26 14:21       ` Don Zickus

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=20170530012659.16791-5-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=dzickus@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).