From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO3EW-0006ZP-Lh for qemu-devel@nongnu.org; Wed, 18 Feb 2015 06:56:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YO3EQ-0002QI-PU for qemu-devel@nongnu.org; Wed, 18 Feb 2015 06:56:00 -0500 Received: from mail.ispras.ru ([83.149.199.45]:38149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO3EE-0002LQ-SW for qemu-devel@nongnu.org; Wed, 18 Feb 2015 06:55:54 -0500 From: Pavel Dovgalyuk Date: Wed, 18 Feb 2015 14:55:44 +0300 Message-ID: <20150218115544.4176.98139.stgit@PASHA-ISP> In-Reply-To: <20150218115534.4176.12578.stgit@PASHA-ISP> References: <20150218115534.4176.12578.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH v9 01/23] 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: peter.maydell@linaro.org, peter.crosthwaite@xilinx.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, afaerber@suse.de, 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 | 6 ++++++ target-i386/cpu.c | 10 ++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 6738117..a048f85 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -335,6 +335,12 @@ int cpu_exec(CPUArchState *env) volatile bool have_tb_lock = false; if (cpu->halted) { +#ifdef TARGET_I386 + 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 3a9b32e..e90464d 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2969,14 +2969,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 |