From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH v5] KVM: nVMX: Fully support of nested VMX preemption timer Date: Wed, 02 Oct 2013 20:47:12 +0200 Message-ID: <524C6A30.9090403@web.de> References: <1379319104-10266-1-git-send-email-yzt356@gmail.com> <52444CF6.1020102@redhat.com> <52493F8C.6040009@web.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Po2SIeeG8mGt6ccSfuEsAKe3EPATpgGTj" Cc: Arthur Chunqi Li , kvm@vger.kernel.org, gleb@redhat.com, "Zhang, Yang Z" To: Paolo Bonzini Return-path: Received: from mout.web.de ([212.227.17.12]:57880 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753602Ab3JBSr3 (ORCPT ); Wed, 2 Oct 2013 14:47:29 -0400 Received: from mchn199C.mchp.siemens.de ([95.157.58.223]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0LxfGh-1VuuJw2Nyd-017Cas for ; Wed, 02 Oct 2013 20:47:28 +0200 In-Reply-To: <52493F8C.6040009@web.de> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Po2SIeeG8mGt6ccSfuEsAKe3EPATpgGTj Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2013-09-30 11:08, Jan Kiszka wrote: > On 2013-09-26 17:04, Paolo Bonzini wrote: >> Il 16/09/2013 10:11, Arthur Chunqi Li ha scritto: >>> This patch contains the following two changes: >>> 1. Fix the bug in nested preemption timer support. If vmexit L2->L0 >>> with some reasons not emulated by L1, preemption timer value should >>> be save in such exits. >>> 2. Add support of "Save VMX-preemption timer value" VM-Exit controls >>> to nVMX. >>> >>> With this patch, nested VMX preemption timer features are fully >>> supported. >>> >>> Signed-off-by: Arthur Chunqi Li >>> --- >>> ChangeLog to v4: >>> Format changes and remove a flag in nested_vmx. >>> arch/x86/include/uapi/asm/msr-index.h | 1 + >>> arch/x86/kvm/vmx.c | 44 +++++++++++++++++++++++= ++++++++-- >>> 2 files changed, 43 insertions(+), 2 deletions(-) >> >> Hi all, >> >> the test fails for me if the preemption timer value is set to a value >> that is above ~2000 (which means ~65000 TSC cycles on this machine). >> The preemption timer seems to count faster than what is expected, for >> example only up to 4 million cycles if you set it to one million. >> So, I am leaving the patch out of kvm/queue for now, until I can >> test it on more processors. >=20 > I've done some measurements with the help of ftrace on the time it take= s > to let the preemption timer trigger (no adjustments via Arthur's patch > were involved): On my Core i7-620M, the preemption timer seems to tick > almost 10 times faster than spec and scale value (5) suggests. I've > loaded a value of 100000, and it took about 130 =B5s until I got a vmex= it > with reason PREEMPTION_TIMER (no other exists in between). >=20 > qemu-system-x86-13765 [003] 298562.966079: bprint: prepa= re_vmcs02: preempt val 100000 > qemu-system-x86-13765 [003] 298562.966083: kvm_entry: vcpu = 0 > qemu-system-x86-13765 [003] 298562.966212: kvm_exit: reaso= n PREEMPTION_TIMER rip 0x401fea info 0 0 >=20 > That's a frequency of ~769 MHz. The TSC ticks at 2.66 GHz. But 769 MHz = * > 2^5 is 24.6 GHz. I've read the spec several times, but it seems pretty > clear on this. It just doesn't match reality. Very strange. =2E..but documented: I found an related errata for my processor (AAT59) and also for Xeon 5500 (AAK139). At least current Haswell generation is no affected. I can test the patch on a Haswell board I have at work later this week. Jan --Po2SIeeG8mGt6ccSfuEsAKe3EPATpgGTj 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.16 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlJMajMACgkQitSsb3rl5xSnngCfbpRU3NMGCW8amQpwGr2SxhKJ tVgAn1qbqEe9DK5++82CIrefqdJCdZvM =pDta -----END PGP SIGNATURE----- --Po2SIeeG8mGt6ccSfuEsAKe3EPATpgGTj--