From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] KVM: nVMX: Reset RFLAGS on VM-exit Date: Sun, 03 Mar 2013 20:23:26 +0100 Message-ID: <5133A32E.4010301@web.de> References: <51333CDC.4040609@web.de> <20130303191505.GA32596@fermat.math.technion.ac.il> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2NNBREJUONOGGPJOBJNXH" Cc: Gleb Natapov , Marcelo Tosatti , kvm , "Nakajima, Jun" To: Nadav Har'El Return-path: Received: from mout.web.de ([212.227.17.11]:58198 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753506Ab3CCTXh (ORCPT ); Sun, 3 Mar 2013 14:23:37 -0500 In-Reply-To: <20130303191505.GA32596@fermat.math.technion.ac.il> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2NNBREJUONOGGPJOBJNXH Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2013-03-03 20:15, Nadav Har'El wrote: > On Sun, Mar 03, 2013, Jan Kiszka wrote about "[PATCH] KVM: nVMX: Reset = RFLAGS on VM-exit": >> From: Jan Kiszka >> >> Ouch, how could this work so well that far? We need to clear RFLAGS to= >> the reset value as specified by the SDM. Particularly, IF must be off >> after VM-exit! >=20 > nested_vmx_succeed() or nested_vmx_fail*() were already clearing some o= f > the fields that I understood was necessary to clear. But they did not c= lear > the IF - I never realised (and didn't verify now) that this is part of = the > spec. And since L1 KVM anyways enters L2 with interrupts disabled, nest= ed KVM > would not see a difference. But we didn't restore rflags on vmexit either, we reused the guest value for L1. It was pure luck (and due to KVM's short IRQ-off phase after vmexit) when things worked. But I bet this should fix some spurious issue= s. >=20 >> + vmx_set_rflags(vcpu, 0x02); >=20 > There's a macro X86_EFLAGS_BIT1 which you can use for this 0x02. Ah, good to know. Checked vmx_vcpu_reset and found this value. Jan ------enig2NNBREJUONOGGPJOBJNXH 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/ iEYEARECAAYFAlEzozIACgkQitSsb3rl5xStaACbBNa1XQqbEpHJDx9pPl6fM2+W cEkAmwSpGq4aLwiufEi41XbMAGej9obj =njQa -----END PGP SIGNATURE----- ------enig2NNBREJUONOGGPJOBJNXH--