Subject: Re: xen/clock.c:get_tsc_offset_ns
To: None <port-xen@NetBSD.org>
From: Jed Davis <jdev@panix.com>
List: port-xen
Date: 01/12/2006 21:08:24
Jed Davis <jdev@panix.com> writes:

> I notice that the static function get_tsc_offset_ns in xen/clock.c
> multiplies a uint32_t by 1000000000, which looks to me as though it'll
> pretty much always overflow (if more than 4 cycles have passed since
> the last call to get_time_values_from_xen, it seems).  So, two questions:
>
> 1) Should that be 1000000000ULL instead? 

Now that I've looked at this a little more closely, change that to:
Why is that a uint32, and why is cpu_counter32() being called?
shadow_tsc_stamp is 64-bit.

> 2) If so, how much is this breaking?

The answer may be "quite a lot", if the shared_info time stuff is
updated as infrequently as it sounds like.  Also:

3) Hasn't this been discussed here before?

-- 
(let ((C call-with-current-continuation)) (apply (lambda (x y) (x y)) (map
((lambda (r) ((C C) (lambda (s) (r (lambda l (apply (s s) l))))))  (lambda
(f) (lambda (l) (if (null? l) C (lambda (k) (display (car l)) ((f (cdr l))
(C k)))))))    '((#\J #\d #\D #\v #\s) (#\e #\space #\a #\i #\newline)))))