diff options
-rw-r--r-- | include/linux/sched.h | 4 | ||||
-rw-r--r-- | kernel/kgdb.c | 6 | ||||
-rw-r--r-- | kernel/softlockup.c | 15 |
3 files changed, 22 insertions, 3 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 6f7bba93929b..89232151a9d0 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -310,6 +310,7 @@ extern void sched_show_task(struct task_struct *p); | |||
310 | #ifdef CONFIG_DETECT_SOFTLOCKUP | 310 | #ifdef CONFIG_DETECT_SOFTLOCKUP |
311 | extern void softlockup_tick(void); | 311 | extern void softlockup_tick(void); |
312 | extern void touch_softlockup_watchdog(void); | 312 | extern void touch_softlockup_watchdog(void); |
313 | extern void touch_softlockup_watchdog_sync(void); | ||
313 | extern void touch_all_softlockup_watchdogs(void); | 314 | extern void touch_all_softlockup_watchdogs(void); |
314 | extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, | 315 | extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, |
315 | void __user *buffer, | 316 | void __user *buffer, |
@@ -323,6 +324,9 @@ static inline void softlockup_tick(void) | |||
323 | static inline void touch_softlockup_watchdog(void) | 324 | static inline void touch_softlockup_watchdog(void) |
324 | { | 325 | { |
325 | } | 326 | } |
327 | static inline void touch_softlockup_watchdog_sync(void) | ||
328 | { | ||
329 | } | ||
326 | static inline void touch_all_softlockup_watchdogs(void) | 330 | static inline void touch_all_softlockup_watchdogs(void) |
327 | { | 331 | { |
328 | } | 332 | } |
diff --git a/kernel/kgdb.c b/kernel/kgdb.c index 2eb517e23514..87f2cc557553 100644 --- a/kernel/kgdb.c +++ b/kernel/kgdb.c | |||
@@ -596,7 +596,7 @@ static void kgdb_wait(struct pt_regs *regs) | |||
596 | 596 | ||
597 | /* Signal the primary CPU that we are done: */ | 597 | /* Signal the primary CPU that we are done: */ |
598 | atomic_set(&cpu_in_kgdb[cpu], 0); | 598 | atomic_set(&cpu_in_kgdb[cpu], 0); |
599 | touch_softlockup_watchdog(); | 599 | touch_softlockup_watchdog_sync(); |
600 | clocksource_touch_watchdog(); | 600 | clocksource_touch_watchdog(); |
601 | local_irq_restore(flags); | 601 | local_irq_restore(flags); |
602 | } | 602 | } |
@@ -1450,7 +1450,7 @@ acquirelock: | |||
1450 | (kgdb_info[cpu].task && | 1450 | (kgdb_info[cpu].task && |
1451 | kgdb_info[cpu].task->pid != kgdb_sstep_pid) && --sstep_tries) { | 1451 | kgdb_info[cpu].task->pid != kgdb_sstep_pid) && --sstep_tries) { |
1452 | atomic_set(&kgdb_active, -1); | 1452 | atomic_set(&kgdb_active, -1); |
1453 | touch_softlockup_watchdog(); | 1453 | touch_softlockup_watchdog_sync(); |
1454 | clocksource_touch_watchdog(); | 1454 | clocksource_touch_watchdog(); |
1455 | local_irq_restore(flags); | 1455 | local_irq_restore(flags); |
1456 | 1456 | ||
@@ -1550,7 +1550,7 @@ kgdb_restore: | |||
1550 | } | 1550 | } |
1551 | /* Free kgdb_active */ | 1551 | /* Free kgdb_active */ |
1552 | atomic_set(&kgdb_active, -1); | 1552 | atomic_set(&kgdb_active, -1); |
1553 | touch_softlockup_watchdog(); | 1553 | touch_softlockup_watchdog_sync(); |
1554 | clocksource_touch_watchdog(); | 1554 | clocksource_touch_watchdog(); |
1555 | local_irq_restore(flags); | 1555 | local_irq_restore(flags); |
1556 | 1556 | ||
diff --git a/kernel/softlockup.c b/kernel/softlockup.c index d22579087e27..0d4c7898ab80 100644 --- a/kernel/softlockup.c +++ b/kernel/softlockup.c | |||
@@ -25,6 +25,7 @@ static DEFINE_SPINLOCK(print_lock); | |||
25 | static DEFINE_PER_CPU(unsigned long, softlockup_touch_ts); /* touch timestamp */ | 25 | static DEFINE_PER_CPU(unsigned long, softlockup_touch_ts); /* touch timestamp */ |
26 | static DEFINE_PER_CPU(unsigned long, softlockup_print_ts); /* print timestamp */ | 26 | static DEFINE_PER_CPU(unsigned long, softlockup_print_ts); /* print timestamp */ |
27 | static DEFINE_PER_CPU(struct task_struct *, softlockup_watchdog); | 27 | static DEFINE_PER_CPU(struct task_struct *, softlockup_watchdog); |
28 | static DEFINE_PER_CPU(bool, softlock_touch_sync); | ||
28 | 29 | ||
29 | static int __read_mostly did_panic; | 30 | static int __read_mostly did_panic; |
30 | int __read_mostly softlockup_thresh = 60; | 31 | int __read_mostly softlockup_thresh = 60; |
@@ -79,6 +80,12 @@ void touch_softlockup_watchdog(void) | |||
79 | } | 80 | } |
80 | EXPORT_SYMBOL(touch_softlockup_watchdog); | 81 | EXPORT_SYMBOL(touch_softlockup_watchdog); |
81 | 82 | ||
83 | void touch_softlockup_watchdog_sync(void) | ||
84 | { | ||
85 | __raw_get_cpu_var(softlock_touch_sync) = true; | ||
86 | __raw_get_cpu_var(softlockup_touch_ts) = 0; | ||
87 | } | ||
88 | |||
82 | void touch_all_softlockup_watchdogs(void) | 89 | void touch_all_softlockup_watchdogs(void) |
83 | { | 90 | { |
84 | int cpu; | 91 | int cpu; |
@@ -118,6 +125,14 @@ void softlockup_tick(void) | |||
118 | } | 125 | } |
119 | 126 | ||
120 | if (touch_ts == 0) { | 127 | if (touch_ts == 0) { |
128 | if (unlikely(per_cpu(softlock_touch_sync, this_cpu))) { | ||
129 | /* | ||
130 | * If the time stamp was touched atomically | ||
131 | * make sure the scheduler tick is up to date. | ||
132 | */ | ||
133 | per_cpu(softlock_touch_sync, this_cpu) = false; | ||
134 | sched_clock_tick(); | ||
135 | } | ||
121 | __touch_softlockup_watchdog(); | 136 | __touch_softlockup_watchdog(); |
122 | return; | 137 | return; |
123 | } | 138 | } |