git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6.23
[pandora-kernel.git]
/
kernel
/
softlockup.c
diff --git
a/kernel/softlockup.c
b/kernel/softlockup.c
index
50afeb8
..
708d488
100644
(file)
--- a/
kernel/softlockup.c
+++ b/
kernel/softlockup.c
@@
-10,6
+10,7
@@
#include <linux/cpu.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/cpu.h>
#include <linux/init.h>
#include <linux/delay.h>
+#include <linux/freezer.h>
#include <linux/kthread.h>
#include <linux/notifier.h>
#include <linux/module.h>
#include <linux/kthread.h>
#include <linux/notifier.h>
#include <linux/module.h>
@@
-34,12
+35,32
@@
static struct notifier_block panic_block = {
.notifier_call = softlock_panic,
};
.notifier_call = softlock_panic,
};
+/*
+ * Returns seconds, approximately. We don't need nanosecond
+ * resolution, and we don't need to waste time with a big divide when
+ * 2^30ns == 1.074s.
+ */
+static unsigned long get_timestamp(void)
+{
+ return sched_clock() >> 30; /* 2^30 ~= 10^9 */
+}
+
void touch_softlockup_watchdog(void)
{
void touch_softlockup_watchdog(void)
{
- __raw_get_cpu_var(touch_timestamp) =
jiffies
;
+ __raw_get_cpu_var(touch_timestamp) =
get_timestamp()
;
}
EXPORT_SYMBOL(touch_softlockup_watchdog);
}
EXPORT_SYMBOL(touch_softlockup_watchdog);
+void touch_all_softlockup_watchdogs(void)
+{
+ int cpu;
+
+ /* Cause each CPU to re-update its timestamp rather than complain */
+ for_each_online_cpu(cpu)
+ per_cpu(touch_timestamp, cpu) = 0;
+}
+EXPORT_SYMBOL(touch_all_softlockup_watchdogs);
+
/*
* This callback runs from the timer interrupt, and checks
* whether the watchdog thread has hung or not:
/*
* This callback runs from the timer interrupt, and checks
* whether the watchdog thread has hung or not:
@@
-48,9
+69,18
@@
void softlockup_tick(void)
{
int this_cpu = smp_processor_id();
unsigned long touch_timestamp = per_cpu(touch_timestamp, this_cpu);
{
int this_cpu = smp_processor_id();
unsigned long touch_timestamp = per_cpu(touch_timestamp, this_cpu);
+ unsigned long print_timestamp;
+ unsigned long now;
+
+ if (touch_timestamp == 0) {
+ touch_softlockup_watchdog();
+ return;
+ }
+
+ print_timestamp = per_cpu(print_timestamp, this_cpu);
- /*
prevent double reports:
*/
- if (p
er_cpu(print_timestamp, this_cpu) == touch_timestamp
||
+ /*
report at most once a second
*/
+ if (p
rint_timestamp < (touch_timestamp + 1)
||
did_panic ||
!per_cpu(watchdog_task, this_cpu))
return;
did_panic ||
!per_cpu(watchdog_task, this_cpu))
return;
@@
-61,12
+91,14
@@
void softlockup_tick(void)
return;
}
return;
}
+ now = get_timestamp();
+
/* Wake up the high-prio watchdog task every second: */
/* Wake up the high-prio watchdog task every second: */
- if (
time_after(jiffies, touch_timestamp + HZ
))
+ if (
now > (touch_timestamp + 1
))
wake_up_process(per_cpu(watchdog_task, this_cpu));
/* Warn about unreasonable 10+ seconds delays: */
wake_up_process(per_cpu(watchdog_task, this_cpu));
/* Warn about unreasonable 10+ seconds delays: */
- if (
time_after(jiffies, touch_timestamp + 10*HZ
)) {
+ if (
now > (touch_timestamp + 10
)) {
per_cpu(print_timestamp, this_cpu) = touch_timestamp;
spin_lock(&print_lock);
per_cpu(print_timestamp, this_cpu) = touch_timestamp;
spin_lock(&print_lock);
@@
-82,10
+114,12
@@
void softlockup_tick(void)
*/
static int watchdog(void * __bind_cpu)
{
*/
static int watchdog(void * __bind_cpu)
{
- struct sched_param param = { .sched_priority =
99
};
+ struct sched_param param = { .sched_priority =
MAX_RT_PRIO-1
};
sched_setscheduler(current, SCHED_FIFO, ¶m);
sched_setscheduler(current, SCHED_FIFO, ¶m);
- current->flags |= PF_NOFREEZE;
+
+ /* initialize timestamp */
+ touch_softlockup_watchdog();
/*
* Run briefly once per second to reset the softlockup timestamp.
/*
* Run briefly once per second to reset the softlockup timestamp.
@@
-112,27
+146,31
@@
cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
switch (action) {
case CPU_UP_PREPARE:
switch (action) {
case CPU_UP_PREPARE:
+ case CPU_UP_PREPARE_FROZEN:
BUG_ON(per_cpu(watchdog_task, hotcpu));
p = kthread_create(watchdog, hcpu, "watchdog/%d", hotcpu);
if (IS_ERR(p)) {
printk("watchdog for %i failed\n", hotcpu);
return NOTIFY_BAD;
}
BUG_ON(per_cpu(watchdog_task, hotcpu));
p = kthread_create(watchdog, hcpu, "watchdog/%d", hotcpu);
if (IS_ERR(p)) {
printk("watchdog for %i failed\n", hotcpu);
return NOTIFY_BAD;
}
- per_cpu(touch_timestamp, hotcpu) =
jiffies
;
+ per_cpu(touch_timestamp, hotcpu) =
0
;
per_cpu(watchdog_task, hotcpu) = p;
kthread_bind(p, hotcpu);
break;
case CPU_ONLINE:
per_cpu(watchdog_task, hotcpu) = p;
kthread_bind(p, hotcpu);
break;
case CPU_ONLINE:
+ case CPU_ONLINE_FROZEN:
wake_up_process(per_cpu(watchdog_task, hotcpu));
break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_UP_CANCELED:
wake_up_process(per_cpu(watchdog_task, hotcpu));
break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_UP_CANCELED:
+ case CPU_UP_CANCELED_FROZEN:
if (!per_cpu(watchdog_task, hotcpu))
break;
/* Unbind so it can run. Fall thru. */
kthread_bind(per_cpu(watchdog_task, hotcpu),
any_online_cpu(cpu_online_map));
case CPU_DEAD:
if (!per_cpu(watchdog_task, hotcpu))
break;
/* Unbind so it can run. Fall thru. */
kthread_bind(per_cpu(watchdog_task, hotcpu),
any_online_cpu(cpu_online_map));
case CPU_DEAD:
+ case CPU_DEAD_FROZEN:
p = per_cpu(watchdog_task, hotcpu);
per_cpu(watchdog_task, hotcpu) = NULL;
kthread_stop(p);
p = per_cpu(watchdog_task, hotcpu);
per_cpu(watchdog_task, hotcpu) = NULL;
kthread_stop(p);