blob: 576d1804581150d1479730166910ff6fb0a89d2e [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Don Zickus58687ac2010-05-07 17:11:44 -04002/*
3 * Detect hard and soft lockups on a system
4 *
5 * started by Don Zickus, Copyright (C) 2010 Red Hat, Inc.
6 *
Fernando Luis Vázquez Cao86f5e6a2012-02-09 17:42:22 -05007 * Note: Most of this code is borrowed heavily from the original softlockup
8 * detector, so thanks to Ingo for the initial implementation.
9 * Some chunks also taken from the old x86-specific nmi watchdog code, thanks
Don Zickus58687ac2010-05-07 17:11:44 -040010 * to those contributors as well.
11 */
12
Kefeng Wang5f92a7b2017-07-14 14:49:46 -070013#define pr_fmt(fmt) "watchdog: " fmt
Andrew Morton45019802012-03-23 15:01:55 -070014
Don Zickus58687ac2010-05-07 17:11:44 -040015#include <linux/mm.h>
16#include <linux/cpu.h>
17#include <linux/nmi.h>
18#include <linux/init.h>
Don Zickus58687ac2010-05-07 17:11:44 -040019#include <linux/module.h>
20#include <linux/sysctl.h>
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +000021#include <linux/smpboot.h>
Clark Williams8bd75c72013-02-07 09:47:07 -060022#include <linux/sched/rt.h>
Ingo Molnarae7e81c2017-02-01 18:07:51 +010023#include <uapi/linux/sched/types.h>
Chris Metcalffe4ba3c2015-06-24 16:55:45 -070024#include <linux/tick.h>
Tejun Heo82607adc2015-12-08 11:28:04 -050025#include <linux/workqueue.h>
Ingo Molnare6017572017-02-01 16:36:40 +010026#include <linux/sched/clock.h>
Ingo Molnarb17b0152017-02-08 18:51:35 +010027#include <linux/sched/debug.h>
Frederic Weisbecker78634062017-10-27 04:42:28 +020028#include <linux/sched/isolation.h>
Don Zickus58687ac2010-05-07 17:11:44 -040029
30#include <asm/irq_regs.h>
Eric B Munson5d1c0f42012-03-10 14:37:28 -050031#include <linux/kvm_para.h>
Ulrich Obergfell81a4bee2015-09-04 15:45:15 -070032#include <linux/kthread.h>
Don Zickus58687ac2010-05-07 17:11:44 -040033
Thomas Gleixner946d1972017-09-12 21:37:01 +020034static DEFINE_MUTEX(watchdog_mutex);
Peter Zijlstraab992dc2015-05-18 11:31:50 +020035
Nicholas Piggin05a4a952017-07-12 14:35:46 -070036#if defined(CONFIG_HARDLOCKUP_DETECTOR) || defined(CONFIG_HAVE_NMI_WATCHDOG)
Thomas Gleixner09154982017-09-12 21:37:17 +020037# define WATCHDOG_DEFAULT (SOFT_WATCHDOG_ENABLED | NMI_WATCHDOG_ENABLED)
38# define NMI_WATCHDOG_DEFAULT 1
Ulrich Obergfell84d56e62015-04-14 15:43:55 -070039#else
Thomas Gleixner09154982017-09-12 21:37:17 +020040# define WATCHDOG_DEFAULT (SOFT_WATCHDOG_ENABLED)
41# define NMI_WATCHDOG_DEFAULT 0
Ulrich Obergfell84d56e62015-04-14 15:43:55 -070042#endif
Nicholas Piggin05a4a952017-07-12 14:35:46 -070043
Thomas Gleixner09154982017-09-12 21:37:17 +020044unsigned long __read_mostly watchdog_enabled;
45int __read_mostly watchdog_user_enabled = 1;
46int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT;
47int __read_mostly soft_watchdog_user_enabled = 1;
Thomas Gleixner7feeb9c2017-09-12 21:37:15 +020048int __read_mostly watchdog_thresh = 10;
Thomas Gleixnera994a312017-09-12 21:37:19 +020049int __read_mostly nmi_watchdog_available;
Thomas Gleixner7feeb9c2017-09-12 21:37:15 +020050
51struct cpumask watchdog_allowed_mask __read_mostly;
Thomas Gleixner7feeb9c2017-09-12 21:37:15 +020052
53struct cpumask watchdog_cpumask __read_mostly;
54unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask);
55
Nicholas Piggin05a4a952017-07-12 14:35:46 -070056#ifdef CONFIG_HARDLOCKUP_DETECTOR
Nicholas Piggin05a4a952017-07-12 14:35:46 -070057/*
58 * Should we panic when a soft-lockup or hard-lockup occurs:
59 */
60unsigned int __read_mostly hardlockup_panic =
61 CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE;
62/*
63 * We may not want to enable hard lockup detection by default in all cases,
64 * for example when running the kernel as a guest on a hypervisor. In these
65 * cases this function can be called to disable hard lockup detection. This
66 * function should only be executed once by the boot processor before the
67 * kernel command line parameters are parsed, because otherwise it is not
68 * possible to override this in hardlockup_panic_setup().
69 */
Thomas Gleixner7a355822017-09-12 21:37:02 +020070void __init hardlockup_detector_disable(void)
Nicholas Piggin05a4a952017-07-12 14:35:46 -070071{
Thomas Gleixner09154982017-09-12 21:37:17 +020072 nmi_watchdog_user_enabled = 0;
Nicholas Piggin05a4a952017-07-12 14:35:46 -070073}
74
75static int __init hardlockup_panic_setup(char *str)
76{
77 if (!strncmp(str, "panic", 5))
78 hardlockup_panic = 1;
79 else if (!strncmp(str, "nopanic", 7))
80 hardlockup_panic = 0;
81 else if (!strncmp(str, "0", 1))
Thomas Gleixner09154982017-09-12 21:37:17 +020082 nmi_watchdog_user_enabled = 0;
Nicholas Piggin05a4a952017-07-12 14:35:46 -070083 else if (!strncmp(str, "1", 1))
Thomas Gleixner09154982017-09-12 21:37:17 +020084 nmi_watchdog_user_enabled = 1;
Nicholas Piggin05a4a952017-07-12 14:35:46 -070085 return 1;
86}
87__setup("nmi_watchdog=", hardlockup_panic_setup);
88
Thomas Gleixner368a7e22017-09-12 21:37:07 +020089# ifdef CONFIG_SMP
90int __read_mostly sysctl_hardlockup_all_cpu_backtrace;
Nicholas Piggin05a4a952017-07-12 14:35:46 -070091
Thomas Gleixner368a7e22017-09-12 21:37:07 +020092static int __init hardlockup_all_cpu_backtrace_setup(char *str)
93{
94 sysctl_hardlockup_all_cpu_backtrace = !!simple_strtol(str, NULL, 0);
95 return 1;
96}
97__setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup);
98# endif /* CONFIG_SMP */
99#endif /* CONFIG_HARDLOCKUP_DETECTOR */
Nicholas Piggin05a4a952017-07-12 14:35:46 -0700100
Ulrich Obergfellec6a9062015-09-04 15:45:28 -0700101/*
Nicholas Piggin05a4a952017-07-12 14:35:46 -0700102 * These functions can be overridden if an architecture implements its
103 * own hardlockup detector.
Nicholas Piggina10a8422017-07-12 14:35:49 -0700104 *
105 * watchdog_nmi_enable/disable can be implemented to start and stop when
106 * softlockup watchdog threads start and stop. The arch must select the
107 * SOFTLOCKUP_DETECTOR Kconfig.
Nicholas Piggin05a4a952017-07-12 14:35:46 -0700108 */
109int __weak watchdog_nmi_enable(unsigned int cpu)
110{
Thomas Gleixner146c9d02017-09-12 21:37:21 +0200111 hardlockup_detector_perf_enable();
Nicholas Piggin05a4a952017-07-12 14:35:46 -0700112 return 0;
113}
Thomas Gleixner941154b2017-09-12 21:37:04 +0200114
Nicholas Piggin05a4a952017-07-12 14:35:46 -0700115void __weak watchdog_nmi_disable(unsigned int cpu)
116{
Thomas Gleixner941154b2017-09-12 21:37:04 +0200117 hardlockup_detector_perf_disable();
Nicholas Piggin05a4a952017-07-12 14:35:46 -0700118}
119
Thomas Gleixnera994a312017-09-12 21:37:19 +0200120/* Return 0, if a NMI watchdog is available. Error code otherwise */
121int __weak __init watchdog_nmi_probe(void)
122{
123 return hardlockup_detector_perf_init();
124}
125
Thomas Gleixner6592ad22017-09-12 21:37:16 +0200126/**
Thomas Gleixner6b9dc482017-10-02 12:34:50 +0200127 * watchdog_nmi_stop - Stop the watchdog for reconfiguration
Thomas Gleixner6592ad22017-09-12 21:37:16 +0200128 *
Thomas Gleixner6b9dc482017-10-02 12:34:50 +0200129 * The reconfiguration steps are:
130 * watchdog_nmi_stop();
Thomas Gleixner6592ad22017-09-12 21:37:16 +0200131 * update_variables();
Thomas Gleixner6b9dc482017-10-02 12:34:50 +0200132 * watchdog_nmi_start();
133 */
134void __weak watchdog_nmi_stop(void) { }
135
136/**
137 * watchdog_nmi_start - Start the watchdog after reconfiguration
Thomas Gleixner6592ad22017-09-12 21:37:16 +0200138 *
Thomas Gleixner6b9dc482017-10-02 12:34:50 +0200139 * Counterpart to watchdog_nmi_stop().
140 *
141 * The following variables have been updated in update_variables() and
142 * contain the currently valid configuration:
Thomas Gleixner7feeb9c2017-09-12 21:37:15 +0200143 * - watchdog_enabled
Nicholas Piggina10a8422017-07-12 14:35:49 -0700144 * - watchdog_thresh
145 * - watchdog_cpumask
Nicholas Piggina10a8422017-07-12 14:35:49 -0700146 */
Thomas Gleixner6b9dc482017-10-02 12:34:50 +0200147void __weak watchdog_nmi_start(void) { }
Nicholas Piggina10a8422017-07-12 14:35:49 -0700148
Thomas Gleixner09154982017-09-12 21:37:17 +0200149/**
150 * lockup_detector_update_enable - Update the sysctl enable bit
151 *
152 * Caller needs to make sure that the NMI/perf watchdogs are off, so this
153 * can't race with watchdog_nmi_disable().
154 */
155static void lockup_detector_update_enable(void)
156{
157 watchdog_enabled = 0;
158 if (!watchdog_user_enabled)
159 return;
Thomas Gleixnera994a312017-09-12 21:37:19 +0200160 if (nmi_watchdog_available && nmi_watchdog_user_enabled)
Thomas Gleixner09154982017-09-12 21:37:17 +0200161 watchdog_enabled |= NMI_WATCHDOG_ENABLED;
162 if (soft_watchdog_user_enabled)
163 watchdog_enabled |= SOFT_WATCHDOG_ENABLED;
164}
165
Nicholas Piggin05a4a952017-07-12 14:35:46 -0700166#ifdef CONFIG_SOFTLOCKUP_DETECTOR
167
Thomas Gleixner2b9d7f22017-09-12 21:37:06 +0200168/* Global variables, exported for sysctl */
169unsigned int __read_mostly softlockup_panic =
170 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200171
Thomas Gleixner0b62bf82017-10-02 20:59:09 +0200172static bool softlockup_threads_initialized __read_mostly;
Chuansheng Liu0f34c402012-12-17 15:59:50 -0800173static u64 __read_mostly sample_period;
Don Zickus58687ac2010-05-07 17:11:44 -0400174
175static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts);
176static DEFINE_PER_CPU(struct task_struct *, softlockup_watchdog);
177static DEFINE_PER_CPU(struct hrtimer, watchdog_hrtimer);
178static DEFINE_PER_CPU(bool, softlockup_touch_sync);
Don Zickus58687ac2010-05-07 17:11:44 -0400179static DEFINE_PER_CPU(bool, soft_watchdog_warn);
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000180static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts);
181static DEFINE_PER_CPU(unsigned long, soft_lockup_hrtimer_cnt);
chai wenb1a8de12014-10-09 15:25:17 -0700182static DEFINE_PER_CPU(struct task_struct *, softlockup_task_ptr_saved);
Don Zickus58687ac2010-05-07 17:11:44 -0400183static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved);
Aaron Tomlined235872014-06-23 13:22:05 -0700184static unsigned long soft_lockup_nmi_warn;
Don Zickus58687ac2010-05-07 17:11:44 -0400185
Don Zickus58687ac2010-05-07 17:11:44 -0400186static int __init softlockup_panic_setup(char *str)
187{
188 softlockup_panic = simple_strtoul(str, NULL, 0);
Don Zickus58687ac2010-05-07 17:11:44 -0400189 return 1;
190}
191__setup("softlockup_panic=", softlockup_panic_setup);
192
193static int __init nowatchdog_setup(char *str)
194{
Thomas Gleixner09154982017-09-12 21:37:17 +0200195 watchdog_user_enabled = 0;
Don Zickus58687ac2010-05-07 17:11:44 -0400196 return 1;
197}
198__setup("nowatchdog", nowatchdog_setup);
199
Don Zickus58687ac2010-05-07 17:11:44 -0400200static int __init nosoftlockup_setup(char *str)
201{
Thomas Gleixner09154982017-09-12 21:37:17 +0200202 soft_watchdog_user_enabled = 0;
Don Zickus58687ac2010-05-07 17:11:44 -0400203 return 1;
204}
205__setup("nosoftlockup", nosoftlockup_setup);
Ulrich Obergfell195daf62015-04-14 15:44:13 -0700206
Aaron Tomlined235872014-06-23 13:22:05 -0700207#ifdef CONFIG_SMP
Thomas Gleixner368a7e22017-09-12 21:37:07 +0200208int __read_mostly sysctl_softlockup_all_cpu_backtrace;
209
Aaron Tomlined235872014-06-23 13:22:05 -0700210static int __init softlockup_all_cpu_backtrace_setup(char *str)
211{
Thomas Gleixner368a7e22017-09-12 21:37:07 +0200212 sysctl_softlockup_all_cpu_backtrace = !!simple_strtol(str, NULL, 0);
Aaron Tomlined235872014-06-23 13:22:05 -0700213 return 1;
214}
215__setup("softlockup_all_cpu_backtrace=", softlockup_all_cpu_backtrace_setup);
Nicholas Piggin05a4a952017-07-12 14:35:46 -0700216#endif
Don Zickus58687ac2010-05-07 17:11:44 -0400217
Thomas Gleixner941154b2017-09-12 21:37:04 +0200218static void __lockup_detector_cleanup(void);
219
Mandeep Singh Baines4eec42f2011-05-22 22:10:23 -0700220/*
221 * Hard-lockup warnings should be triggered after just a few seconds. Soft-
222 * lockups can have false positives under extreme conditions. So we generally
223 * want a higher threshold for soft lockups than for hard lockups. So we couple
224 * the thresholds with a factor: we make the soft threshold twice the amount of
225 * time the hard threshold is.
226 */
Ingo Molnar6e9101a2011-05-24 05:43:18 +0200227static int get_softlockup_thresh(void)
Mandeep Singh Baines4eec42f2011-05-22 22:10:23 -0700228{
229 return watchdog_thresh * 2;
230}
Don Zickus58687ac2010-05-07 17:11:44 -0400231
232/*
233 * Returns seconds, approximately. We don't need nanosecond
234 * resolution, and we don't need to waste time with a big divide when
235 * 2^30ns == 1.074s.
236 */
Namhyung Kimc06b4f12012-12-27 11:49:44 +0900237static unsigned long get_timestamp(void)
Don Zickus58687ac2010-05-07 17:11:44 -0400238{
Cyril Bur545a2bf2015-02-12 15:01:24 -0800239 return running_clock() >> 30LL; /* 2^30 ~= 10^9 */
Don Zickus58687ac2010-05-07 17:11:44 -0400240}
241
Chuansheng Liu0f34c402012-12-17 15:59:50 -0800242static void set_sample_period(void)
Don Zickus58687ac2010-05-07 17:11:44 -0400243{
244 /*
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700245 * convert watchdog_thresh from seconds to ns
Fernando Luis Vázquez Cao86f5e6a2012-02-09 17:42:22 -0500246 * the divide by 5 is to give hrtimer several chances (two
247 * or three with the current relation between the soft
248 * and hard thresholds) to increment before the
249 * hardlockup detector generates a warning
Don Zickus58687ac2010-05-07 17:11:44 -0400250 */
Chuansheng Liu0f34c402012-12-17 15:59:50 -0800251 sample_period = get_softlockup_thresh() * ((u64)NSEC_PER_SEC / 5);
Thomas Gleixner7edaeb62017-08-15 09:50:13 +0200252 watchdog_update_hrtimer_threshold(sample_period);
Don Zickus58687ac2010-05-07 17:11:44 -0400253}
254
255/* Commands for resetting the watchdog */
256static void __touch_watchdog(void)
257{
Namhyung Kimc06b4f12012-12-27 11:49:44 +0900258 __this_cpu_write(watchdog_touch_ts, get_timestamp());
Don Zickus58687ac2010-05-07 17:11:44 -0400259}
260
Tejun Heo03e0d462015-12-08 11:28:04 -0500261/**
262 * touch_softlockup_watchdog_sched - touch watchdog on scheduler stalls
263 *
264 * Call when the scheduler may have stalled for legitimate reasons
265 * preventing the watchdog task from executing - e.g. the scheduler
266 * entering idle state. This should only be used for scheduler events.
267 * Use touch_softlockup_watchdog() for everything else.
268 */
269void touch_softlockup_watchdog_sched(void)
Don Zickus58687ac2010-05-07 17:11:44 -0400270{
Andrew Morton78611442014-04-18 15:07:12 -0700271 /*
272 * Preemption can be enabled. It doesn't matter which CPU's timestamp
273 * gets zeroed here, so use the raw_ operation.
274 */
275 raw_cpu_write(watchdog_touch_ts, 0);
Don Zickus58687ac2010-05-07 17:11:44 -0400276}
Tejun Heo03e0d462015-12-08 11:28:04 -0500277
278void touch_softlockup_watchdog(void)
279{
280 touch_softlockup_watchdog_sched();
Tejun Heo82607adc2015-12-08 11:28:04 -0500281 wq_watchdog_touch(raw_smp_processor_id());
Tejun Heo03e0d462015-12-08 11:28:04 -0500282}
Ingo Molnar0167c782010-05-13 08:53:33 +0200283EXPORT_SYMBOL(touch_softlockup_watchdog);
Don Zickus58687ac2010-05-07 17:11:44 -0400284
Don Zickus332fbdb2010-05-07 17:11:45 -0400285void touch_all_softlockup_watchdogs(void)
Don Zickus58687ac2010-05-07 17:11:44 -0400286{
287 int cpu;
288
289 /*
Thomas Gleixnerd57108d2017-09-12 21:37:11 +0200290 * watchdog_mutex cannpt be taken here, as this might be called
291 * from (soft)interrupt context, so the access to
292 * watchdog_allowed_cpumask might race with a concurrent update.
293 *
294 * The watchdog time stamp can race against a concurrent real
295 * update as well, the only side effect might be a cycle delay for
296 * the softlockup check.
Don Zickus58687ac2010-05-07 17:11:44 -0400297 */
Thomas Gleixnerd57108d2017-09-12 21:37:11 +0200298 for_each_cpu(cpu, &watchdog_allowed_mask)
Don Zickus58687ac2010-05-07 17:11:44 -0400299 per_cpu(watchdog_touch_ts, cpu) = 0;
Tejun Heo82607adc2015-12-08 11:28:04 -0500300 wq_watchdog_touch(-1);
Don Zickus58687ac2010-05-07 17:11:44 -0400301}
302
Don Zickus58687ac2010-05-07 17:11:44 -0400303void touch_softlockup_watchdog_sync(void)
304{
Christoph Lameterf7f66b02014-08-17 12:30:34 -0500305 __this_cpu_write(softlockup_touch_sync, true);
306 __this_cpu_write(watchdog_touch_ts, 0);
Don Zickus58687ac2010-05-07 17:11:44 -0400307}
308
Don Zickus26e09c62010-05-17 18:06:04 -0400309static int is_softlockup(unsigned long touch_ts)
Don Zickus58687ac2010-05-07 17:11:44 -0400310{
Namhyung Kimc06b4f12012-12-27 11:49:44 +0900311 unsigned long now = get_timestamp();
Don Zickus58687ac2010-05-07 17:11:44 -0400312
Ulrich Obergfell39d2da22015-11-05 18:44:56 -0800313 if ((watchdog_enabled & SOFT_WATCHDOG_ENABLED) && watchdog_thresh){
Ulrich Obergfell195daf62015-04-14 15:44:13 -0700314 /* Warn about unreasonable delays. */
315 if (time_after(now, touch_ts + get_softlockup_thresh()))
316 return now - touch_ts;
317 }
Don Zickus58687ac2010-05-07 17:11:44 -0400318 return 0;
319}
320
Nicholas Piggin05a4a952017-07-12 14:35:46 -0700321/* watchdog detector functions */
322bool is_hardlockup(void)
323{
324 unsigned long hrint = __this_cpu_read(hrtimer_interrupts);
325
326 if (__this_cpu_read(hrtimer_interrupts_saved) == hrint)
327 return true;
328
329 __this_cpu_write(hrtimer_interrupts_saved, hrint);
330 return false;
331}
332
Don Zickus58687ac2010-05-07 17:11:44 -0400333static void watchdog_interrupt_count(void)
334{
Christoph Lameter909ea962010-12-08 16:22:55 +0100335 __this_cpu_inc(hrtimer_interrupts);
Don Zickus58687ac2010-05-07 17:11:44 -0400336}
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000337
Don Zickus58687ac2010-05-07 17:11:44 -0400338/* watchdog kicker functions */
339static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
340{
Christoph Lameter909ea962010-12-08 16:22:55 +0100341 unsigned long touch_ts = __this_cpu_read(watchdog_touch_ts);
Don Zickus58687ac2010-05-07 17:11:44 -0400342 struct pt_regs *regs = get_irq_regs();
343 int duration;
Aaron Tomlined235872014-06-23 13:22:05 -0700344 int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace;
Don Zickus58687ac2010-05-07 17:11:44 -0400345
Thomas Gleixner01f0a022017-09-12 21:37:05 +0200346 if (!watchdog_enabled)
Don Zickusb94f5112017-01-24 15:17:53 -0800347 return HRTIMER_NORESTART;
348
Don Zickus58687ac2010-05-07 17:11:44 -0400349 /* kick the hardlockup detector */
350 watchdog_interrupt_count();
351
352 /* kick the softlockup detector */
Christoph Lameter909ea962010-12-08 16:22:55 +0100353 wake_up_process(__this_cpu_read(softlockup_watchdog));
Don Zickus58687ac2010-05-07 17:11:44 -0400354
355 /* .. and repeat */
Chuansheng Liu0f34c402012-12-17 15:59:50 -0800356 hrtimer_forward_now(hrtimer, ns_to_ktime(sample_period));
Don Zickus58687ac2010-05-07 17:11:44 -0400357
358 if (touch_ts == 0) {
Christoph Lameter909ea962010-12-08 16:22:55 +0100359 if (unlikely(__this_cpu_read(softlockup_touch_sync))) {
Don Zickus58687ac2010-05-07 17:11:44 -0400360 /*
361 * If the time stamp was touched atomically
362 * make sure the scheduler tick is up to date.
363 */
Christoph Lameter909ea962010-12-08 16:22:55 +0100364 __this_cpu_write(softlockup_touch_sync, false);
Don Zickus58687ac2010-05-07 17:11:44 -0400365 sched_clock_tick();
366 }
Eric B Munson5d1c0f42012-03-10 14:37:28 -0500367
368 /* Clear the guest paused flag on watchdog reset */
369 kvm_check_and_clear_guest_paused();
Don Zickus58687ac2010-05-07 17:11:44 -0400370 __touch_watchdog();
371 return HRTIMER_RESTART;
372 }
373
374 /* check for a softlockup
375 * This is done by making sure a high priority task is
376 * being scheduled. The task touches the watchdog to
377 * indicate it is getting cpu time. If it hasn't then
378 * this is a good indication some task is hogging the cpu
379 */
Don Zickus26e09c62010-05-17 18:06:04 -0400380 duration = is_softlockup(touch_ts);
Don Zickus58687ac2010-05-07 17:11:44 -0400381 if (unlikely(duration)) {
Eric B Munson5d1c0f42012-03-10 14:37:28 -0500382 /*
383 * If a virtual machine is stopped by the host it can look to
384 * the watchdog like a soft lockup, check to see if the host
385 * stopped the vm before we issue the warning
386 */
387 if (kvm_check_and_clear_guest_paused())
388 return HRTIMER_RESTART;
389
Don Zickus58687ac2010-05-07 17:11:44 -0400390 /* only warn once */
chai wenb1a8de12014-10-09 15:25:17 -0700391 if (__this_cpu_read(soft_watchdog_warn) == true) {
392 /*
393 * When multiple processes are causing softlockups the
394 * softlockup detector only warns on the first one
395 * because the code relies on a full quiet cycle to
396 * re-arm. The second process prevents the quiet cycle
397 * and never gets reported. Use task pointers to detect
398 * this.
399 */
400 if (__this_cpu_read(softlockup_task_ptr_saved) !=
401 current) {
402 __this_cpu_write(soft_watchdog_warn, false);
403 __touch_watchdog();
404 }
Don Zickus58687ac2010-05-07 17:11:44 -0400405 return HRTIMER_RESTART;
chai wenb1a8de12014-10-09 15:25:17 -0700406 }
Don Zickus58687ac2010-05-07 17:11:44 -0400407
Aaron Tomlined235872014-06-23 13:22:05 -0700408 if (softlockup_all_cpu_backtrace) {
409 /* Prevent multiple soft-lockup reports if one cpu is already
410 * engaged in dumping cpu back traces
411 */
412 if (test_and_set_bit(0, &soft_lockup_nmi_warn)) {
413 /* Someone else will report us. Let's give up */
414 __this_cpu_write(soft_watchdog_warn, true);
415 return HRTIMER_RESTART;
416 }
417 }
418
Fabian Frederick656c3b72014-08-06 16:04:03 -0700419 pr_emerg("BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n",
Don Zickus26e09c62010-05-17 18:06:04 -0400420 smp_processor_id(), duration,
Don Zickus58687ac2010-05-07 17:11:44 -0400421 current->comm, task_pid_nr(current));
chai wenb1a8de12014-10-09 15:25:17 -0700422 __this_cpu_write(softlockup_task_ptr_saved, current);
Don Zickus58687ac2010-05-07 17:11:44 -0400423 print_modules();
424 print_irqtrace_events(current);
425 if (regs)
426 show_regs(regs);
427 else
428 dump_stack();
429
Aaron Tomlined235872014-06-23 13:22:05 -0700430 if (softlockup_all_cpu_backtrace) {
431 /* Avoid generating two back traces for current
432 * given that one is already made above
433 */
434 trigger_allbutself_cpu_backtrace();
435
436 clear_bit(0, &soft_lockup_nmi_warn);
437 /* Barrier to sync with other cpus */
438 smp_mb__after_atomic();
439 }
440
Josh Hunt69361ee2014-08-08 14:22:31 -0700441 add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK);
Don Zickus58687ac2010-05-07 17:11:44 -0400442 if (softlockup_panic)
443 panic("softlockup: hung tasks");
Christoph Lameter909ea962010-12-08 16:22:55 +0100444 __this_cpu_write(soft_watchdog_warn, true);
Don Zickus58687ac2010-05-07 17:11:44 -0400445 } else
Christoph Lameter909ea962010-12-08 16:22:55 +0100446 __this_cpu_write(soft_watchdog_warn, false);
Don Zickus58687ac2010-05-07 17:11:44 -0400447
448 return HRTIMER_RESTART;
449}
450
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000451static void watchdog_set_prio(unsigned int policy, unsigned int prio)
Don Zickus58687ac2010-05-07 17:11:44 -0400452{
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000453 struct sched_param param = { .sched_priority = prio };
454
455 sched_setscheduler(current, policy, &param);
456}
457
458static void watchdog_enable(unsigned int cpu)
459{
Thomas Gleixner01f0a022017-09-12 21:37:05 +0200460 struct hrtimer *hrtimer = this_cpu_ptr(&watchdog_hrtimer);
Don Zickus58687ac2010-05-07 17:11:44 -0400461
Thomas Gleixner01f0a022017-09-12 21:37:05 +0200462 /*
463 * Start the timer first to prevent the NMI watchdog triggering
464 * before the timer has a chance to fire.
465 */
Bjørn Mork3935e8952012-12-19 20:51:31 +0100466 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
467 hrtimer->function = watchdog_timer_fn;
Chuansheng Liu0f34c402012-12-17 15:59:50 -0800468 hrtimer_start(hrtimer, ns_to_ktime(sample_period),
Don Zickus58687ac2010-05-07 17:11:44 -0400469 HRTIMER_MODE_REL_PINNED);
470
Thomas Gleixner01f0a022017-09-12 21:37:05 +0200471 /* Initialize timestamp */
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000472 __touch_watchdog();
Thomas Gleixner01f0a022017-09-12 21:37:05 +0200473 /* Enable the perf event */
Thomas Gleixner146c9d02017-09-12 21:37:21 +0200474 if (watchdog_enabled & NMI_WATCHDOG_ENABLED)
475 watchdog_nmi_enable(cpu);
Thomas Gleixner01f0a022017-09-12 21:37:05 +0200476
477 watchdog_set_prio(SCHED_FIFO, MAX_RT_PRIO - 1);
Don Zickus58687ac2010-05-07 17:11:44 -0400478}
479
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000480static void watchdog_disable(unsigned int cpu)
481{
Thomas Gleixner01f0a022017-09-12 21:37:05 +0200482 struct hrtimer *hrtimer = this_cpu_ptr(&watchdog_hrtimer);
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000483
484 watchdog_set_prio(SCHED_NORMAL, 0);
Thomas Gleixner01f0a022017-09-12 21:37:05 +0200485 /*
486 * Disable the perf event first. That prevents that a large delay
487 * between disabling the timer and disabling the perf event causes
488 * the perf NMI to detect a false positive.
489 */
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000490 watchdog_nmi_disable(cpu);
Thomas Gleixner01f0a022017-09-12 21:37:05 +0200491 hrtimer_cancel(hrtimer);
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000492}
493
Frederic Weisbeckerb8900bc2013-06-06 15:42:53 +0200494static void watchdog_cleanup(unsigned int cpu, bool online)
495{
496 watchdog_disable(cpu);
497}
498
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000499static int watchdog_should_run(unsigned int cpu)
500{
501 return __this_cpu_read(hrtimer_interrupts) !=
502 __this_cpu_read(soft_lockup_hrtimer_cnt);
503}
504
505/*
506 * The watchdog thread function - touches the timestamp.
507 *
Chuansheng Liu0f34c402012-12-17 15:59:50 -0800508 * It only runs once every sample_period seconds (4 seconds by
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000509 * default) to reset the softlockup timestamp. If this gets delayed
510 * for more than 2*watchdog_thresh seconds then the debug-printout
511 * triggers in watchdog_timer_fn().
512 */
513static void watchdog(unsigned int cpu)
514{
515 __this_cpu_write(soft_lockup_hrtimer_cnt,
516 __this_cpu_read(hrtimer_interrupts));
517 __touch_watchdog();
518}
Don Zickus58687ac2010-05-07 17:11:44 -0400519
Frederic Weisbeckerb8900bc2013-06-06 15:42:53 +0200520static struct smp_hotplug_thread watchdog_threads = {
521 .store = &softlockup_watchdog,
522 .thread_should_run = watchdog_should_run,
523 .thread_fn = watchdog,
524 .thread_comm = "watchdog/%u",
525 .setup = watchdog_enable,
526 .cleanup = watchdog_cleanup,
527 .park = watchdog_disable,
528 .unpark = watchdog_enable,
529};
530
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200531static void softlockup_update_smpboot_threads(void)
532{
533 lockdep_assert_held(&watchdog_mutex);
534
535 if (!softlockup_threads_initialized)
536 return;
537
538 smpboot_update_cpumask_percpu_thread(&watchdog_threads,
539 &watchdog_allowed_mask);
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200540}
541
542/* Temporarily park all watchdog threads */
543static void softlockup_park_all_threads(void)
544{
545 cpumask_clear(&watchdog_allowed_mask);
546 softlockup_update_smpboot_threads();
547}
548
Thomas Gleixnere8b62b22017-09-12 21:37:12 +0200549/* Unpark enabled threads */
550static void softlockup_unpark_threads(void)
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200551{
552 cpumask_copy(&watchdog_allowed_mask, &watchdog_cpumask);
553 softlockup_update_smpboot_threads();
554}
555
Thomas Gleixner55871852017-10-04 10:03:04 +0200556static void lockup_detector_reconfigure(void)
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200557{
Thomas Gleixnere31d6882017-10-03 16:37:53 +0200558 cpus_read_lock();
Thomas Gleixner6b9dc482017-10-02 12:34:50 +0200559 watchdog_nmi_stop();
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200560 softlockup_park_all_threads();
561 set_sample_period();
Thomas Gleixner09154982017-09-12 21:37:17 +0200562 lockup_detector_update_enable();
563 if (watchdog_enabled && watchdog_thresh)
Thomas Gleixnere8b62b22017-09-12 21:37:12 +0200564 softlockup_unpark_threads();
Thomas Gleixner6b9dc482017-10-02 12:34:50 +0200565 watchdog_nmi_start();
Thomas Gleixnere31d6882017-10-03 16:37:53 +0200566 cpus_read_unlock();
567 /*
568 * Must be called outside the cpus locked section to prevent
569 * recursive locking in the perf code.
570 */
571 __lockup_detector_cleanup();
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200572}
573
574/*
Thomas Gleixner55871852017-10-04 10:03:04 +0200575 * Create the watchdog thread infrastructure and configure the detector(s).
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200576 *
577 * The threads are not unparked as watchdog_allowed_mask is empty. When
578 * the threads are sucessfully initialized, take the proper locks and
579 * unpark the threads in the watchdog_cpumask if the watchdog is enabled.
580 */
Thomas Gleixner55871852017-10-04 10:03:04 +0200581static __init void lockup_detector_setup(void)
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200582{
583 int ret;
584
585 /*
586 * If sysctl is off and watchdog got disabled on the command line,
587 * nothing to do here.
588 */
Thomas Gleixner09154982017-09-12 21:37:17 +0200589 lockup_detector_update_enable();
590
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200591 if (!IS_ENABLED(CONFIG_SYSCTL) &&
592 !(watchdog_enabled && watchdog_thresh))
593 return;
594
595 ret = smpboot_register_percpu_thread_cpumask(&watchdog_threads,
596 &watchdog_allowed_mask);
597 if (ret) {
598 pr_err("Failed to initialize soft lockup detector threads\n");
599 return;
600 }
601
602 mutex_lock(&watchdog_mutex);
603 softlockup_threads_initialized = true;
Thomas Gleixner55871852017-10-04 10:03:04 +0200604 lockup_detector_reconfigure();
Thomas Gleixner2eb25272017-09-12 21:37:10 +0200605 mutex_unlock(&watchdog_mutex);
606}
607
Thomas Gleixner2b9d7f22017-09-12 21:37:06 +0200608#else /* CONFIG_SOFTLOCKUP_DETECTOR */
609static inline int watchdog_park_threads(void) { return 0; }
610static inline void watchdog_unpark_threads(void) { }
611static inline int watchdog_enable_all_cpus(void) { return 0; }
612static inline void watchdog_disable_all_cpus(void) { }
Thomas Gleixner55871852017-10-04 10:03:04 +0200613static void lockup_detector_reconfigure(void)
Thomas Gleixner6592ad22017-09-12 21:37:16 +0200614{
Thomas Gleixnere31d6882017-10-03 16:37:53 +0200615 cpus_read_lock();
Thomas Gleixner6b9dc482017-10-02 12:34:50 +0200616 watchdog_nmi_stop();
Thomas Gleixner09154982017-09-12 21:37:17 +0200617 lockup_detector_update_enable();
Thomas Gleixner6b9dc482017-10-02 12:34:50 +0200618 watchdog_nmi_start();
Thomas Gleixnere31d6882017-10-03 16:37:53 +0200619 cpus_read_unlock();
Thomas Gleixner6592ad22017-09-12 21:37:16 +0200620}
Thomas Gleixner55871852017-10-04 10:03:04 +0200621static inline void lockup_detector_setup(void)
Thomas Gleixner34ddaa32017-10-03 16:39:02 +0200622{
Thomas Gleixner55871852017-10-04 10:03:04 +0200623 lockup_detector_reconfigure();
Thomas Gleixner34ddaa32017-10-03 16:39:02 +0200624}
Thomas Gleixner2b9d7f22017-09-12 21:37:06 +0200625#endif /* !CONFIG_SOFTLOCKUP_DETECTOR */
Nicholas Piggin05a4a952017-07-12 14:35:46 -0700626
Thomas Gleixner941154b2017-09-12 21:37:04 +0200627static void __lockup_detector_cleanup(void)
628{
629 lockdep_assert_held(&watchdog_mutex);
630 hardlockup_detector_perf_cleanup();
631}
632
633/**
634 * lockup_detector_cleanup - Cleanup after cpu hotplug or sysctl changes
635 *
636 * Caller must not hold the cpu hotplug rwsem.
637 */
638void lockup_detector_cleanup(void)
639{
640 mutex_lock(&watchdog_mutex);
641 __lockup_detector_cleanup();
642 mutex_unlock(&watchdog_mutex);
643}
644
Thomas Gleixner6554fd82017-09-12 21:36:57 +0200645/**
646 * lockup_detector_soft_poweroff - Interface to stop lockup detector(s)
647 *
648 * Special interface for parisc. It prevents lockup detector warnings from
649 * the default pm_poweroff() function which busy loops forever.
650 */
651void lockup_detector_soft_poweroff(void)
652{
653 watchdog_enabled = 0;
654}
655
Ulrich Obergfell58cf6902015-11-05 18:44:30 -0800656#ifdef CONFIG_SYSCTL
657
Thomas Gleixnere8b62b22017-09-12 21:37:12 +0200658/* Propagate any changes to the watchdog threads */
Thomas Gleixnerd57108d2017-09-12 21:37:11 +0200659static void proc_watchdog_update(void)
Don Zickus58687ac2010-05-07 17:11:44 -0400660{
Thomas Gleixnere8b62b22017-09-12 21:37:12 +0200661 /* Remove impossible cpus to keep sysctl output clean. */
662 cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask);
Thomas Gleixner55871852017-10-04 10:03:04 +0200663 lockup_detector_reconfigure();
Ulrich Obergfella0c9cbb2015-04-14 15:43:58 -0700664}
665
666/*
Ulrich Obergfellef246a22015-04-14 15:44:05 -0700667 * common function for watchdog, nmi_watchdog and soft_watchdog parameter
668 *
Thomas Gleixner7feeb9c2017-09-12 21:37:15 +0200669 * caller | table->data points to | 'which'
670 * -------------------|----------------------------|--------------------------
671 * proc_watchdog | watchdog_user_enabled | NMI_WATCHDOG_ENABLED |
672 * | | SOFT_WATCHDOG_ENABLED
673 * -------------------|----------------------------|--------------------------
674 * proc_nmi_watchdog | nmi_watchdog_user_enabled | NMI_WATCHDOG_ENABLED
675 * -------------------|----------------------------|--------------------------
676 * proc_soft_watchdog | soft_watchdog_user_enabled | SOFT_WATCHDOG_ENABLED
Ulrich Obergfellef246a22015-04-14 15:44:05 -0700677 */
678static int proc_watchdog_common(int which, struct ctl_table *table, int write,
679 void __user *buffer, size_t *lenp, loff_t *ppos)
680{
Thomas Gleixner09154982017-09-12 21:37:17 +0200681 int err, old, *param = table->data;
Don Zickus58687ac2010-05-07 17:11:44 -0400682
Thomas Gleixner946d1972017-09-12 21:37:01 +0200683 mutex_lock(&watchdog_mutex);
Thomas Gleixnerbcd951c2012-07-16 10:42:38 +0000684
Ulrich Obergfellef246a22015-04-14 15:44:05 -0700685 if (!write) {
Thomas Gleixner09154982017-09-12 21:37:17 +0200686 /*
687 * On read synchronize the userspace interface. This is a
688 * racy snapshot.
689 */
690 *param = (watchdog_enabled & which) != 0;
Ulrich Obergfellef246a22015-04-14 15:44:05 -0700691 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
692 } else {
Thomas Gleixner09154982017-09-12 21:37:17 +0200693 old = READ_ONCE(*param);
Ulrich Obergfellef246a22015-04-14 15:44:05 -0700694 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
Thomas Gleixner09154982017-09-12 21:37:17 +0200695 if (!err && old != READ_ONCE(*param))
Thomas Gleixnerd57108d2017-09-12 21:37:11 +0200696 proc_watchdog_update();
Ulrich Obergfellef246a22015-04-14 15:44:05 -0700697 }
Thomas Gleixner946d1972017-09-12 21:37:01 +0200698 mutex_unlock(&watchdog_mutex);
Ulrich Obergfellef246a22015-04-14 15:44:05 -0700699 return err;
700}
701
702/*
Ulrich Obergfell83a80a32015-04-14 15:44:08 -0700703 * /proc/sys/kernel/watchdog
704 */
705int proc_watchdog(struct ctl_table *table, int write,
706 void __user *buffer, size_t *lenp, loff_t *ppos)
707{
708 return proc_watchdog_common(NMI_WATCHDOG_ENABLED|SOFT_WATCHDOG_ENABLED,
709 table, write, buffer, lenp, ppos);
710}
711
712/*
713 * /proc/sys/kernel/nmi_watchdog
714 */
715int proc_nmi_watchdog(struct ctl_table *table, int write,
716 void __user *buffer, size_t *lenp, loff_t *ppos)
717{
Thomas Gleixnera994a312017-09-12 21:37:19 +0200718 if (!nmi_watchdog_available && write)
719 return -ENOTSUPP;
Ulrich Obergfell83a80a32015-04-14 15:44:08 -0700720 return proc_watchdog_common(NMI_WATCHDOG_ENABLED,
721 table, write, buffer, lenp, ppos);
722}
723
724/*
725 * /proc/sys/kernel/soft_watchdog
726 */
727int proc_soft_watchdog(struct ctl_table *table, int write,
728 void __user *buffer, size_t *lenp, loff_t *ppos)
729{
730 return proc_watchdog_common(SOFT_WATCHDOG_ENABLED,
731 table, write, buffer, lenp, ppos);
732}
733
734/*
735 * /proc/sys/kernel/watchdog_thresh
736 */
737int proc_watchdog_thresh(struct ctl_table *table, int write,
738 void __user *buffer, size_t *lenp, loff_t *ppos)
739{
Thomas Gleixnerd57108d2017-09-12 21:37:11 +0200740 int err, old;
Ulrich Obergfell83a80a32015-04-14 15:44:08 -0700741
Thomas Gleixner946d1972017-09-12 21:37:01 +0200742 mutex_lock(&watchdog_mutex);
Ulrich Obergfell83a80a32015-04-14 15:44:08 -0700743
Thomas Gleixnerd57108d2017-09-12 21:37:11 +0200744 old = READ_ONCE(watchdog_thresh);
Frederic Weisbeckerb8900bc2013-06-06 15:42:53 +0200745 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
Ulrich Obergfell83a80a32015-04-14 15:44:08 -0700746
Thomas Gleixnerd57108d2017-09-12 21:37:11 +0200747 if (!err && write && old != READ_ONCE(watchdog_thresh))
748 proc_watchdog_update();
Mandeep Singh Bainese04ab2b2011-05-22 22:10:21 -0700749
Thomas Gleixner946d1972017-09-12 21:37:01 +0200750 mutex_unlock(&watchdog_mutex);
Frederic Weisbeckerb8900bc2013-06-06 15:42:53 +0200751 return err;
Don Zickus58687ac2010-05-07 17:11:44 -0400752}
Chris Metcalffe4ba3c2015-06-24 16:55:45 -0700753
754/*
755 * The cpumask is the mask of possible cpus that the watchdog can run
756 * on, not the mask of cpus it is actually running on. This allows the
757 * user to specify a mask that will include cpus that have not yet
758 * been brought online, if desired.
759 */
760int proc_watchdog_cpumask(struct ctl_table *table, int write,
761 void __user *buffer, size_t *lenp, loff_t *ppos)
762{
763 int err;
764
Thomas Gleixner946d1972017-09-12 21:37:01 +0200765 mutex_lock(&watchdog_mutex);
Ulrich Obergfell8c073d22015-09-04 15:45:18 -0700766
Chris Metcalffe4ba3c2015-06-24 16:55:45 -0700767 err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
Thomas Gleixner05ba3de2017-09-12 21:37:08 +0200768 if (!err && write)
Thomas Gleixnere8b62b22017-09-12 21:37:12 +0200769 proc_watchdog_update();
Thomas Gleixner54901252017-09-12 21:36:59 +0200770
Thomas Gleixner946d1972017-09-12 21:37:01 +0200771 mutex_unlock(&watchdog_mutex);
Chris Metcalffe4ba3c2015-06-24 16:55:45 -0700772 return err;
773}
Don Zickus58687ac2010-05-07 17:11:44 -0400774#endif /* CONFIG_SYSCTL */
775
Peter Zijlstra004417a2010-11-25 18:38:29 +0100776void __init lockup_detector_init(void)
Don Zickus58687ac2010-05-07 17:11:44 -0400777{
Frederic Weisbecker13316b32017-10-27 04:42:29 +0200778 if (tick_nohz_full_enabled())
Frederic Weisbecker314b08ff2015-09-04 15:45:09 -0700779 pr_info("Disabling watchdog on nohz_full cores by default\n");
Frederic Weisbecker13316b32017-10-27 04:42:29 +0200780
Frederic Weisbeckerde201552017-10-27 04:42:35 +0200781 cpumask_copy(&watchdog_cpumask,
782 housekeeping_cpumask(HK_FLAG_TIMER));
Chris Metcalffe4ba3c2015-06-24 16:55:45 -0700783
Thomas Gleixnera994a312017-09-12 21:37:19 +0200784 if (!watchdog_nmi_probe())
785 nmi_watchdog_available = true;
Thomas Gleixner55871852017-10-04 10:03:04 +0200786 lockup_detector_setup();
Don Zickus58687ac2010-05-07 17:11:44 -0400787}