From owner-freebsd-current@freebsd.org Sun Oct 22 15:22:20 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BC5CE54BEA; Sun, 22 Oct 2017 15:22:20 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30FEC69DC7; Sun, 22 Oct 2017 15:22:19 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v9MFMHwG039119; Sun, 22 Oct 2017 08:22:17 -0700 (PDT) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v9MFMGi6039118; Sun, 22 Oct 2017 08:22:16 -0700 (PDT) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201710221522.v9MFMGi6039118@pdx.rh.CN85.dnsmgr.net> Subject: Re: host, bhyve vm and ntpd In-Reply-To: <6dc189a0-e7bc-6c3b-2be6-80154e7ece42@passap.ru> To: Boris Samorodov Date: Sun, 22 Oct 2017 08:22:16 -0700 (PDT) CC: Ian Lepore , Michael Voorhis , freebsd-current@freebsd.org, freebsd-virtualization@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Mailman-Approved-At: Sun, 22 Oct 2017 18:32:47 +0000 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 15:22:20 -0000 [ Charset UTF-8 unsupported, converting... ] > 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've tried the patch (at bhyve guest) and nothing has changed. Should > the patched system be tested at bhyve guest or bhyve host? I believe the suggested patch would have to be made to the bhyve host. Also on the host and guest what are the values of sysctl kern.timecounter.tc.HPET sysctl kern.timecounter.tc.i8254 Getting good ntpd behavior in a VM guest of any kind is sometimes a non trivial thing to do. -- Rod Grimes rgrimes@freebsd.org