LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/3] watchdog: Fix broken nowatchdog logic
@ 2011-01-28 16:00 Don Zickus
2011-01-28 16:00 ` [PATCH 2/3] watchdog: Fix sysctl consistency Don Zickus
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Don Zickus @ 2011-01-28 16:00 UTC (permalink / raw)
To: x86
Cc: LKML, Marcin Slusarz, Don Zickus, Stephane Eranian,
Peter Zijlstra, Frederic Weisbecker, Ingo Molnar, stable
From: Marcin Slusarz <marcin.slusarz@gmail.com>
Passing nowatchdog to kernel disables 2 things: creation of watchdog threads
AND initialization of percpu watchdog_hrtimer. As hrtimers are initialized
only at boot it's not possible to enable watchdog later - for me all watchdog
threads started to eat 100% of CPU time, but they could just crash.
Additionally, even if these threads would start properly,
watchdog_disable_all_cpus was guarded by no_watchdog check, so you
couldn't disable watchdog.
To fix this, remove no_watchdog variable and use already existing
watchdog_enabled variable.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: stable@kernel.org
[ removed another no_watchdog instance ]
Signed-off-by: Don Zickus <dzickus@redhat.com>
---
kernel/watchdog.c | 20 ++++++--------------
1 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index aaa8dae..7d4213e 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -27,7 +27,7 @@
#include <asm/irq_regs.h>
#include <linux/perf_event.h>
-int watchdog_enabled;
+int watchdog_enabled = 1;
int __read_mostly softlockup_thresh = 60;
static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts);
@@ -43,9 +43,6 @@ static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved);
static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
#endif
-static int no_watchdog;
-
-
/* boot commands */
/*
* Should we panic when a soft-lockup or hard-lockup occurs:
@@ -58,7 +55,7 @@ static int __init hardlockup_panic_setup(char *str)
if (!strncmp(str, "panic", 5))
hardlockup_panic = 1;
else if (!strncmp(str, "0", 1))
- no_watchdog = 1;
+ watchdog_enabled = 0;
return 1;
}
__setup("nmi_watchdog=", hardlockup_panic_setup);
@@ -77,7 +74,7 @@ __setup("softlockup_panic=", softlockup_panic_setup);
static int __init nowatchdog_setup(char *str)
{
- no_watchdog = 1;
+ watchdog_enabled = 0;
return 1;
}
__setup("nowatchdog", nowatchdog_setup);
@@ -85,7 +82,7 @@ __setup("nowatchdog", nowatchdog_setup);
/* deprecated */
static int __init nosoftlockup_setup(char *str)
{
- no_watchdog = 1;
+ watchdog_enabled = 0;
return 1;
}
__setup("nosoftlockup", nosoftlockup_setup);
@@ -476,9 +473,6 @@ static void watchdog_disable_all_cpus(void)
{
int cpu;
- if (no_watchdog)
- return;
-
for_each_online_cpu(cpu)
watchdog_disable(cpu);
@@ -530,7 +524,8 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
break;
case CPU_ONLINE:
case CPU_ONLINE_FROZEN:
- err = watchdog_enable(hotcpu);
+ if (watchdog_enabled)
+ err = watchdog_enable(hotcpu);
break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_UP_CANCELED:
@@ -555,9 +550,6 @@ void __init lockup_detector_init(void)
void *cpu = (void *)(long)smp_processor_id();
int err;
- if (no_watchdog)
- return;
-
err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
WARN_ON(notifier_to_errno(err));
--
1.7.3.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] watchdog: Fix sysctl consistency
2011-01-28 16:00 [PATCH 1/3] watchdog: Fix broken nowatchdog logic Don Zickus
@ 2011-01-28 16:00 ` Don Zickus
2011-01-31 12:51 ` [tip:perf/urgent] " tip-bot for Marcin Slusarz
2011-01-28 16:00 ` [PATCH 3/3] watchdog: Don't change watchdog state on read of sysctl Don Zickus
2011-01-31 12:51 ` [tip:perf/urgent] watchdog: Fix broken nowatchdog logic tip-bot for Marcin Slusarz
2 siblings, 1 reply; 7+ messages in thread
From: Don Zickus @ 2011-01-28 16:00 UTC (permalink / raw)
To: x86
Cc: LKML, Marcin Slusarz, Don Zickus, Peter Zijlstra,
Frederic Weisbecker, Ingo Molnar, stable
From: Marcin Slusarz <marcin.slusarz@gmail.com>
If it was not possible to enable watchdog for any cpu, switch watchdog_enabled
back to 0, because it's visible via kernel.watchdog sysctl.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: stable@kernel.org
Signed-off-by: Don Zickus <dzickus@redhat.com>
---
kernel/watchdog.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 7d4213e..38af39a 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -429,9 +429,6 @@ static int watchdog_enable(int cpu)
wake_up_process(p);
}
- /* if any cpu succeeds, watchdog is considered enabled for the system */
- watchdog_enabled = 1;
-
return 0;
}
@@ -459,12 +456,16 @@ static void watchdog_disable(int cpu)
static void watchdog_enable_all_cpus(void)
{
int cpu;
- int result = 0;
+
+ watchdog_enabled = 0;
for_each_online_cpu(cpu)
- result += watchdog_enable(cpu);
+ if (!watchdog_enable(cpu))
+ /* if any cpu succeeds, watchdog is considered
+ enabled for the system */
+ watchdog_enabled = 1;
- if (result)
+ if (!watchdog_enabled)
printk(KERN_ERR "watchdog: failed to be enabled on some cpus\n");
}
--
1.7.3.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] watchdog: Don't change watchdog state on read of sysctl
2011-01-28 16:00 [PATCH 1/3] watchdog: Fix broken nowatchdog logic Don Zickus
2011-01-28 16:00 ` [PATCH 2/3] watchdog: Fix sysctl consistency Don Zickus
@ 2011-01-28 16:00 ` Don Zickus
2011-01-31 12:52 ` [tip:perf/urgent] " tip-bot for Marcin Slusarz
2011-01-31 12:51 ` [tip:perf/urgent] watchdog: Fix broken nowatchdog logic tip-bot for Marcin Slusarz
2 siblings, 1 reply; 7+ messages in thread
From: Don Zickus @ 2011-01-28 16:00 UTC (permalink / raw)
To: x86
Cc: LKML, Marcin Slusarz, Don Zickus, Peter Zijlstra,
Frederic Weisbecker, Ingo Molnar, stable
From: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: stable@kernel.org
[ add {}'s to fix a warning ]
Signed-off-by: Don Zickus <dzickus@redhat.com>
---
kernel/watchdog.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 38af39a..6b16cb1 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -493,10 +493,12 @@ int proc_dowatchdog_enabled(struct ctl_table *table, int write,
{
proc_dointvec(table, write, buffer, length, ppos);
- if (watchdog_enabled)
- watchdog_enable_all_cpus();
- else
- watchdog_disable_all_cpus();
+ if (write) {
+ if (watchdog_enabled)
+ watchdog_enable_all_cpus();
+ else
+ watchdog_disable_all_cpus();
+ }
return 0;
}
--
1.7.3.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip:perf/urgent] watchdog: Fix broken nowatchdog logic
2011-01-28 16:00 [PATCH 1/3] watchdog: Fix broken nowatchdog logic Don Zickus
2011-01-28 16:00 ` [PATCH 2/3] watchdog: Fix sysctl consistency Don Zickus
2011-01-28 16:00 ` [PATCH 3/3] watchdog: Don't change watchdog state on read of sysctl Don Zickus
@ 2011-01-31 12:51 ` tip-bot for Marcin Slusarz
2 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Marcin Slusarz @ 2011-01-31 12:51 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, eranian, hpa, mingo, a.p.zijlstra, marcin.slusarz,
fweisbec, stable, tglx, mingo, dzickus
Commit-ID: 4135038a582c20ffdadfcf6564852e0b72a20968
Gitweb: http://git.kernel.org/tip/4135038a582c20ffdadfcf6564852e0b72a20968
Author: Marcin Slusarz <marcin.slusarz@gmail.com>
AuthorDate: Fri, 28 Jan 2011 11:00:31 -0500
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 31 Jan 2011 13:22:42 +0100
watchdog: Fix broken nowatchdog logic
Passing nowatchdog to kernel disables 2 things: creation of
watchdog threads AND initialization of percpu watchdog_hrtimer.
As hrtimers are initialized only at boot it's not possible to
enable watchdog later - for me all watchdog threads started to
eat 100% of CPU time, but they could just crash.
Additionally, even if these threads would start properly,
watchdog_disable_all_cpus was guarded by no_watchdog check, so
you couldn't disable watchdog.
To fix this, remove no_watchdog variable and use already
existing watchdog_enabled variable.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
[ removed another no_watchdog instance ]
Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: <stable@kernel.org>
LKML-Reference: <1296230433-6261-1-git-send-email-dzickus@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/watchdog.c | 20 ++++++--------------
1 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index d7ebdf4..d9961ea 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -27,7 +27,7 @@
#include <asm/irq_regs.h>
#include <linux/perf_event.h>
-int watchdog_enabled;
+int watchdog_enabled = 1;
int __read_mostly softlockup_thresh = 60;
static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts);
@@ -43,9 +43,6 @@ static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved);
static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
#endif
-static int no_watchdog;
-
-
/* boot commands */
/*
* Should we panic when a soft-lockup or hard-lockup occurs:
@@ -58,7 +55,7 @@ static int __init hardlockup_panic_setup(char *str)
if (!strncmp(str, "panic", 5))
hardlockup_panic = 1;
else if (!strncmp(str, "0", 1))
- no_watchdog = 1;
+ watchdog_enabled = 0;
return 1;
}
__setup("nmi_watchdog=", hardlockup_panic_setup);
@@ -77,7 +74,7 @@ __setup("softlockup_panic=", softlockup_panic_setup);
static int __init nowatchdog_setup(char *str)
{
- no_watchdog = 1;
+ watchdog_enabled = 0;
return 1;
}
__setup("nowatchdog", nowatchdog_setup);
@@ -85,7 +82,7 @@ __setup("nowatchdog", nowatchdog_setup);
/* deprecated */
static int __init nosoftlockup_setup(char *str)
{
- no_watchdog = 1;
+ watchdog_enabled = 0;
return 1;
}
__setup("nosoftlockup", nosoftlockup_setup);
@@ -476,9 +473,6 @@ static void watchdog_disable_all_cpus(void)
{
int cpu;
- if (no_watchdog)
- return;
-
for_each_online_cpu(cpu)
watchdog_disable(cpu);
@@ -530,7 +524,8 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
break;
case CPU_ONLINE:
case CPU_ONLINE_FROZEN:
- err = watchdog_enable(hotcpu);
+ if (watchdog_enabled)
+ err = watchdog_enable(hotcpu);
break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_UP_CANCELED:
@@ -555,9 +550,6 @@ void __init lockup_detector_init(void)
void *cpu = (void *)(long)smp_processor_id();
int err;
- if (no_watchdog)
- return;
-
err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
WARN_ON(notifier_to_errno(err));
^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip:perf/urgent] watchdog: Fix sysctl consistency
2011-01-28 16:00 ` [PATCH 2/3] watchdog: Fix sysctl consistency Don Zickus
@ 2011-01-31 12:51 ` tip-bot for Marcin Slusarz
0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Marcin Slusarz @ 2011-01-31 12:51 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, a.p.zijlstra, marcin.slusarz, fweisbec,
stable, tglx, mingo, dzickus
Commit-ID: 397357666de6b5b6adb5fa99f9758ec8cf30ac34
Gitweb: http://git.kernel.org/tip/397357666de6b5b6adb5fa99f9758ec8cf30ac34
Author: Marcin Slusarz <marcin.slusarz@gmail.com>
AuthorDate: Fri, 28 Jan 2011 11:00:32 -0500
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 31 Jan 2011 13:22:43 +0100
watchdog: Fix sysctl consistency
If it was not possible to enable watchdog for any cpu, switch
watchdog_enabled back to 0, because it's visible via
kernel.watchdog sysctl.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: <stable@kernel.org>
LKML-Reference: <1296230433-6261-2-git-send-email-dzickus@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/watchdog.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index d9961ea..c7e0049 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -429,9 +429,6 @@ static int watchdog_enable(int cpu)
wake_up_process(p);
}
- /* if any cpu succeeds, watchdog is considered enabled for the system */
- watchdog_enabled = 1;
-
return 0;
}
@@ -459,12 +456,16 @@ static void watchdog_disable(int cpu)
static void watchdog_enable_all_cpus(void)
{
int cpu;
- int result = 0;
+
+ watchdog_enabled = 0;
for_each_online_cpu(cpu)
- result += watchdog_enable(cpu);
+ if (!watchdog_enable(cpu))
+ /* if any cpu succeeds, watchdog is considered
+ enabled for the system */
+ watchdog_enabled = 1;
- if (result)
+ if (!watchdog_enabled)
printk(KERN_ERR "watchdog: failed to be enabled on some cpus\n");
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip:perf/urgent] watchdog: Don't change watchdog state on read of sysctl
2011-01-28 16:00 ` [PATCH 3/3] watchdog: Don't change watchdog state on read of sysctl Don Zickus
@ 2011-01-31 12:52 ` tip-bot for Marcin Slusarz
0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Marcin Slusarz @ 2011-01-31 12:52 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, a.p.zijlstra, marcin.slusarz, fweisbec,
stable, tglx, mingo, dzickus
Commit-ID: 9ffdc6c37df131f89d52001e0ef03091b158826f
Gitweb: http://git.kernel.org/tip/9ffdc6c37df131f89d52001e0ef03091b158826f
Author: Marcin Slusarz <marcin.slusarz@gmail.com>
AuthorDate: Fri, 28 Jan 2011 11:00:33 -0500
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 31 Jan 2011 13:22:43 +0100
watchdog: Don't change watchdog state on read of sysctl
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
[ add {}'s to fix a warning ]
Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: <stable@kernel.org>
LKML-Reference: <1296230433-6261-3-git-send-email-dzickus@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/watchdog.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index c7e0049..f37f974 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -493,10 +493,12 @@ int proc_dowatchdog_enabled(struct ctl_table *table, int write,
{
proc_dointvec(table, write, buffer, length, ppos);
- if (watchdog_enabled)
- watchdog_enable_all_cpus();
- else
- watchdog_disable_all_cpus();
+ if (write) {
+ if (watchdog_enabled)
+ watchdog_enable_all_cpus();
+ else
+ watchdog_disable_all_cpus();
+ }
return 0;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] watchdog: don't change watchdog state on read of sysctl
@ 2011-01-18 22:37 Marcin Slusarz
0 siblings, 0 replies; 7+ messages in thread
From: Marcin Slusarz @ 2011-01-18 22:37 UTC (permalink / raw)
To: LKML; +Cc: Don Zickus, Peter Zijlstra, Frederic Weisbecker, Ingo Molnar, stable
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: stable@kernel.org
---
kernel/watchdog.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 9f24056..0e2776e 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -486,10 +486,11 @@ int proc_dowatchdog_enabled(struct ctl_table *table, int write,
{
proc_dointvec(table, write, buffer, length, ppos);
- if (watchdog_enabled)
- watchdog_enable_all_cpus();
- else
- watchdog_disable_all_cpus();
+ if (write)
+ if (watchdog_enabled)
+ watchdog_enable_all_cpus();
+ else
+ watchdog_disable_all_cpus();
return 0;
}
--
1.7.3.3
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-01-31 12:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28 16:00 [PATCH 1/3] watchdog: Fix broken nowatchdog logic Don Zickus
2011-01-28 16:00 ` [PATCH 2/3] watchdog: Fix sysctl consistency Don Zickus
2011-01-31 12:51 ` [tip:perf/urgent] " tip-bot for Marcin Slusarz
2011-01-28 16:00 ` [PATCH 3/3] watchdog: Don't change watchdog state on read of sysctl Don Zickus
2011-01-31 12:52 ` [tip:perf/urgent] " tip-bot for Marcin Slusarz
2011-01-31 12:51 ` [tip:perf/urgent] watchdog: Fix broken nowatchdog logic tip-bot for Marcin Slusarz
-- strict thread matches above, loose matches on Subject: below --
2011-01-18 22:37 [PATCH 3/3] watchdog: don't change watchdog state on read of sysctl Marcin Slusarz
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).