lkml.org 
[lkml]   [2015]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v8 2/3] watchdog: add watchdog_cpumask sysctl to assist nohz
On 04/16/2015 06:46 AM, Ulrich Obergfell wrote:
> if a user changes watchdog parameters in /proc/sys/kernel, the watchdog threads
> are not stopped and restarted in all cases. Parameters can also be changed 'on
> the fly', for example like 'watchdog_thresh' in the following flow of execution:
>
> proc_watchdog_thresh
> proc_watchdog_update
> if (watchdog_enabled && watchdog_thresh)
> watchdog_enable_all_cpus
> if (!watchdog_running) {
> // watchdog threads are already running so we don't get here
> } else {
> update_watchdog_all_cpus
> for_each_online_cpu <-----------------------------.
> update_watchdog |
> watchdog_nmi_disable |
> watchdog_nmi_enable |
> } |
> |
> I think we would not want to call watchdog_nmi_enable() for each_online_ CPU,
> but rather for each CPU that has an_unparked_ watchdog thread (i.e. where the
> watchdog mechanism is actually enabled).

How about something like this? I'll fold it into v9 of the patchset.
Thanks!

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 0c5a37cdbedd..a4e1c9a2e769 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -61,6 +61,10 @@ static cpumask_var_t watchdog_cpumask_for_smpboot;
static cpumask_var_t watchdog_cpumask;
unsigned long *watchdog_cpumask_bits;

+/* Helper for online, unparked cpus. */
+#define for_each_watchdog_cpu(cpu) \
+ for_each_cpu_and((cpu), cpu_online_mask, watchdog_cpumask)
+
static int __read_mostly watchdog_running;
static u64 __read_mostly sample_period;

@@ -209,7 +213,7 @@ void touch_all_softlockup_watchdogs(void)
* do we care if a 0 races with a timestamp?
* all it means is the softlock check starts one cycle later
*/
- for_each_online_cpu(cpu)
+ for_each_watchdog_cpu(cpu)
per_cpu(watchdog_touch_ts, cpu) = 0;
}

@@ -616,7 +620,7 @@ void watchdog_nmi_enable_all(void)
return;

get_online_cpus();
- for_each_online_cpu(cpu)
+ for_each_watchdog_cpu(cpu)
watchdog_nmi_enable(cpu);
put_online_cpus();
}
@@ -629,7 +633,7 @@ void watchdog_nmi_disable_all(void)
return;

get_online_cpus();
- for_each_online_cpu(cpu)
+ for_each_watchdog_cpu(cpu)
watchdog_nmi_disable(cpu);
put_online_cpus();
}
@@ -688,7 +692,7 @@ static void update_watchdog_all_cpus(void)
int cpu;

get_online_cpus();
- for_each_online_cpu(cpu)
+ for_each_watchdog_cpu(cpu)
update_watchdog(cpu);
put_online_cpus();
}
--
Chris Metcalf, EZChip Semiconductor
http://www.ezchip.com



\
 
 \ /
  Last update: 2015-04-17 18:01    [W:0.467 / U:1.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site