NetBSD-Bugs archive

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

Re: misc/57300: Time system is not accurate on NetBSD VM



Hi Michael,

Thanks very much for your reply! "clockinterrupt" seems working for my
VM environment.


On 2023/3/26 6:50 PM, Michael van Elst wrote:
> The following reply was made to PR misc/57300; it has been noted by GNATS.
> 
> From: mlelstv%serpens.de@localhost (Michael van Elst)
> To: gnats-bugs%netbsd.org@localhost
> Cc: 
> Subject: Re: misc/57300: Time system is not accurate on NetBSD VM
> Date: Sun, 26 Mar 2023 10:44:17 -0000 (UTC)
> 
>  nan%chinadtrace.org@localhost writes:
>  
>  >-bash-5.1$ date; sleep 10; date
>  >Sun Mar 26 18:59:44 +08 2023
>  >Sun Mar 26 19:00:13 +08 2023
>  
>  >Actually the time just passes 10 seconds, but date command shows it has passes nearly half a minute. Not sure whether this could be accounted as NetBSD bug, or VirtualBox bug, thanks!
>  
>  
>  "sleep 10" waits 1000 clock interrupts. If that lasts 10 seconds, the
>  emulation of clock interrupts is correct. The exact delay can vary
>  with host speed and load.
>  
>  "date" looks at the current timecounter. If that advances 30 seconds
>  in 10 seconds, the emulation of the timecounter is bad. Fortunately we
>  have multiple, e.g.:
>  
>  # sysctl kern.timecounter
>  kern.timecounter.choice = TSC(q=3000, f=3292677360 Hz) clockinterrupt(q=0, f=100 Hz) ichlpcib0(q=1000, f=3579545 Hz) hpet0(q=2000, f=14318180 Hz) ACPI-Fast(q=1000, f=3579545 Hz) lapic(q=-100, f=99859155 Hz) i8254(q=100, f=1193182 Hz) dummy(q=-1000000, f=1000000 Hz)
>  kern.timecounter.hardware = TSC
>  kern.timecounter.timestepwarnings = 0
>  
>  By setting kern.timecounter.hardware to one of the choices you may get
>  a timecounter that works better.
>  
>  While the choice "clockinterrupt" avoids discrepancies between "sleep"
>  and "date", the result might not be accurate. For many cases a different
>  choice (if there is any) is better.
>  
>  

-- 
Best Regards
Nan Xiao(肖楠)



Home | Main Index | Thread Index | Old Index