From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [patch 1/2] KVM: x86: handle double and triple faults for every exception Date: Wed, 11 Nov 2009 22:02:19 +0100 Message-ID: <4AFB265B.9030506@web.de> References: <20091111192947.348198723@localhost.localdomain> <20091111193837.115825934@localhost.localdomain> <4AFB196C.7010302@web.de> <20091111204107.GA14011@amt.cnet> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig315260677D10BA2E830F746A" Cc: kvm@vger.kernel.org, gleb@redhat.com, jan.kiszka@siemens.com, joerg.roedel@amd.com To: Marcelo Tosatti Return-path: Received: from fmmailgate01.web.de ([217.72.192.221]:57573 "EHLO fmmailgate01.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758868AbZKKVCL (ORCPT ); Wed, 11 Nov 2009 16:02:11 -0500 In-Reply-To: <20091111204107.GA14011@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig315260677D10BA2E830F746A Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Marcelo Tosatti wrote: > On Wed, Nov 11, 2009 at 09:07:08PM +0100, Jan Kiszka wrote: >> Marcelo Tosatti wrote: >>> From: Joerg Roedel >>> >>> The current KVM x86 exception code handles double and triple faults o= nly for >>> page fault exceptions. This patch extends this detection for every ex= ception >>> that gets queued for the guest. >>> >>> Signed-off-by: Joerg Roedel >>> CC: Jan Kiszka >> For a moment I felt like I was time traveling - back in '08. :) >> >> Reading the archive I noticed that someone posted a fix-up for this pa= tch: >> >> http://permalink.gmane.org/gmane.comp.emulators.kvm.devel/16931 >> >> Why don't we need this anymore? >=20 > I suppose qemu-kvm's call to set_sregs (via system_reset) will end up > clearing pending exception? Right, forgot for the moment that triple fault implies user space. >=20 >> Moreover, are we sure to not regress /wrt to the cases that shall be >> handled serially? So far they should have triggered the WARN_ON, right= ? >=20 > Right.=20 >=20 > How can it regress though, given that serially handled exceptions are > not supported at the moment (you get a WARN_ON and lose the previously > queued anyway). The guest so far sees the second exception as the result, now it sees DF. So the behavior changes from broken to broken, but I wondered if the current state is already so broken that this change doesn't matter. Another micro difference is this: > @@ -184,24 +196,6 @@ void kvm_inject_page_fault(struct kvm_vc > { > ++vcpu->stat.pf_guest; > =20 > - if (vcpu->arch.exception.pending) { > - switch(vcpu->arch.exception.nr) { > - case DF_VECTOR: > - /* triple fault -> shutdown */ > - set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests); > - return; > - case PF_VECTOR: > - vcpu->arch.exception.nr =3D DF_VECTOR; > - vcpu->arch.exception.error_code =3D 0; > - return; > - default: > - /* replace previous exception with a new one in a hope > - that instruction re-execution will regenerate lost > - exception */ > - vcpu->arch.exception.pending =3D false; > - break; > - } > - } > vcpu->arch.cr2 =3D addr; > kvm_queue_exception_e(vcpu, PF_VECTOR, error_code); > } So far cr2 was not touched on DF, now it is. Jan --------------enig315260677D10BA2E830F746A 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.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkr7Jl8ACgkQitSsb3rl5xSEUgCeL5YYZO+0YjNSZsENoUj3toRP 9M0AoNvPYVGC1VY1arXQr3hM0SQMIXdU =6Knu -----END PGP SIGNATURE----- --------------enig315260677D10BA2E830F746A--