Subject: Re: current kernel on amd64 crashes
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: David Laight <david@l8s.co.uk>
List: port-xen
Date: 01/10/2008 20:41:35
On Thu, Jan 10, 2008 at 02:55:52PM +0100, Manuel Bouyer wrote:
> 
> Ha OK, it's on a HVM guest. 
> I guess the relevant NetBSD code is x86/isa/clock.c
> 
> Could it be this change ?
> -       low = inb(IO_TIMER1 + TIMER_CNTR0);
> -       high = inb(IO_TIMER1 + TIMER_CNTR0);
> -       count = rtclock_tval - ((high << 8) | low);
> -
> +       /* insb to make the read atomic */
> +       insb(IO_TIMER1+TIMER_CNTR0, &rdval, 2);
> +       count = rtclock_tval - rdval;

I don't know, but I also have no reason to believe that the comment (and
hence the modified code) is correct.

In order to get a consistent view of the counter, you have to latch it.
Any other attempted procedure (eg reading high-low-high) is doomed to
failure because some systems don't even report consitent byte values
when unlatched.  (and soeme just return junk occaisionally).

	David

-- 
David Laight: david@l8s.co.uk