Re: host, bhyve vm and ntpd

From: Ian Lepore <ian_at_freebsd.org>
Date: Tue, 24 Oct 2017 16:14:08 -0600
On Wed, 2017-10-25 at 00:43 +0300, Boris Samorodov wrote:
> Hi Ian, All!
> 
> 22.10.2017 01:15, Ian Lepore ĐÉŰĹÔ:
> > 
> > On Sat, 2017-10-21 at 17:07 -0400, Michael Voorhis wrote:
> > > 
> > > Ian Lepore writes:
> > > > 
> > > > 
> > > > Beyond that, I'm not sure what else to try. šIt might be necessary to
> > > > get some bhyve developers involved (I know almost nothing about it).
> > > NTPD behaves more normally on uniprocessor VMs.
> > > 
> > > A FreeBSD bhyve-guest running on a freebsd host will select a
> > > different timecounter depending on whether it is a multiprocessor or a
> > > uniprocessor.ššMy uniprocessor bhyve-vm selected TSC-low as the best
> > > timecounter in a uniprocessor.ššNTP functions there as expected.
> > > 
> > > kern.timecounter.choice: TSC-low(1000) ACPI-fast(900) HPET(950) i8254(0) dummy(-1000000)
> > > kern.timecounter.hardware: TSC-low
> > > 
> > > The very same VM, when given two total CPUs, selected HPET (if I
> > > recall) and the timekeeping with NTPD was unreliable, with many
> > > step-resets to the clock.
> > > 
> > Hmm, I just had glance at the code inšsys/amd64/vmm/io/vhpet.c and it
> > looks right. šI wonder if this is just a simple roundoff error in
> > converting between 10.0MHz and SBT units? šIf so, that could be wished
> > away easily by using a power-of-2 frequency for the virtual HPET. šI
> > wonder if the attached patch is all that's needed?
> I suppose the answer is "yes", the patch helped. Here are two samples
> (host for bhyve VM without your patch and after patching):
> ---
> https://poudriere.passap.ru/misc/ntpd.jot.log-HPET.frequency.10000000.txt
> https://poudriere.passap.ru/misc/ntpd.jot.log-HPET.frequency.16777216.txt
> ---
> 
> The command was:
> % for t in `jot 1000`; do ntpq -pn; sleep 64; done
> 
> The patch made the system to stabilize the process.
> Ian, thank you!
> 

Hmmm. šThe startup behavior wasn't great, it took a long time and
several clock steps for it to figure out the frequency error and get
the clock under control. šBut, as you say, it did eventually stabilize
this time.

Can you show the /var/db/ntpd.drift file contents of the host and
guest? šIdeally, now that it's stable, the two values should be very
close. šIf they're not, maybe this isn't the right fix.

-- Ian
Received on Tue Oct 24 2017 - 20:14:11 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:13 UTC