From mboxrd@z Thu Jan 1 00:00:00 1970 From: Athanasius Subject: Re: Synchronized time with kvm_clock Date: Mon, 26 Apr 2010 17:43:27 +0100 Message-ID: <20100426164327.GC25799@miggy.org> References: <201004261133.06491.alex@speakup.nl> <201004261201.38221.alex@speakup.nl> <4BD5A413.50709@carbonmountain.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CblX+4bnyfN0pR09" Cc: Alex Hermann , kvm@vger.kernel.org To: John Buswell Return-path: Received: from lake.fysh.org ([81.94.195.195]:50190 "EHLO lake.fysh.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753673Ab0DZQn2 (ORCPT ); Mon, 26 Apr 2010 12:43:28 -0400 Content-Disposition: inline In-Reply-To: <4BD5A413.50709@carbonmountain.com> Sender: kvm-owner@vger.kernel.org List-ID: --CblX+4bnyfN0pR09 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 26, 2010 at 10:32:51AM -0400, John Buswell wrote: > You don't need to run ntp on each guest. You can enable rtc support in = =20 > the guest kernel and on the hypervisor. Run ntp client on the hypervisor = =20 > via cron, and use hwclock -w on the hypervisor after you run ntp, to =20 > sync the hardware clock to the system clock (which is now updated by =20 > ntpdate). On the guests, periodically run hwclock -s to set the system = =20 > clock from the hw clock. What a *horribly* hacky way to do it, meaning you'll get time warps all over the place, admittedly of short intervals if you run those cron jobs often enough. It seems much simpler to me to simply run ntpd in all the guests. It's not like the extra CPU or bandwidth is going to be a problem. At the very least you want to run ntpd, not ntpdate out of cron, in the hypervisor, and only use cron for those hwclock -w's. > This seems to work extremely well, the clocksource on the guests as =20 > kvm_clock, and as long as you have the clocksource as hpet or acpi_pm on = =20 > the hypervisor, there doesn't seem to be any problems with keeping time. > > The only thing I've noticed is that when you reboot, the very first =20 > guest will have the wrong time on boot, so the uptime is messed up. And I think many people would find this unacceptable. Really, I appreciate that "keep the time sync'd via ntpd on the hypervisor and have it passed accurately to the guests" has a certain elegant simplicity about it. But if you achieve the latter by periodically resyncing against what the guest sees as its hardware clock you've lost that elegance again. It really needs to 'just work' via KVM code in the guest kernel using the exact same time as the hypervisor kernel is supplying. --=20 - Athanasius =3D Athanasius(at)miggy.org / http://www.miggy.org/ Finger athan(at)fysh.org for PGP key "And it's me who is my enemy. Me who beats me up. Me who makes the monsters. Me who strips my confidence." Paula Cole - ME --CblX+4bnyfN0pR09 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkvVwq4ACgkQSEDmQuIYzh1BPgCcCBADN5KHMidsM+wmcLpAwxiJ 3O8An1J3zqJ2rMcJNRlI0qWDta0fD4MY =4eSt -----END PGP SIGNATURE----- --CblX+4bnyfN0pR09--