On Sun, May 10, 2020 at 03:15:22PM -0000, Christos Zoulas wrote: > In article <20200508220155.446eef...@cvs.netbsd.org>, > Andrew Doran <source-changes-d@NetBSD.org> wrote: > >-=-=-=-=-=- > > > >Module Name: src > >Committed By: ad > >Date: Fri May 8 22:01:55 UTC 2020 > > > >Modified Files: > > src/sys/arch/x86/include: cpu_counter.h > > src/sys/arch/x86/x86: cpu.c tsc.c > > src/sys/dev/ic: hpet.c hpetvar.h > > > >Log Message: > >Fix the TSC timecounter (on the systems I have access to): > > > >- Make the early i8254-based calculation of frequency a bit more accurate. > > > >- Keep track of how far the HPET & TSC advance between HPET attach and > > secondary CPU boot, and use to compute an accurate value before attaching > > the timecounter. Initial idea from joerg@. > > > >- When determining skew and drift between CPUs, make each measurement 1000 > > times and pick the lowest observed value. Increase the error threshold to > > 1000 clock cycles. > > > >- Use the frequency computed on the boot CPU for secondary CPUs too. > > > >- Remove cpu_counter_serializing(). > > The TSC is still faster than it is supposed to be so ntpd does not sync > (it diverges). It is better than before but not good enough to keep time.
I suspect this problem is related to the MSR-based freq determination rather than the calibration so hopefully in combo with msaitoh@'s follow-up change it should be fixed. Andrew