tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: zero runtime when negative

On 26 Jun, 2012, at 02:36 , Michael van Elst wrote:

> (Aleksey Cheusov) writes:
>> As NetBSD is widely used as a "guest" OS inside vmware/qemu/kvm/xen
>> it would be nice to treat this problem as "must be fixed in 6.0".
> I think that's just a conflict of interest in the emulator/virtual machine
> that makes it emulate hardware not the way we expect it.
> The timecounter code requires that overflows of the counter hardware
> are seen by hardclock(). That may or may not be correct for the emulated
> or virtualized hardware.

What is the solution for this?  It seems that if the guest operating
system is to keep correct real time using only the facilities available
on a real machine then either it must be able to rely on its clock interrupt
to be executed in a timely fashion (not necessarily 100 times per second,
but there must be some limit it can count on) or it will need to constrain
itself to deriving time from hardware counters which are unlikely to ever
roll over.  The latter is a problem since many machines have no such counter
in hardware, and for those that do the unlikely-to-roll hardware counter is
often 64 bits wide and is a problem to sample with a 32 bit instruction set.

If the guest is to be generally useful it seems like there must be a way
to maintain a clock which advances at about the rate of the S.I. second
(which will clearly not go backwards since the S.I. second only advances)
since many applications need to measure time intervals in real time this
way to work reliably.  I don't think adding code to work around this is
a good solution since there are likely to be many things, both in the
kernel and in user space applications, which are effected by this and need
similar code added to fix them.  Just maintaining a clock which continually
advances can save a lot of code required to work around one which doesn't.

The clock maintenance code doesn't need to work like the timecounter code
does now but there needs to be something it can count on in a virtual 
to maintain system clocks properly.  What is that?

Dennis Ferguson

Home | Main Index | Thread Index | Old Index