From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:52466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3Mot-0000j1-VV for qemu-devel@nongnu.org; Tue, 13 Sep 2011 02:50:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3Mos-0001mL-PA for qemu-devel@nongnu.org; Tue, 13 Sep 2011 02:50:11 -0400 Received: from mail.univention.de ([82.198.197.8]:2358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3Mos-0001lj-G5 for qemu-devel@nongnu.org; Tue, 13 Sep 2011 02:50:10 -0400 From: Philipp Hahn Date: Tue, 13 Sep 2011 08:49:55 +0200 References: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2707810.ZTFJKPr0uv"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201109130850.00106.hahn@univention.de> Subject: Re: [Qemu-devel] Question on kvm_clock working ... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: al pat --nextPart2707810.ZTFJKPr0uv Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello Al, I just debugged a kvmclock bug, so I claim to have some knowledge in this a= rea=20 now, but please take my answer with a grain of doubt. On Monday 12 September 2011 15:21:25 al pat wrote: > Still seeking your guidance on this. Appreciate any pointers you may have. You have to distiguish between the real-time-clock (RTC), which in hardware= is=20 a battery powered clock running even when your PC is powered off. Since it'= s=20 slow to access, most Linux distributions read out its value once during boo= t=20 using "hwclock --hctosys --utc" and than don't care about that clock any mo= re=20 until shutdown, when they write back the system time to the RTC=20 using "... --systohc ...". During runtime, other methods are used for time keeping: Either by counting= =20 regular interrupts, using the ACPI-PM clock, or the High Performance Event= =20 Timer (HPET), or the Time Stamp Counter (TSC) register, or ...;=20 see /sys/devices/system/clocksource/clocksource0/available_clocksource for = a=20 list of available clock sources. =46or virtual machines there is an additional clock source named "kvmclock"= ,=20 which uses the host clock and the TSC: The host exports its current system= =20 time (plus some configurable offset) and a snapshot value of TSC register=20 when doing so. Than the guest can interpolate the current time by using the= =20 exported_system_time + scale * (current_TSC_value-snapshot_TSC_value). This= =20 kvmclock doesn't have anything to do with the RTC clock as far as I know. Now to your problem: You should check the value=20 of /sys/devices/system/clocksource/clocksource0/current_clocksource in your= =20 guest. If it is somethong other than kvmclock, you should if=20 using "hwclock --hctosys --utc" re-synchronizes your guest clock to the hos= t. Sincerely Philipp =2D-=20 Philipp Hahn Open Source Software Engineer hahn@univention.de Univention GmbH Linux for Your Business fon: +49 421 22 232- 0 Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99 http://www.univention.de/ =2D------------------------------------------------------------------------= =2D-- Treffen Sie Univention auf der IT&Business vom 20. bis 22. September 2011 auf dem Gemeinschaftsstand der Open Source Business Alliance in Stuttgart in Halle 3 Stand 3D27-7. --nextPart2707810.ZTFJKPr0uv Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAk5u/RMACgkQYPlgoZpUDjnCwgCeJOWyAephRkUDRGlFulOMpl3v S8kAnRQaGCZhanDv5EC/HauPqZhMDX7C =Fa6X -----END PGP SIGNATURE----- --nextPart2707810.ZTFJKPr0uv--