From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=36731 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHllg-0001zg-3h for qemu-devel@nongnu.org; Thu, 27 May 2010 18:41:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHlQo-0001jU-SW for qemu-devel@nongnu.org; Thu, 27 May 2010 18:20:03 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:36340) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHlQo-0001jI-Eo for qemu-devel@nongnu.org; Thu, 27 May 2010 18:20:02 -0400 Message-ID: <4BFEF010.50300@web.de> Date: Fri, 28 May 2010 00:20:00 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4BFE8F13.2000009@cs.vu.nl> <4BFEBF9E.90600@web.de> <4BFECCC3.2000806@cs.vu.nl> In-Reply-To: <4BFECCC3.2000806@cs.vu.nl> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig19BFB221BE35C899B29B62C0" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: SVM emulation: EVENTINJ marked valid when a pagefault happens while issuing a software interrupt List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Erik van der Kouwe Cc: Joerg Roedel , qemu-devel@nongnu.org, Gleb Natapov This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig19BFB221BE35C899B29B62C0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Erik van der Kouwe wrote: > Hi, >=20 >> Be warned: Though my experience is already more than a year old, the S= VM >> emulation in QEMU is most probably not yet rock-stable. Always check >> suspicious behavior against real hardware and/or the spec. [ As real >> hardware is everywhere, nesting works with KVM+SVM and is much faster,= >> motivation to improve QEMU in this area is unfortunately limited. ] >=20 > Problem is: I'm compiling in Linux and testing in MINIX. Testing on the= > real hardware would require a reboot everytime. Moreover, it might scre= w > up my system if I make bad mistakes (the MINIX filesystem is easily > corrupted). Use Linux+KVM as host OS, it can also run VMMs as guests (aka nested SVM). And you could even debug those guests just like when you would run QEMU in emulation mode. In contrast to SVM emulation, nesting is fairly stable AFAIK. And it is faster. >=20 > That said, I do aim to eventually test the real hardware. Plenty of > virtualization capable hardware where I work, although unfortunately al= l > Intel. >=20 >>> This issue is easy to work around by clearing the EVENTINJ field on e= ach >>> #VMEXIT (and I have submitted a patch to that effect to the Palacios >>> people) and this approach is also found in KVM. >> >> /me does not find such clearing in KVM - what line(s) are you looking = at? >=20 > Linux source tree (2.6.31-ubuntu), arch/x86/kvm/svm.c, end of function > nested_svm_vmrun. Here event_inj and event_inj_err are copied from a > different VMCB, effectively clearing the value set by the CPU. Maybe > this isn't were I should have been looking though? Yep. This is the path taken for injecting events when switching from level-1 to level-2 guests, i.e. you are running some VMM inside KVM. >=20 >>> The relevant code is in target-i386/op_helper.c. The "handle_even_inj= " >>> function sets the EVENTINJ field (called event_inf in the QEMU code) = and >>> the helper_vmexit function copies that field into EXITINTINFO >>> (exit_int_info in the QEMU code). I believe (but once again, am not >>> certain) that the SVM documentation only says that this information >>> should be stored in EXITINTINFO. >> >> Yes, this also looks suspicious. handle_even_inj should not push the >> real (level 1) event to be injected into event_inj[_err] but into >> exit_int_info[_err] or some temporary fields from which the exit info = is >> then loaded later on. >=20 > Yes, if this is indeed incorrect behaviour then this is what I would > expect a fix to be like. >=20 > Thanks again, > Erik Jan --------------enig19BFB221BE35C899B29B62C0 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 iEYEARECAAYFAkv+8BAACgkQitSsb3rl5xRgKACfeRhuw/Z1+zX0of46Ddu4riQI ZoYAoMrUktiRw+qvekqAnIOtV/vFV3Xu =Z6dH -----END PGP SIGNATURE----- --------------enig19BFB221BE35C899B29B62C0--