From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGyej-0005TA-8w for qemu-devel@nongnu.org; Wed, 17 Jun 2009 13:10:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGyeY-0005Fu-NV for qemu-devel@nongnu.org; Wed, 17 Jun 2009 13:10:32 -0400 Received: from [199.232.76.173] (port=54835 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGyeW-0005FG-ST for qemu-devel@nongnu.org; Wed, 17 Jun 2009 13:10:25 -0400 Received: from mx2.redhat.com ([66.187.237.31]:35961) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MGyeV-0007yg-2u for qemu-devel@nongnu.org; Wed, 17 Jun 2009 13:10:23 -0400 From: Glauber Costa Date: Wed, 17 Jun 2009 13:10:02 -0400 Message-Id: <1245258604-2843-14-git-send-email-glommer@redhat.com> In-Reply-To: <1245258604-2843-13-git-send-email-glommer@redhat.com> References: <1245258604-2843-1-git-send-email-glommer@redhat.com> <1245258604-2843-2-git-send-email-glommer@redhat.com> <1245258604-2843-3-git-send-email-glommer@redhat.com> <1245258604-2843-4-git-send-email-glommer@redhat.com> <1245258604-2843-5-git-send-email-glommer@redhat.com> <1245258604-2843-6-git-send-email-glommer@redhat.com> <1245258604-2843-7-git-send-email-glommer@redhat.com> <1245258604-2843-8-git-send-email-glommer@redhat.com> <1245258604-2843-9-git-send-email-glommer@redhat.com> <1245258604-2843-10-git-send-email-glommer@redhat.com> <1245258604-2843-11-git-send-email-glommer@redhat.com> <1245258604-2843-12-git-send-email-glommer@redhat.com> <1245258604-2843-13-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH 13/15] kvm: Fix IRQ injection into full queue List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jan Kiszka , aliguori@us.ibm.com, Jan Kiszka From: Jan Kiszka 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 Signed-off-by: Anthony Liguori Signed-off-by: Glauber Costa --- kvm-all.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 541b200..8e72c6d 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -451,14 +451,13 @@ int kvm_cpu_exec(CPUState *env) dprintf("kvm_cpu_exec()\n"); do { - kvm_arch_pre_run(env, run); - if (env->exit_request) { dprintf("interrupt exit requested\n"); ret = 0; break; } + kvm_arch_pre_run(env, run); ret = kvm_vcpu_ioctl(env, KVM_RUN, 0); kvm_arch_post_run(env, run); -- 1.6.2.2