From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [Regression] kvm-userspace: VM freezes after booting FreeDOS Date: Sun, 13 Jul 2008 11:09:10 +0200 Message-ID: <4879C636.30003@web.de> References: <52d4a3890807100847q5aef1a69hbd7179b018cb02ad@mail.gmail.com> <48763963.3010406@codemonkey.ws> <52d4a3890807101252h13c24b0ej35b4af71ac6b5b58@mail.gmail.com> <48766AE0.2050400@codemonkey.ws> <52d4a3890807101332v2cfe5604g78dc2d225e3c67d9@mail.gmail.com> <48767DB3.7090701@web.de> <52d4a3890807101559i408e3d3at8030034e858f0256@mail.gmail.com> <48773BA3.7090900@siemens.com> <52d4a3890807110755j4c501040y4749181ccfc33420@mail.gmail.com> <4878934E.70504@web.de> <4879B4AC.1070809@qumranet.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigCB861EEC4DE9FC647C3332BD" Cc: Mohammed Gamal , Jan Kiszka , Anthony Liguori , kvm@vger.kernel.org, Rik van Riel To: Avi Kivity Return-path: Received: from fmmailgate01.web.de ([217.72.192.221]:60841 "EHLO fmmailgate01.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752415AbYGMJJR (ORCPT ); Sun, 13 Jul 2008 05:09:17 -0400 In-Reply-To: <4879B4AC.1070809@qumranet.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigCB861EEC4DE9FC647C3332BD Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Avi Kivity wrote: > Jan Kiszka wrote: >> It looks like that we should forward all #DB exceptions to the guest i= n >> real mode unless we are sure they were caused by a host-injection. Her= e >> is more or less a hack to achieve this (breaking guest debugging for >> now): >> >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >> index b60fcec..a6f9c9b 100644 >> --- a/arch/x86/kvm/vmx.c >> +++ b/arch/x86/kvm/vmx.c >> @@ -2244,6 +2244,15 @@ static int handle_rmode_exception(struct >> kvm_vcpu *vcpu, >> if (((vec =3D=3D GP_VECTOR) || (vec =3D=3D SS_VECTOR)) && err_cod= e =3D=3D 0) >> if (emulate_instruction(vcpu, NULL, 0, 0, 0) =3D=3D EMULATE_D= ONE) >> return 1; >> + /* >> + * Forward #DB >> + * FIXME: Quick-hack, breaks guest debugging in real mode, will b= e >> + * fixed with the required debugging infrastructure rework= =2E >> + */ >> + if (vec =3D=3D 1) { >> =20 >=20 > DB_VECTOR For sure, just needs a tiny cleanup in svm.c that I had in some other patches. >=20 >> + vmx_inject_irq(vcpu, vec); >> =20 >=20 > kvm_queue_exception() OK. >=20 >> + return 1; >> + } >> return 0; >> } >> =20 >=20 > But it seems the best thing to do is not to trap #DB in > update_exception_bitmap()? Was my first idea as well. I do not understand what is going on there, but when I simply exclude #DB from the exception bitmap in real mode, the problem pops up again: #GP on the instruction that should raise the #= DB. >=20 >> /me now wonders if there are not even more exceptions that have to be >> forwarded. Right now we catch them all, but I did not find some path >> via which actual ones are pushed to the guest. >=20 > Looks like update_exception_bitmap() assumes none. From a cursory look= , > seems like #DE (divide error), #DB, #BP (Breakpoint), #OF (overflow), > #BR (range check) all need to be passed to the guest. Hmm, unless KVM did something to fix up some exception, shouldn't all of them be passed? Jan --------------enigCB861EEC4DE9FC647C3332BD 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 iEYEARECAAYFAkh5xjoACgkQniDOoMHTA+kqngCeO2tOKIltAOEMXSb3GGsDGl3t zrgAnirKebgHHEqT0PB+MdCBXkwtQYX2 =gfY7 -----END PGP SIGNATURE----- --------------enigCB861EEC4DE9FC647C3332BD--