From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zcby5-0003kE-A7 for qemu-devel@nongnu.org; Thu, 17 Sep 2015 12:23:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zcby4-0006ae-1Z for qemu-devel@nongnu.org; Thu, 17 Sep 2015 12:23:29 -0400 Received: from mail.ispras.ru ([83.149.199.45]:56008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zcby3-0006aR-QZ for qemu-devel@nongnu.org; Thu, 17 Sep 2015 12:23:27 -0400 From: Pavel Dovgalyuk Date: Thu, 17 Sep 2015 19:23:31 +0300 Message-ID: <20150917162331.8676.15286.stgit@PASHA-ISP.def.inno> In-Reply-To: <20150917162322.8676.29314.stgit@PASHA-ISP.def.inno> References: <20150917162322.8676.29314.stgit@PASHA-ISP.def.inno> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v18 01/21] i386: partial revert of interrupt poll fix List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, igor.rubinov@gmail.com, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, hines@cert.org, fred.konrad@greensocs.com Processing CPU_INTERRUPT_POLL requests in cpu_has_work functions break the determinism of cpu_exec. This patch is required to make interrupts processing deterministic. Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- cpu-exec.c | 9 +++++++++ target-i386/cpu.c | 10 ++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 8945533..b247a23 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -28,6 +28,9 @@ #include "exec/memory-internal.h" #include "qemu/rcu.h" #include "exec/tb-hash.h" +#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) +#include "hw/i386/apic.h" +#endif /* -icount align implementation. */ @@ -402,6 +405,12 @@ int cpu_exec(CPUState *cpu) SyncClocks sc; if (cpu->halted) { +#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) + if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + apic_poll_irq(x86_cpu->apic_state); + cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); + } +#endif if (!cpu_has_work(cpu)) { return EXCP_HALTED; } diff --git a/target-i386/cpu.c b/target-i386/cpu.c index cfb8aa7..3d2e2f0 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -3098,14 +3098,8 @@ static bool x86_cpu_has_work(CPUState *cs) X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; -#if !defined(CONFIG_USER_ONLY) - if (cs->interrupt_request & CPU_INTERRUPT_POLL) { - apic_poll_irq(cpu->apic_state); - cpu_reset_interrupt(cs, CPU_INTERRUPT_POLL); - } -#endif - - return ((cs->interrupt_request & CPU_INTERRUPT_HARD) && + return ((cs->interrupt_request & (CPU_INTERRUPT_HARD | + CPU_INTERRUPT_POLL)) && (env->eflags & IF_MASK)) || (cs->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_INIT |