Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

add touch_all_softlockup_watchdogs()

Add touch_all_softlockup_watchdogs() to allow the softlockup watchdog
timers on all cpus to be updated. This is used to prevent sysrq-t from
generating a spurious watchdog message when generating lots of output.

Softlockup watchdogs use sched_clock() as its timebase, which is inherently
per-cpu (at least, when it is measuring unstolen time). Because of this,
it isn't possible for one CPU to directly update the other CPU's timers,
but it is possible to tell the other CPUs to do update themselves
appropriately.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Acked-by: Chris Lalancette <clalance@redhat.com>
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Rick Lindsley <ricklind@us.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jeremy Fitzhardinge and committed by
Linus Torvalds
04c9167f 966812dc

+19 -2
+4
include/linux/sched.h
··· 226 226 extern void softlockup_tick(void); 227 227 extern void spawn_softlockup_task(void); 228 228 extern void touch_softlockup_watchdog(void); 229 + extern void touch_all_softlockup_watchdogs(void); 229 230 #else 230 231 static inline void softlockup_tick(void) 231 232 { ··· 235 234 { 236 235 } 237 236 static inline void touch_softlockup_watchdog(void) 237 + { 238 + } 239 + static inline void touch_all_softlockup_watchdogs(void) 238 240 { 239 241 } 240 242 #endif
+2
kernel/sched.c
··· 4750 4750 show_task(p); 4751 4751 } while_each_thread(g, p); 4752 4752 4753 + touch_all_softlockup_watchdogs(); 4754 + 4753 4755 read_unlock(&tasklist_lock); 4754 4756 /* 4755 4757 * Only show locks if all tasks are dumped:
+13 -2
kernel/softlockup.c
··· 50 50 } 51 51 EXPORT_SYMBOL(touch_softlockup_watchdog); 52 52 53 + void touch_all_softlockup_watchdogs(void) 54 + { 55 + int cpu; 56 + 57 + /* Cause each CPU to re-update its timestamp rather than complain */ 58 + for_each_online_cpu(cpu) 59 + per_cpu(touch_timestamp, cpu) = 0; 60 + } 61 + EXPORT_SYMBOL(touch_all_softlockup_watchdogs); 62 + 53 63 /* 54 64 * This callback runs from the timer interrupt, and checks 55 65 * whether the watchdog thread has hung or not: ··· 71 61 unsigned long print_timestamp; 72 62 unsigned long now; 73 63 74 - /* watchdog task hasn't updated timestamp yet */ 75 - if (touch_timestamp == 0) 64 + if (touch_timestamp == 0) { 65 + touch_softlockup_watchdog(); 76 66 return; 67 + } 77 68 78 69 print_timestamp = per_cpu(print_timestamp, this_cpu); 79 70