From: Nathan Lynch <ntl@pobox.com>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH] softlockup detection vs. cpu hotplug
Date: Thu, 23 Feb 2006 18:31:46 -0600 [thread overview]
Message-ID: <20060224003146.GJ3293@localhost.localdomain> (raw)
I'm able to trigger bogus softlockup warnings during cpu hotplug
testing, due to the percpu timestamp not being re-initialized before
the cpu starts servicing timer interrupts.
Before starting a cpu's watchdog thread, touch the cpu's timestamp to
avoid false positives.
In the watchdog thread, do touch_softlockup_watchdog in a
non-preemptible section so that it won't touch another cpu's
timestamp. This can happen in the window between the watchdog thread
getting forcefully migrated during a cpu offline operation and
kthread_should_stop.
Signed-off-by: Nathan Lynch <ntl@pobox.com>
---
kernel/softlockup.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
33426e0c29ad973f9107cbd872648050f8988e61
diff --git a/kernel/softlockup.c b/kernel/softlockup.c
index c67189a..bd86fe1 100644
--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -34,9 +34,14 @@ static struct notifier_block panic_block
.notifier_call = softlock_panic,
};
+static void __touch_softlockup_watchdog(int cpu)
+{
+ per_cpu(timestamp, cpu) = jiffies;
+}
+
void touch_softlockup_watchdog(void)
{
- per_cpu(timestamp, raw_smp_processor_id()) = jiffies;
+ __touch_softlockup_watchdog(raw_smp_processor_id());
}
EXPORT_SYMBOL(touch_softlockup_watchdog);
@@ -73,6 +78,7 @@ void softlockup_tick(struct pt_regs *reg
static int watchdog(void * __bind_cpu)
{
struct sched_param param = { .sched_priority = 99 };
+ unsigned long bind_cpu = (unsigned long)__bind_cpu;
sched_setscheduler(current, SCHED_FIFO, ¶m);
current->flags |= PF_NOFREEZE;
@@ -86,10 +92,15 @@ static int watchdog(void * __bind_cpu)
*/
while (!kthread_should_stop()) {
msleep_interruptible(1000);
- touch_softlockup_watchdog();
+ /* When our cpu is offlined the watchdog thread can
+ * get migrated before it is stopped.
+ */
+ preempt_disable();
+ if (likely(smp_processor_id() == bind_cpu))
+ touch_softlockup_watchdog();
+ preempt_enable();
+ __set_current_state(TASK_RUNNING);
}
- __set_current_state(TASK_RUNNING);
-
return 0;
}
@@ -112,6 +123,7 @@ cpu_callback(struct notifier_block *nfb,
}
per_cpu(watchdog_task, hotcpu) = p;
kthread_bind(p, hotcpu);
+ __touch_softlockup_watchdog(hotcpu);
break;
case CPU_ONLINE:
--
1.1.5
next reply other threads:[~2006-02-24 0:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-24 0:31 Nathan Lynch [this message]
2006-02-24 1:31 ` [PATCH] softlockup detection vs. cpu hotplug Shaohua Li
2006-02-24 6:25 ` Ingo Molnar
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=20060224003146.GJ3293@localhost.localdomain \
--to=ntl@pobox.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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