mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Hangcheck-timer TSC source is stable?
@ 2008-09-17  9:42 Michael Trimarchi
  0 siblings, 0 replies; only message in thread
From: Michael Trimarchi @ 2008-09-17  9:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: joel.becker

[-- Attachment #1: Type: text/plain, Size: 296 bytes --]

Hi,

This patch checks the TSC source before initialization.

Regards Michael

__________________________________________________
Do You Yahoo!?
Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito per i tuoi file e i messaggi 
http://mail.yahoo.it 

[-- Attachment #2: hangcheck-timer-tsc-unstable.pach --]
[-- Type: application/octet-stream, Size: 1622 bytes --]

Check if the TSC source is stable otherwise fail registration.

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>

---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-17  9:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-17  9:42 [PATCH] Hangcheck-timer TSC source is stable? Michael Trimarchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®