Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1667456 > unrolled thread

[PATCH v4 4/5] watchdog: provide watchdog_reconfigure() for arch watchdogs

Started byNicholas Piggin <npiggin@gmail.com>
First post2017-06-16 09:00 +0200
Last post2017-06-17 05:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 4/5] watchdog: provide watchdog_reconfigure() for arch watchdogs Nicholas Piggin <npiggin@gmail.com> - 2017-06-16 09:00 +0200
    Re: [PATCH v4 4/5] watchdog: provide watchdog_reconfigure() for  arch watchdogs Andrew Morton <akpm@linux-foundation.org> - 2017-06-16 20:30 +0200
      Re: [PATCH v4 4/5] watchdog: provide watchdog_reconfigure() for  arch watchdogs Nicholas Piggin <npiggin@gmail.com> - 2017-06-17 05:00 +0200

#1667456 — [PATCH v4 4/5] watchdog: provide watchdog_reconfigure() for arch watchdogs

FromNicholas Piggin <npiggin@gmail.com>
Date2017-06-16 09:00 +0200
Subject[PATCH v4 4/5] watchdog: provide watchdog_reconfigure() for arch watchdogs
Message-ID<tSToC-4Ym-13@gated-at.bofh.it>
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 1fba9c3d66dc..06cd965f64d2 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -123,6 +123,11 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
 {
 }
 
+void __weak watchdog_nmi_reconfigure(void)
+{
+}
+
+
 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
 
 /* Helper for online, unparked cpus. */
@@ -600,6 +605,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)
 {
@@ -619,6 +630,11 @@ static void watchdog_disable_all_cpus(void)
 {
 }
 
+static int watchdog_update_cpus(void)
+{
+	return 0;
+}
+
 static void set_sample_period(void)
 {
 }
@@ -651,6 +667,8 @@ int lockup_detector_suspend(void)
 		watchdog_enabled = 0;
 	}
 
+	watchdog_nmi_reconfigure();
+
 	mutex_unlock(&watchdog_proc_mutex);
 
 	return ret;
@@ -671,6 +689,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();
 }
@@ -696,6 +716,8 @@ static int proc_watchdog_update(void)
 	else
 		watchdog_disable_all_cpus();
 
+	watchdog_nmi_reconfigure();
+
 	return err;
 
 }
@@ -881,12 +903,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

[toc] | [next] | [standalone]


#1667998 — Re: [PATCH v4 4/5] watchdog: provide watchdog_reconfigure() for arch watchdogs

FromAndrew Morton <akpm@linux-foundation.org>
Date2017-06-16 20:30 +0200
SubjectRe: [PATCH v4 4/5] watchdog: provide watchdog_reconfigure() for arch watchdogs
Message-ID<tT4an-3MU-35@gated-at.bofh.it>
In reply to#1667456
On Fri, 16 Jun 2017 16:57:14 +1000 Nicholas Piggin <npiggin@gmail.com> wrote:

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

I'll update the title and changelog to say "watchdog_nmi_reconfigure".

> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -123,6 +123,11 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
>  {
>  }
>  
> +void __weak watchdog_nmi_reconfigure(void)
> +{
> +}

Can we please get some documentation in here describing what it's for? 
How arch maintainers might use this?  When and why it is called, what
it must do?  etc.

[toc] | [prev] | [next] | [standalone]


#1668138 — Re: [PATCH v4 4/5] watchdog: provide watchdog_reconfigure() for arch watchdogs

FromNicholas Piggin <npiggin@gmail.com>
Date2017-06-17 05:00 +0200
SubjectRe: [PATCH v4 4/5] watchdog: provide watchdog_reconfigure() for arch watchdogs
Message-ID<tTc7T-HT-5@gated-at.bofh.it>
In reply to#1667998
On Fri, 16 Jun 2017 11:24:07 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Fri, 16 Jun 2017 16:57:14 +1000 Nicholas Piggin <npiggin@gmail.com> wrote:
> 
> > 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.
> >   
> 
> I'll update the title and changelog to say "watchdog_nmi_reconfigure".

Thanks.


> > --- a/kernel/watchdog.c
> > +++ b/kernel/watchdog.c
> > @@ -123,6 +123,11 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
> >  {
> >  }
> >  
> > +void __weak watchdog_nmi_reconfigure(void)
> > +{
> > +}  
> 
> Can we please get some documentation in here describing what it's for? 
> How arch maintainers might use this?  When and why it is called, what
> it must do?  etc.

Good point, how's this?

---
 kernel/watchdog.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 06cd965f64d2..36531025496f 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -114,6 +114,10 @@ int __read_mostly watchdog_suspended;
 /*
  * These functions can be overridden if an architecture implements its
  * own hardlockup detector.
+ *
+ * watchdog_nmi_enable/disable can be implemented to start and stop when
+ * softlockup watchdog threads start and stop. The arch must select the
+ * SOFTLOCKUP_DETECTOR Kconfig.
  */
 int __weak watchdog_nmi_enable(unsigned int cpu)
 {
@@ -123,6 +127,17 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
 {
 }
 
+/*
+ * watchdog_nmi_reconfigure can be implemented to be notified after any
+ * watchdog configuration change. The arch hardlockup watchdog should
+ * respond to the following variables:
+ * - nmi_watchdog_enabled
+ * - watchdog_thresh
+ * - watchdog_cpumask
+ * - sysctl_hardlockup_all_cpu_backtrace
+ * - hardlockup_panic
+ * - watchdog_suspended
+ */
 void __weak watchdog_nmi_reconfigure(void)
 {
 }
-- 
2.11.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web