Check if the TSC source is stable otherwise fail registration. Signed-off-by: Michael Trimarchi --- drivers/char/hangcheck-timer.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c index 712d9f2..6b61389 100644 --- a/drivers/char/hangcheck-timer.c +++ b/drivers/char/hangcheck-timer.c @@ -175,12 +175,19 @@ static void hangcheck_fire(unsigned long data) static int __init hangcheck_init(void) { - printk("Hangcheck: starting hangcheck timer %s (tick is %d seconds, margin is %d seconds).\n", + printk(KERN_INFO "Hangcheck: starting hangcheck timer %s" + " (tick is %d seconds, margin is %d seconds).\n", VERSION_STR, hangcheck_tick, hangcheck_margin); #if defined (HAVE_MONOTONIC) - printk("Hangcheck: Using monotonic_clock().\n"); + printk(KERN_INFO "Hangcheck: Using monotonic_clock().\n"); #else - printk("Hangcheck: Using get_cycles().\n"); + if (!check_tsc_unstable()) + printk(KERN_INFO "Hangcheck: Using get_cycles().\n"); + else { + printk(KERN_ERR "Handcheck: Failed to register" + " (Unstable TSC).\n"); + return -ENODEV; + } #endif /* HAVE_MONOTONIC */ hangcheck_tsc_margin = (unsigned long long)(hangcheck_margin + hangcheck_tick); @@ -196,7 +203,7 @@ static int __init hangcheck_init(void) static void __exit hangcheck_exit(void) { del_timer_sync(&hangcheck_ticktock); - printk("Hangcheck: Stopped hangcheck timer.\n"); + printk(KERN_INFO "Hangcheck: Stopped hangcheck timer.\n"); } module_init(hangcheck_init); -- 1.5.4.3