[LV] [RFC] Implement higher clock precision

Jan-Benedict Glaw jbglaw at lug-owl.de
Sat Apr 8 13:33:08 CEST 2006


Hi!

I still haven't put up a new NFS server so I'd like you to give this a
test run.

I noticed that printk() (with timestamps enabled) only prints
timestamps with a resolution of 10msec. This is obviously HZ-related
and indeed, sched_clock() is used, which just returns jiffies
(converted to nsec resolution).

This patch adds the Intervall Counter Register value (after
subtracting NICR and multiplying the result with 1000 because we're
"only" running at 1usec, not 1nsec...)

On my KA43, this doesn't make much of a difference because ICR always
reads as zero...  Could somebody test that on a different box (KA42,
KA46, SIMH...)?

diff --git a/arch/vax/kernel/time.c b/arch/vax/kernel/time.c
index 4204fe0..df3f400 100644
--- a/arch/vax/kernel/time.c
+++ b/arch/vax/kernel/time.c
@@ -32,7 +32,8 @@
 spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
 extern unsigned long wall_jiffies;	/* kernel/timer.c */
 
-#define TICK_SIZE (tick_nsec / 1000)
+#define TICK_SIZE	(tick_nsec / 1000)
+#define NICR_START	(0xffffffff - 1000000/HZ)
 
 /* last time the cmos clock got updated */
 static long last_rtc_update;
@@ -73,7 +74,7 @@ void __init time_init(void)
 	 * to get more than one interrupt per hour:-)
 	 */
 	if (mv->nicr_required)
-		__mtpr(0xffffffff - 1000000/HZ, PR_NICR);
+		__mtpr(NICR_START, PR_NICR);
 
 	/* Set the clock ticking and enable clock interrupts */
 	__mtpr(ICCS_ERROR | ICCS_INTERRUPT |	/* clear error and interrupt bits */
@@ -334,6 +335,7 @@ unsigned long get_cmos_time(void)
  */
 unsigned long long sched_clock(void)
 {
-	return (unsigned long long)jiffies * (1000000000 / HZ);
+	return (unsigned long long)jiffies * (1000000000 / HZ)
+		+ (__mfpr (PR_ICR) - NICR_START) * 1000;
 }
 

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw at lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lug-owl.de/pipermail/vax-linux/attachments/20060408/396c5f53/attachment.pgp>
-------------- next part --------------
_______________________________________________
Linux-Vax mailing list
Linux-Vax at pergamentum.com
http://www.pergamentum.com/mailman/listinfo/linux-vax


More information about the Vax-linux mailing list