From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Vivier Subject: Re: [PATCH 0/5] Split the emulator: decode & execute Date: Tue, 18 Sep 2007 09:40:42 +0200 Message-ID: <46EF80FA.1070201@bull.net> References: <46D5A151.80000@bull.net> <46E3E3D4.1050206@qumranet.com> <46EAB36E.2060004@bull.net> <46EABD97.5060503@qumranet.com> <46EEA801.20404@bull.net> <46EEB971.9000507@qumranet.com> <46EED091.2090404@bull.net> <46EED2A2.8090803@qumranet.com> <46EEDC92.80304@bull.net> <46EF695D.1020203@qumranet.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1560398309==" Cc: kvm-devel To: Avi Kivity Return-path: In-Reply-To: <46EF695D.1020203-atKUWr5tajBWk0Htik3J/w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --===============1560398309== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigF9C343CADFB36514C36D19C9" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF9C343CADFB36514C36D19C9 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Avi Kivity wrote: > Laurent Vivier wrote: >> Avi Kivity wrote: >> =20 >>> Laurent Vivier (Bull) wrote: >>> =20 >>>>> Not being able to emulate is sometimes legitimate. In the case of >>>>> writing to a write-protected guest page table, we simply >>>>> un-write-protect it and go back to the guest (which should now exec= ute >>>>> the instruction natively). >>>>> >>>>> Perhaps the logic that deals with this (the call to >>>>> kvm_mmu_unprotect_page_virt() in emulate_instruction()) was broken = by >>>>> your changes. >>>>> >>>>> =20 >>>> In fact this case is managed in the error cases of >>>> emulate_instruction(). My first patch removes this management for >>>> instruction decoding because I supposed it cannot generate such erro= rs. >>>> So what I proposed in my last email seems to be the good solution : >>>> >>>> emulate_instruction() >>>> ... >>>> r =3D x86_decode_insn(&vcpu->emulate_ctxt, &emulate_ops); >>>> if (r =3D=3D 0) >>>> r =3D x86_emulate_insn(&vcpu->emulate_ctxt, >>>> &emulate_ops); >>>> ... >>>> if (r) { >>>> if (kvm_mmu_unprotect_page_virt(vcpu, cr2)) >>>> return EMULATE_DONE; >>>> if (!vcpu->mmio_needed) { >>>> kvm_report_emulation_failure(vcpu, "mmio"); >>>> return EMULATE_FAIL; >>>> } >>>> return EMULATE_DO_MMIO; >>>> } >>>> ... >>>> >>>> =20 >>> Yes. But pushing the kvm_mmu_unprotect_page() to immediately after >>> the decode stage may be better. >>> >>> =20 >> >> OK, but is this the only error case we can have in the decode stage ? >> =20 >=20 > Decode can actually have fetch faults in smp (due to the instruction > lengthening during decode, or due to the page tables changing with > npt/ept). >=20 > I think these are the only two errors possible for decode: can't decode= > and can't fetch. >=20 >> Should we remove it from after the emulate stage ? >> >> =20 >=20 > Instruction execution shouldn't cause decode failures, so yes, that > error shouldn't be emitted there. >=20 > But we can defer these fine tunings until later. Let's merge something > that works first. Agree, I think it is better to merge something close to the original beha= vior before improving it. I try to post patches today. Laurent --=20 ------------- Laurent.Vivier-6ktuUTfB/bM@public.gmane.org -------------- "Software is hard" - Donald Knuth --------------enigF9C343CADFB36514C36D19C9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.7 (GNU/Linux) iD8DBQFG74D99Kffa9pFVzwRAgL6AKDLx+bSigatNHZhb+Dr0xf0YnnsjwCgu+R1 yDEvl5Ns2H5Kv7yjWcU9bXo= =8OHK -----END PGP SIGNATURE----- --------------enigF9C343CADFB36514C36D19C9-- --===============1560398309== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ --===============1560398309== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --===============1560398309==--