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 09:34:35 +0100 Message-ID: <5129D09B.8020801@web.de> References: <5129361A.7090608@web.de> <20130223214503.GA13800@fermat.math.technion.ac.il> <51293B48.6070108@web.de> <512940EC.4090208@web.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2BNWBLTVPHVNQOAIVPEOJ" Cc: Marcelo Tosatti , Gleb Natapov , kvm , "Nakajima, Jun" , avi.kivity@gmail.com To: Nadav Har'El Return-path: Received: from mout.web.de ([212.227.17.12]:52027 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750898Ab3BXIen (ORCPT ); Sun, 24 Feb 2013 03:34:43 -0500 In-Reply-To: <512940EC.4090208@web.de> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2BNWBLTVPHVNQOAIVPEOJ Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2013-02-23 23:21, Jan Kiszka wrote: > On 2013-02-23 22:57, Jan Kiszka wrote: >> On 2013-02-23 22:45, Nadav Har'El wrote: >>> On Sat, Feb 23, 2013, Jan Kiszka wrote about "[PATCH] KVM: nVMX: Repl= ace 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 code)= , >>> but this you'll need to really test carefully, including >>> shadow-on-shadow mode (ept=3D0 in L0), to verify you're not missing a= ny >>> important side-effect of kvm_set_cr0. >>> >>> Also, if I remember correctly, during nVMX's review, Avi Kivity asked= >>> in several places that when I called vmx_set_cr0, I should instead ca= ll >>> 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 - which = is >> naturally not the case while emulating a vmexit. >> >> However, there are some side effects that need a closer look, likely >> also in other places where vmx_set_cr0 is used directly. E.g. >> load_pdptrs. The lack of calling them on host->guest switch may explai= n >> the PAE issues you once saw with your nEPT implementation. >> >> OK, more work... >=20 > Checked again, and the patch should be fine: load_pdptrs is executed by= > kvm_set_cr3 later in this functions (same for prepare_vmcs02, so no > problem for PAE here), kvm_mmu_reset_context is even run explicitly and= > clearing the async-pf queue makes no sense when leaving the guest (the > guest can't use it unless L1 is broken and passes this through). > However, we should clear the queue when leaving the host - separate pat= ch. Thought about the async-pf thing again: It rather looks to me like the host does not have to worry about it at all. It's L1's job to either disable async-pf before entering L2 or trap PFs and handle paravirtual reasons before they hit L2. I don't see that KVM already does this, but I don't think that matters at this point. Jan ------enig2BNWBLTVPHVNQOAIVPEOJ 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/ iEYEARECAAYFAlEp0J8ACgkQitSsb3rl5xRIJgCgv7gTOAuJPD7PCJkcnfjywuDf 210AniTfoVygXAQK52cj0NgX2dgFtdoS =RTHM -----END PGP SIGNATURE----- ------enig2BNWBLTVPHVNQOAIVPEOJ--