On Sat, Oct 13, 2018 at 07:37:49PM -0300, Daniel Bolgheroni wrote: > On Sat, Oct 13, 2018 at 01:08:23AM +0000, Jordan Geoghegan wrote: > > Hello, > > > > Not sure if this is a bug or not, so I thought I would ask misc@ first. > > > > I was writing a script in my vmm guest that involved killing and restarting > > a long running process every hour using sleep "3600", and I noticed it ended > > up sleeping for 2 hours and 56 minutes, rather than an hour. > > > > To test, I ran "time sleep 30" and got this result: > > > > vmm$ time sleep 30 > > 0m57.50s real 0m00.00s user 0m00.00s system > > > > When run on bare metal, I get this result: > > > > server$ time sleep 30 > > 0m30.00s real 0m00.00s user 0m00.00s system > > > > I have "sysctl kern.timecounter.hardware=tsc" set in the vm to prevent clock > > drift, otherwise the vm clock runs at around half speed. > > > > When "time sleep 30" is run on a vm without "sysctl > > kern.timecounter.hardware=tsc" set, it reports the correct amount of time > > being spent sleeping, but since the clock runs at around half speed without > > tsc enabled, it still ends up sleeping for almost a minute. > > > > The host machine is running 6.3 stable, the guest is running the latest > > snapshot. I tried running a 6.3-stable guest with the same results. > > > > Has this been fixed in current? I don't have a vmm capable machine available > > running current, I only own spare macppc and i386 hardware which runs > > current. > > I get the same results as yours also with a -current vm running on > -current, also with kern.timecounter.hardware=tsc on the vm. > > # time sleep 30 > 0m59.99s real 0m00.00s user 0m00.00s system > # time sleep 30 > 1m00.30s real 0m00.00s user 0m00.00s system > # time sleep 30 > 1m00.30s real 0m00.00s user 0m00.00s system > # > > I don't know if it's somehow related to the same interrupt thing, but I > also get a slow scroll when attached to the console.
A 1000Hz host helps here. I get 10.32s real time on sleep 10 with that setting. Note that qemu behaves the same way on OpenBSD. -ml