Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 1999 11:26:45 -0800 (PST)
From:      Julian Elischer <julian@whistle.com>
To:        zhihuizhang <bf20761@binghamton.edu>
Cc:        hackers <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: Question concerning timer and rdtsc
Message-ID:  <Pine.BSF.4.05.9901281120520.304-100000@s204m82.isp.whistle.com>
In-Reply-To: <Pine.SOL.L3.93.990127222926.9143A-100000@bingsun1>

next in thread | previous in thread | raw e-mail | index | archive | help
You must not actually GET the timer until the passing if a Hz tick
in other woords that actual changing of the frequency can only be done
when teh Hz tick is passing. so while you are waiting for that to happen,
you are in AQUIRE_PENDING state.
Once you have sped teh clock into some multiple of the original Hz  rate,
then when you release it,
it must not be slowed down again, until the correct MULTIPLE of hardware
ticks have passed. Otherwise the Hz ticks that follow woule be offfset by
the amoutn of time remaining in the 'virtual' tick that is being worked
out.

i.e. from the outside, 'Hz ticks' must continue to be generated at a
constant rate regardless of whether the hardware clock has been aquired
for a higher (multiple) speed or not.
The ticks before and after the higher rate is being use must be allowed to
complete, and the last virtual tick must also be allowed to complete

sothere are 4 states.
RELEASED, ACQUIRE_PENDING, ACQUIRED, RELEASE_PENDING.

julian



On Thu, 28 Jan 1999, zhihuizhang wrote:

> 
> I am reading 2.2.8 Stable source code and have two questions about the
> timer and rdtsc instruction:
> 
> (1) In file clock.c, timer0_state has four possible values: RELEASED,
> RELEASE_PENDING, ACQUIRED, and ACQUIRE_PENDING.  I can not figure out the
> usage of these four states.  Moreover, I tried to see how the variable is
> changed in the source code.  It seems to me that it can only has the value
> of RELEASED (0).  Who is going to change it? For what purpose?
> 
> (2) rdtsc is used in microtime to get the internal counter.  This value is
> related to the Mhz of CPU (and the Mhz may be different, say 133, 300,
> etc). We must convert it to microseconds, right? In microtime, this is
> done by multiplying a variable i586_ctr_multiplier. I tried to figure out
> how the variable is initialized, but it does not make sense to me.  The
> statement that does the initialization is:
> 
> multiplier = (1000000LL << I586_CTR_MULTIPLIER_SHIFT) / i586_freq;
> 
> and i586_freq is often given as the return value of rdtsc(). 
> 
> Thanks for any help.
> 
> -------------------------------------------------- 
> | Zhihui Zhang, http://cs.binghamton.edu/~zzhang |
> | Dept. of Computer Science,  SUNY at Binghamton |
> --------------------------------------------------
> 
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9901281120520.304-100000>