Explorar o código

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>
Jeremy Fitzhardinge %!s(int64=18) %!d(string=hai) anos
pai
achega
04c9167f91
Modificáronse 3 ficheiros con 19 adicións e 2 borrados
  1. 4 0
      include/linux/sched.h
  2. 2 0
      kernel/sched.c
  3. 13 2
      kernel/softlockup.c

+ 4 - 0
include/linux/sched.h

@@ -226,6 +226,7 @@ extern void scheduler_tick(void);
 extern void softlockup_tick(void);
 extern void softlockup_tick(void);
 extern void spawn_softlockup_task(void);
 extern void spawn_softlockup_task(void);
 extern void touch_softlockup_watchdog(void);
 extern void touch_softlockup_watchdog(void);
+extern void touch_all_softlockup_watchdogs(void);
 #else
 #else
 static inline void softlockup_tick(void)
 static inline void softlockup_tick(void)
 {
 {
@@ -236,6 +237,9 @@ static inline void spawn_softlockup_task(void)
 static inline void touch_softlockup_watchdog(void)
 static inline void touch_softlockup_watchdog(void)
 {
 {
 }
 }
+static inline void touch_all_softlockup_watchdogs(void)
+{
+}
 #endif
 #endif
 
 
 
 

+ 2 - 0
kernel/sched.c

@@ -4750,6 +4750,8 @@ void show_state_filter(unsigned long state_filter)
 			show_task(p);
 			show_task(p);
 	} while_each_thread(g, p);
 	} while_each_thread(g, p);
 
 
+	touch_all_softlockup_watchdogs();
+
 	read_unlock(&tasklist_lock);
 	read_unlock(&tasklist_lock);
 	/*
 	/*
 	 * Only show locks if all tasks are dumped:
 	 * Only show locks if all tasks are dumped:

+ 13 - 2
kernel/softlockup.c

@@ -50,6 +50,16 @@ void touch_softlockup_watchdog(void)
 }
 }
 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
  * This callback runs from the timer interrupt, and checks
  * whether the watchdog thread has hung or not:
  * whether the watchdog thread has hung or not:
@@ -61,9 +71,10 @@ void softlockup_tick(void)
 	unsigned long print_timestamp;
 	unsigned long print_timestamp;
 	unsigned long now;
 	unsigned long now;
 
 
-	/* watchdog task hasn't updated timestamp yet */
-	if (touch_timestamp == 0)
+	if (touch_timestamp == 0) {
+		touch_softlockup_watchdog();
 		return;
 		return;
+	}
 
 
 	print_timestamp = per_cpu(print_timestamp, this_cpu);
 	print_timestamp = per_cpu(print_timestamp, this_cpu);