Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Feb 2002 12:42:54 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>, Bruce Evans <bde@zeta.org.au>, freebsd-current@FreeBSD.ORG
Subject:   Re: Success!  Sorta!  (was Re: 'microuptime() went backwards ...' using ACPI timer. Shouldn't that be impossible? )
Message-ID:  <200202172042.g1HKgs691210@apollo.backplane.com>
References:  <5781.1013977327@critter.freebsd.dk> 

next in thread | previous in thread | raw e-mail | index | archive | help
    Whoop!  I take it back.  I'm still getting the errors:

microuptime() went backwards (458.168990 -> 458.168882)
microuptime() went backwards (578.609995 -> 577.929801)
microuptime() went backwards (748.912755 -> 748.237402)
microuptime() went backwards (775.159625 -> 775.159612)

    I also think this retry loop has to be done everywhere where the
    timecounter structure is accessed directly.

						-Matt

:    Ok, I've tested Bruce's patch and it appeaars to mostly solve the problem.
:    I no longer get 'microuptime ... backwards' errors on a -current SMP
:    box.
:...

Index: kern/kern_tc.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_tc.c,v
retrieving revision 1.113
diff -u -r1.113 kern_tc.c
--- kern/kern_tc.c	7 Feb 2002 21:21:55 -0000	1.113
+++ kern/kern_tc.c	17 Feb 2002 20:41:47 -0000
@@ -107,9 +107,11 @@
 {
 	struct timecounter *tc;
 
-	tc = timecounter;
-	*bt = tc->tc_offset;
-	bintime_addx(bt, tc->tc_scale * tco_delta(tc));
+	do {
+	    tc = timecounter;
+	    *bt = tc->tc_offset;
+	    bintime_addx(bt, tc->tc_scale * tco_delta(tc));
+	} while (tc != timecounter);
 }
 
 void
@@ -126,8 +128,10 @@
 	struct timecounter *tc;
 
 	ngetmicrotime++;
-	tc = timecounter;
-	*tvp = tc->tc_microtime;
+	do {
+		tc = timecounter;
+		*tvp = tc->tc_microtime;
+	} while (tc != timecounter);
 }
 
 void
@@ -136,8 +140,10 @@
 	struct timecounter *tc;
 
 	ngetnanotime++;
-	tc = timecounter;
-	*tsp = tc->tc_nanotime;
+	do {
+		tc = timecounter;
+		*tsp = tc->tc_nanotime;
+	} while (tc != timecounter);
 }
 
 void
@@ -166,8 +172,10 @@
 	struct timecounter *tc;
 
 	ngetmicrouptime++;
-	tc = timecounter;
-	bintime2timeval(&tc->tc_offset, tvp);
+	do {
+		tc = timecounter;
+		bintime2timeval(&tc->tc_offset, tvp);
+	} while (tc != timecounter);
 }
 
 void
@@ -176,8 +184,10 @@
 	struct timecounter *tc;
 
 	ngetnanouptime++;
-	tc = timecounter;
-	bintime2timespec(&tc->tc_offset, tsp);
+	do {
+		tc = timecounter;
+		bintime2timespec(&tc->tc_offset, tsp);
+	} while (tc != timecounter);
 }
 
 void

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202172042.g1HKgs691210>