Subject: Re: kern_microtime.c and Xen
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 01/23/2006 12:03:13
On Mon, Jan 23, 2006 at 07:45:48AM +0900, YAMAMOTO Takashi wrote:
> > cc_microset() isn't really suitable for Xen anyway because of the
> > way the clock instability, and I'll use a private implementation to
> > compensate this. However, cc_microtime() is almost OK, and I'd like to avoid
> > code duplicate if possible.
> >
> > The problem here is that cc_microtime() uses cpu_counter32() - ci->ci_cc.cc_cc.
> > This is fine as long as ci_cc_cc is alaso initialised with cpu_counter32,
> > but because of the overflow issue I want to use a 64bit value for
> > ci_cc.cc_cc (and I don't want to keep a private variable for this).
> > This can easily be solved by masking the ci_cc.cc_cc value, as in the
> > patch below. Is it OK to commit and pullup to netbsd-3 ?
>
> do you really need to have a custom version of cc_microset()?
> what you need is some #ifdef for 64 bit counter, isn't it?
And also remove the assertion that the delta is between 0.5 and 1.5s.
Other than that yes, cc_microset() should be fine.
My initial idea was to normalise delta and denom back to 1s, but it fact
it's not needed.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--