From patchwork Tue May 5 10:17:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 468040 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E0D041402A0 for ; Tue, 5 May 2015 20:18:14 +1000 (AEST) Received: from localhost ([::1]:38069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpZvY-0005vS-8J for incoming@patchwork.ozlabs.org; Tue, 05 May 2015 06:18:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpZv4-000576-EW for qemu-devel@nongnu.org; Tue, 05 May 2015 06:17:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpZv3-00075C-BG for qemu-devel@nongnu.org; Tue, 05 May 2015 06:17:42 -0400 Received: from mail.ispras.ru ([83.149.199.45]:38776) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpZv3-000757-42 for qemu-devel@nongnu.org; Tue, 05 May 2015 06:17:41 -0400 Received: from [10.10.150.75] (unknown [85.142.117.224]) by mail.ispras.ru (Postfix) with ESMTPSA id 660A954006F; Tue, 5 May 2015 13:17:40 +0300 (MSK) To: qemu-devel@nongnu.org From: Pavel Dovgalyuk Date: Tue, 05 May 2015 13:17:41 +0300 Message-ID: <20150505101741.16764.43059.stgit@PASHA-ISP> In-Reply-To: <20150505101732.16764.93601.stgit@PASHA-ISP> References: <20150505101732.16764.93601.stgit@PASHA-ISP> User-Agent: StGit/0.16 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 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, fred.konrad@greensocs.com Subject: [Qemu-devel] [RFC PATCH v12 01/21] i386: partial revert of interrupt poll fix X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 2ffeb6e..8f93df7 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -365,6 +365,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 03b33cf..cc69693 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2974,14 +2974,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 |