On Sat, 12 Jul 2025, Brook Milligan wrote:
I have switched a QEMU VM from 1 CPU to 2 with "-smp cpus=2". Immediately I am
getting lots of warnings like the following:
WARNING: TSC time went backwards by 2452936570 - change sysctl(7)
kern.timecounter?
With `-accel nvmm' you get a virtual CPU based on your actual CPU (ie. same
CPUID fam./model/stepping) but with some features, like TSC, always set and
which can't be turned off (like you can with `cpu kvm64,-tsc' on Linux).
On my machine, NetBSD kernel under Qemu-10.0.2 notices the TSC is iffy and
then goes for the next best time source, `hpet0'. Looks like NetBSD thinks
the TSC is "OK" on your CPU, then has trouble with it.
According to
https://oliveryang.net/2015/09/pitfalls-of-TSC-usage/
TSC timekeeping is tricky, but I am not sure how to use that information to
solve the problem.
Is this a known issue? Any help is greatly appreciated.
Try setting `kern.timecounter.hardware' to the next best time source `hpet0',
or run without `-accel=nvmm' (and turn off TSC with `-cpu qemu64,-tsc').
You could also try compiling the host kernel to run with a higher HZ, like 1000.
-RVP