From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LvXeE-0001zM-Cl for qemu-devel@nongnu.org; Sun, 19 Apr 2009 10:05:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LvXe8-0001vG-Uv for qemu-devel@nongnu.org; Sun, 19 Apr 2009 10:05:29 -0400 Received: from [199.232.76.173] (port=56794 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LvXe8-0001v9-Q2 for qemu-devel@nongnu.org; Sun, 19 Apr 2009 10:05:24 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:52931) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LvXe8-00056k-4Q for qemu-devel@nongnu.org; Sun, 19 Apr 2009 10:05:24 -0400 Message-ID: <49EB2FA1.2090305@web.de> Date: Sun, 19 Apr 2009 16:05:21 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1239616545-25199-1-git-send-email-gleb@redhat.com> <1239616545-25199-6-git-send-email-gleb@redhat.com> <49E99A7F.7000902@web.de> <20090418162820.GI27675@redhat.com> <20090419135745.GO10126@redhat.com> In-Reply-To: <20090419135745.GO10126@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig41A73519CDF10D5F82209F16" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH 05/15] Coalesce userspace/kernel irqchip interrupt injection logic. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gleb Natapov Cc: kvm@vger.kernel.org, Dmitry Eremin-Solenikov , Joerg Roedel , qemu-devel , Alexander Graf , Avi Kivity This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig41A73519CDF10D5F82209F16 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Gleb Natapov wrote: > On Sat, Apr 18, 2009 at 07:28:20PM +0300, Gleb Natapov wrote: >>> So this patch may either expose a bug in the svm emulation of qemu or= >>> comes with a subtle regression that only triggers due to qemu's timin= g. >>> This needs to be understood. Gleb, any progress on reproducing it on >>> your side? >>> >> I reproduced it and I am debugging it. In my case the boot hangs on st= i;hlt >> sequence. Instrumentation thus far shows that at this point interrupts= no longer >> injected because ppr value is too big. Need to see why, but tpr handli= ng >> is not complete in qemu svm. May be this is the reason. Will know more= >> tomorrow. >> > I've looked into this and my conclusion is that if you are not going to= > develop SVM in qemu don't use it just yet. We had a resource conflict regarding SVM capable AMD boxes and a tight schedule, so we decided to pick qemu as initial development platform. Turns out that this has was a bit too optimistic. :) > QEMU doesn't handle exceptions > during event injection properly. Actually it does not handle it at all,= > so if PF happens during interrupt injection interrupt is lost and, what= > worse, is never acked. If interrupt was high prio it blocks all other > interrupts. >=20 > The patch below adds exception handling during event injection. Valid > flag removed from EVENTINJ only after successful injection and EVENTINJ= > is copied to EXITINTINFO on exit. Can you give it a try? Ah, great, thanks. Will test. >=20 > And this is not the only problem I saw, but the one that caused my gues= t > to hang. OK, good to know. I added Alex (though he's said to be on vacation ATM) and qemu to CC. Maybe you can quickly list the other issues you've stumbled over, for the records and for motivating contributors... >=20 > diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c > index be09263..9264afd 100644 > --- a/target-i386/op_helper.c > +++ b/target-i386/op_helper.c > @@ -1249,6 +1249,10 @@ void do_interrupt(int intno, int is_int, int err= or_code, > } else { > do_interrupt_real(intno, is_int, error_code, next_eip); > } > + if (env->hflags & HF_SVMI_MASK) { > + uint32_t event_inj =3D ldl_phys(env->vm_vmcb + offsetof(struct vm= cb, control.event_inj)); > + stl_phys(env->vm_vmcb + offsetof(struct vmcb, control.event_inj),= event_inj & ~SVM_EVTINJ_VALID); > + } > } > =20 > /* This should come from sysemu.h - if we could include it here... */ > @@ -4994,7 +4998,6 @@ void helper_vmrun(int aflag, int next_eip_addend)= > uint8_t vector =3D event_inj & SVM_EVTINJ_VEC_MASK; > uint16_t valid_err =3D event_inj & SVM_EVTINJ_VALID_ERR; > uint32_t event_inj_err =3D ldl_phys(env->vm_vmcb + offsetof(st= ruct vmcb, control.event_inj_err)); > - stl_phys(env->vm_vmcb + offsetof(struct vmcb, control.event_in= j), event_inj & ~SVM_EVTINJ_VALID); > =20 > qemu_log_mask(CPU_LOG_TB_IN_ASM, "Injecting(%#hx): ", valid_er= r); > /* FIXME: need to implement valid_err */ > @@ -5331,6 +5334,8 @@ void helper_vmexit(uint32_t exit_code, uint64_t e= xit_info_1) > cpu_x86_set_cpl(env, 0); > stq_phys(env->vm_vmcb + offsetof(struct vmcb, control.exit_code), = exit_code); > stq_phys(env->vm_vmcb + offsetof(struct vmcb, control.exit_info_1)= , exit_info_1); > + stl_phys(env->vm_vmcb + offsetof(struct vmcb, control.exit_int_inf= o), ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.event_inj))); > + stl_phys(env->vm_vmcb + offsetof(struct vmcb, control.exit_int_inf= o_err), ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.event_inj_e= rr))); > =20 > env->hflags2 &=3D ~HF2_GIF_MASK; > /* FIXME: Resets the current ASID register to zero (host ASID). */= > -- > Gleb. Thanks again, Jan --------------enig41A73519CDF10D5F82209F16 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 iEYEARECAAYFAknrL6EACgkQniDOoMHTA+nLoACffrALceL+e1jC76i1LD36rCfN jI4An1MEZNFH7OATDfMoaDce1WlOtdGR =ufq3 -----END PGP SIGNATURE----- --------------enig41A73519CDF10D5F82209F16--