From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] KVM: nVMX: Replace kvm_set_cr0 with vmx_set_cr0 in load_vmcs12_host_state Date: Sun, 24 Feb 2013 10:40:44 +0100 Message-ID: <5129E01C.8020203@web.de> References: <5129361A.7090608@web.de> <20130223214503.GA13800@fermat.math.technion.ac.il> <51293B48.6070108@web.de> <5129D6CE.5030807@web.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2AWBWVWDQJUXEVLUVWASN" Cc: Nadav Har'El , Marcelo Tosatti , Gleb Natapov , kvm , "Nakajima, Jun" To: Avi Kivity Return-path: Received: from mout.web.de ([212.227.17.11]:62293 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752435Ab3BXJkt (ORCPT ); Sun, 24 Feb 2013 04:40:49 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2AWBWVWDQJUXEVLUVWASN Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2013-02-24 10:21, Avi Kivity wrote: > On Sun, Feb 24, 2013 at 11:01 AM, Jan Kiszka wrote:= >> On 2013-02-24 09:56, Avi Kivity wrote: >>> On Sat, Feb 23, 2013 at 11:57 PM, Jan Kiszka wrot= e: >>>> On 2013-02-23 22:45, Nadav Har'El wrote: >>>>> On Sat, Feb 23, 2013, Jan Kiszka wrote about "[PATCH] KVM: nVMX: Re= place kvm_set_cr0 with vmx_set_cr0 in load_vmcs12_host_state": >>>>>> - kvm_set_cr0(vcpu, vmcs12->host_cr0); >>>>>> + vmx_set_cr0(vcpu, vmcs12->host_cr0); >>>>> >>>>> I don't remember now why I did this (and I'm not looking at the cod= e), >>>>> but this you'll need to really test carefully, including >>>>> shadow-on-shadow mode (ept=3D0 in L0), to verify you're not missing= any >>>>> important side-effect of kvm_set_cr0. >>>>> >>>>> Also, if I remember correctly, during nVMX's review, Avi Kivity ask= ed >>>>> in several places that when I called vmx_set_cr0, I should instead = call >>>>> kvm_set_cr0(), because it does some extra stuff and does some extra= >>>>> checks. Hmm, see, see this: >>>>> http://markmail.org/message/hhidqyhbo2mrgxxc >>>>> >>>>> where Avi asked for the reverse patch you're attempting now. >>>> >>>> At least, kvm_set_cr0 can't be used as it assumes an otherwise >>>> consistent guest state and an explicitly initiated transition - whic= h is >>>> naturally not the case while emulating a vmexit. >>> >>> We have the same problem in KVM_SET_SREGS. >> >> I don't see the problem. kvm_arch_vcpu_ioctl_set_sregs open-codes the >> state update, not applying any transition checks. >=20 > That's the problem. We have this open coding in three different > places (KVM_SET_SREGS, nvmx, nsvm). >=20 > It's not as if vmx_set_cr0() is defined as "kvm_set_cr0() without the > transition checks". =2E..and without mmu updates. The latter is done via or after the closing= cr3 update. Interestingly, nsvm does not perform kvm_set_cr3 on vmexit when in npt mode. Seems things aren't that regular. Jan ------enig2AWBWVWDQJUXEVLUVWASN 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/ iEYEARECAAYFAlEp4BwACgkQitSsb3rl5xQnGACcDa5EQQRt1kCzPntQEuqCawaz srsAoN3Cx3WaO5j/Lo6y9FBm/pPqjns0 =lhnA -----END PGP SIGNATURE----- ------enig2AWBWVWDQJUXEVLUVWASN--