From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MAJVp-0008G3-Lk for qemu-devel@nongnu.org; Sat, 30 May 2009 04:01:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MAJVl-0008EG-9w for qemu-devel@nongnu.org; Sat, 30 May 2009 04:01:53 -0400 Received: from [199.232.76.173] (port=46305 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MAJVl-0008EC-0u for qemu-devel@nongnu.org; Sat, 30 May 2009 04:01:49 -0400 Received: from mx20.gnu.org ([199.232.41.8]:24782) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MAJVk-0003mM-3i for qemu-devel@nongnu.org; Sat, 30 May 2009 04:01:48 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MAJVj-00029u-Bu for qemu-devel@nongnu.org; Sat, 30 May 2009 04:01:47 -0400 Message-ID: <4A20E7E9.7030400@web.de> Date: Sat, 30 May 2009 10:01:45 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig21E010FF6887B79A4AE49234" Sender: jan.kiszka@web.de Subject: [Qemu-devel] [PATCH] kvm: Fix IRQ injection into full queue List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Avi Kivity , Gleb Natapov , qemu-devel This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig21E010FF6887B79A4AE49234 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable User space may only inject interrupts during kvm_arch_pre_run if ready_for_interrupt_injection is set in kvm_run. But that field is updated on exit from KVM_RUN, so we must ensure that we enter the kernel after potentially queuing an interrupt, otherwise we risk to loose one - like it happens with the current code against latest kernel modules (since kvm-86) that started to queue only a single interrupt. Fix the problem by reordering kvm_cpu_exec. Credits go to Gleb Natapov for analyzing the issue in details. Signed-off-by: Jan Kiszka --- kvm-all.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 0827ae2..dc2ded5 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -564,14 +564,13 @@ int kvm_cpu_exec(CPUState *env) dprintf("kvm_cpu_exec()\n"); =20 do { - kvm_arch_pre_run(env, run); - if (env->exit_request) { dprintf("interrupt exit requested\n"); ret =3D 0; break; } =20 + kvm_arch_pre_run(env, run); ret =3D kvm_vcpu_ioctl(env, KVM_RUN, 0); kvm_arch_post_run(env, run); =20 --------------enig21E010FF6887B79A4AE49234 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 iEYEARECAAYFAkog5+kACgkQniDOoMHTA+mUTACfeu96BUbsVGSXRU1GmsTlbLNC yIwAn3bhljnuzCsh8p9X8OGvWMbkWOvC =GeZ7 -----END PGP SIGNATURE----- --------------enig21E010FF6887B79A4AE49234--