|
@@ -49,7 +49,7 @@
|
|
#include <asm/uaccess.h>
|
|
#include <asm/uaccess.h>
|
|
#include <linux/sysrq.h>
|
|
#include <linux/sysrq.h>
|
|
#include <linux/timer.h>
|
|
#include <linux/timer.h>
|
|
-#include <linux/time.h>
|
|
|
|
|
|
+#include <linux/hrtimer.h>
|
|
|
|
|
|
#define VERSION_STR "0.9.1"
|
|
#define VERSION_STR "0.9.1"
|
|
|
|
|
|
@@ -117,24 +117,7 @@ __setup("hcheck_reboot", hangcheck_parse_reboot);
|
|
__setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks);
|
|
__setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks);
|
|
#endif /* not MODULE */
|
|
#endif /* not MODULE */
|
|
|
|
|
|
-#if defined(CONFIG_S390)
|
|
|
|
-# define HAVE_MONOTONIC
|
|
|
|
-# define TIMER_FREQ 1000000000ULL
|
|
|
|
-#else
|
|
|
|
-# define TIMER_FREQ 1000000000ULL
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-#ifdef HAVE_MONOTONIC
|
|
|
|
-extern unsigned long long monotonic_clock(void);
|
|
|
|
-#else
|
|
|
|
-static inline unsigned long long monotonic_clock(void)
|
|
|
|
-{
|
|
|
|
- struct timespec ts;
|
|
|
|
- getrawmonotonic(&ts);
|
|
|
|
- return timespec_to_ns(&ts);
|
|
|
|
-}
|
|
|
|
-#endif /* HAVE_MONOTONIC */
|
|
|
|
-
|
|
|
|
|
|
+#define TIMER_FREQ 1000000000ULL
|
|
|
|
|
|
/* Last time scheduled */
|
|
/* Last time scheduled */
|
|
static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;
|
|
static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;
|
|
@@ -143,12 +126,11 @@ static void hangcheck_fire(unsigned long);
|
|
|
|
|
|
static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire, 0, 0);
|
|
static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire, 0, 0);
|
|
|
|
|
|
-
|
|
|
|
static void hangcheck_fire(unsigned long data)
|
|
static void hangcheck_fire(unsigned long data)
|
|
{
|
|
{
|
|
unsigned long long cur_tsc, tsc_diff;
|
|
unsigned long long cur_tsc, tsc_diff;
|
|
|
|
|
|
- cur_tsc = monotonic_clock();
|
|
|
|
|
|
+ cur_tsc = ktime_get_ns();
|
|
|
|
|
|
if (cur_tsc > hangcheck_tsc)
|
|
if (cur_tsc > hangcheck_tsc)
|
|
tsc_diff = cur_tsc - hangcheck_tsc;
|
|
tsc_diff = cur_tsc - hangcheck_tsc;
|
|
@@ -177,7 +159,7 @@ static void hangcheck_fire(unsigned long data)
|
|
tsc_diff, tsc_diff - hangcheck_tick*TIMER_FREQ);
|
|
tsc_diff, tsc_diff - hangcheck_tick*TIMER_FREQ);
|
|
#endif
|
|
#endif
|
|
mod_timer(&hangcheck_ticktock, jiffies + (hangcheck_tick*HZ));
|
|
mod_timer(&hangcheck_ticktock, jiffies + (hangcheck_tick*HZ));
|
|
- hangcheck_tsc = monotonic_clock();
|
|
|
|
|
|
+ hangcheck_tsc = ktime_get_ns();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -185,16 +167,11 @@ static int __init hangcheck_init(void)
|
|
{
|
|
{
|
|
printk("Hangcheck: starting hangcheck timer %s (tick is %d seconds, margin is %d seconds).\n",
|
|
printk("Hangcheck: starting hangcheck timer %s (tick is %d seconds, margin is %d seconds).\n",
|
|
VERSION_STR, hangcheck_tick, hangcheck_margin);
|
|
VERSION_STR, hangcheck_tick, hangcheck_margin);
|
|
-#if defined (HAVE_MONOTONIC)
|
|
|
|
- printk("Hangcheck: Using monotonic_clock().\n");
|
|
|
|
-#else
|
|
|
|
- printk("Hangcheck: Using getrawmonotonic().\n");
|
|
|
|
-#endif /* HAVE_MONOTONIC */
|
|
|
|
hangcheck_tsc_margin =
|
|
hangcheck_tsc_margin =
|
|
(unsigned long long)(hangcheck_margin + hangcheck_tick);
|
|
(unsigned long long)(hangcheck_margin + hangcheck_tick);
|
|
hangcheck_tsc_margin *= (unsigned long long)TIMER_FREQ;
|
|
hangcheck_tsc_margin *= (unsigned long long)TIMER_FREQ;
|
|
|
|
|
|
- hangcheck_tsc = monotonic_clock();
|
|
|
|
|
|
+ hangcheck_tsc = ktime_get_ns();
|
|
mod_timer(&hangcheck_ticktock, jiffies + (hangcheck_tick*HZ));
|
|
mod_timer(&hangcheck_ticktock, jiffies + (hangcheck_tick*HZ));
|
|
|
|
|
|
return 0;
|
|
return 0;
|