Skip to content

Commit 04c9167

Browse files
jsgfLinus Torvalds
authored andcommitted
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>
1 parent 966812d commit 04c9167

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎include/linux/sched.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ extern void scheduler_tick(void);
226226
extern void softlockup_tick(void);
227227
extern void spawn_softlockup_task(void);
228228
extern void touch_softlockup_watchdog(void);
229+
extern void touch_all_softlockup_watchdogs(void);
229230
#else
230231
static inline void softlockup_tick(void)
231232
{
@@ -236,6 +237,9 @@ static inline void spawn_softlockup_task(void)
236237
static inline void touch_softlockup_watchdog(void)
237238
{
238239
}
240+
static inline void touch_all_softlockup_watchdogs(void)
241+
{
242+
}
239243
#endif
240244

241245

‎kernel/sched.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4750,6 +4750,8 @@ void show_state_filter(unsigned long state_filter)
47504750
show_task(p);
47514751
} while_each_thread(g, p);
47524752

4753+
touch_all_softlockup_watchdogs();
4754+
47534755
read_unlock(&tasklist_lock);
47544756
/*
47554757
* Only show locks if all tasks are dumped:

‎kernel/softlockup.c‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ void touch_softlockup_watchdog(void)
5050
}
5151
EXPORT_SYMBOL(touch_softlockup_watchdog);
5252

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+
5363
/*
5464
* This callback runs from the timer interrupt, and checks
5565
* whether the watchdog thread has hung or not:
@@ -61,9 +71,10 @@ void softlockup_tick(void)
6171
unsigned long print_timestamp;
6272
unsigned long now;
6373

64-
/* watchdog task hasn't updated timestamp yet */
65-
if (touch_timestamp == 0)
74+
if (touch_timestamp == 0) {
75+
touch_softlockup_watchdog();
6676
return;
77+
}
6778

6879
print_timestamp = per_cpu(print_timestamp, this_cpu);
6980

0 commit comments

Comments
 (0)