Subject: Re: HEADS UP: timecounters (branch simonb-timecounters) merged into
To: Vincent <10.50@free.fr>
From: Frank Kardel <Frank.Kardel@Acrys.COM>
List: current-users
Date: 06/10/2006 13:55:24
This is a multi-part message in MIME format.
--------------080106050203000302050205
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi,
this looks still strange to me. Could those that  have this issue
apply the patch and send me the dmesg output. From the code
I don't see why this gives different results from before and
why other auich platforms don't exhibit this problem.
Anyone around with experience which the affected chip sets ?

Frank

Vincent wrote:

> Hi there,
>
> there is also a strange thing with auich since I compiled the kernel 
> featuring timecounters. Look at the auich0 rate on this excerpt from 
> dmesg:
>
>
> timecounter: Timecounter "TSC" frequency 1196183000 Hz quality 800
> WARNING: Callback scheduled before sysmon task queue thread present.
> timecounter: Timecounters tick every 10.000 msec
> timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
> timecounter: selected timecounter "TSC" frequency 1196183000 Hz 
> quality 800
> auich0: measured ac97 link rate at 8378 Hz, will use 48000 Hz
>
>
> Normally, it should be around 47 to 48 kHz, as it was before.
>
> The frequency of the TSC counter is correct, though.
> Vincent
>


--------------080106050203000302050205
Content-Type: text/plain;
 name="p"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="p"

--- ../../../tc-merge/src/sys/kern/kern_tc.c	2006-06-09 23:55:36.000000000 +0200
+++ kern_tc.c	2006-06-10 08:36:57.000000000 +0200
@@ -453,6 +453,30 @@
 	} while (gen == 0 || gen != th->th_generation);
 }
 
+static void
+tc_timecheck(void)
+{
+	struct timespec tsa, tsb;
+	long delta, delay;
+
+	nanotime(&tsa);
+	nanotime(&tsb);
+	delay = 1000000000L * (tsb.tv_sec - tsa.tv_sec) + tsb.tv_nsec - tsa.tv_nsec;
+	printf("timecounter: delta t nanotime: %ld nsec\n", delay);
+	nanotime(&tsa);
+	delay(100);
+	nanotime(&tsb);
+	delta = 1000000000L * (tsb.tv_sec - tsa.tv_sec) + tsb.tv_nsec - tsa.tv_nsec;
+	delta -= delay;
+	printf("timecounter: delta t nanotime for 100 usec delay: %ld nsec\n", delta);
+	nanotime(&tsa);
+	delay(500);
+	nanotime(&tsb);
+	delta = 1000000000L * (tsb.tv_sec - tsa.tv_sec) + tsb.tv_nsec - tsa.tv_nsec;
+	delta -= delay;
+	printf("timecounter: delta t nanotime for 500 usec delay: %ld nsec\n", delta);
+}
+
 /*
  * Initialize a new timecounter and possibly use it.
  */
@@ -497,6 +521,7 @@
 	(void)tc->tc_get_timecount(tc);
 	timecounter = tc;
 	tc_windup();
+	tc_timecheck();
 }
 
 /* Report the frequency of the current timecounter. */

--------------080106050203000302050205--