From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 3/6] KVM: X86: Make tsc_delta calculation a function of guest tsc Date: Tue, 19 Apr 2011 08:49:46 +0200 Message-ID: <4DAD308A.3090503@web.de> References: <1301042691-22929-1-git-send-email-joerg.roedel@amd.com> <1301042691-22929-4-git-send-email-joerg.roedel@amd.com> <4DA9BF2D.7010804@web.de> <20110417120656.GT18463@8bytes.org> <4DACD11B.4080200@redhat.com> <20110419064601.GM2192@amd.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig87A6214B1F95E9F6F3E312EF" Cc: Zachary Amsden , Joerg Roedel , Avi Kivity , Marcelo Tosatti , "kvm@vger.kernel.org" To: "Roedel, Joerg" Return-path: Received: from fmmailgate02.web.de ([217.72.192.227]:52707 "EHLO fmmailgate02.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751889Ab1DSGtx (ORCPT ); Tue, 19 Apr 2011 02:49:53 -0400 In-Reply-To: <20110419064601.GM2192@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig87A6214B1F95E9F6F3E312EF Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-04-19 08:46, Roedel, Joerg wrote: > On Mon, Apr 18, 2011 at 08:02:35PM -0400, Zachary Amsden wrote: >>> >>> On Sat, Apr 16, 2011 at 06:09:17PM +0200, Jan Kiszka wrote: >>> =20 >>>> On 2011-03-25 09:44, Joerg Roedel wrote: >>>> =20 >>> =20 >>>>> + tsc_delta =3D !vcpu->arch.last_guest_tsc ? 0 : >>>>> + tsc - vcpu->arch.last_guest_tsc; >>>>> =20 >>> =20 >>>> This patch appears to cause troubles to Linux guests on TSC clocksou= rce >>>> and APIC highres timer. The first boot after qemu start is always fi= ne, >>>> but after a reboot the guest timer appears to fire incorrectly or ev= en >>>> not at all. >>>> >>>> Was this patch tested with a guest reboot scenario as well? Does it >>>> account for the TSC being reset to 0 on reboot? >>>> =20 >>> Hmm, probably the last_guest_tsc is not updated correctly in this >>> scenario. I will have a look tomorrow. >>> >>> Joerg >>> >>> =20 >> >> To avoid this problem, when the TSC is reset, the overshoot protection= =20 >> where last_guest_tsc is used is specifically disabled: >> >> /* Reset of TSC must disable overshoot protection below */ >> vcpu->arch.hv_clock.tsc_timestamp =3D 0; >> vcpu->arch.last_tsc_write =3D data; >> vcpu->arch.last_tsc_nsec =3D ns; >> >> You can probably use the same test - last_guest_tsc is only valid if=20 >> tsc_timestamp above !=3D 0. >=20 > Yes, this should also work. But the other way we get rid of > last_host_tsc which is also a good thing :) That reminds me: I think we still have the bug that KVM overeagerly declares the host's TSC unstable after resume from S3 because the TSC appears to go backward when KVM checks. Or should this have been fixed no= w? Jan --------------enig87A6214B1F95E9F6F3E312EF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk2tMI4ACgkQitSsb3rl5xTpJwCeKalagyZ4v3jkiLr2ZhgBY1uX ScMAnRq29nmSGjTXwfkKnWxDaiSkUsZ1 =ioZp -----END PGP SIGNATURE----- --------------enig87A6214B1F95E9F6F3E312EF--