From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xxt8c-0005Kd-Sa for qemu-devel@nongnu.org; Mon, 08 Dec 2014 02:53:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xxt8W-0000Zb-P3 for qemu-devel@nongnu.org; Mon, 08 Dec 2014 02:53:46 -0500 Received: from mail.ispras.ru ([83.149.199.45]:58251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xxt8W-0000ZW-Hm for qemu-devel@nongnu.org; Mon, 08 Dec 2014 02:53:40 -0500 From: Pavel Dovgalyuk Date: Mon, 08 Dec 2014 10:53:40 +0300 Message-ID: <20141208075339.7108.59197.stgit@PASHA-ISP> In-Reply-To: <20141208075255.7108.19079.stgit@PASHA-ISP> References: <20141208075255.7108.19079.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH v6 07/32] cpu-exec: reset exception_index correctly 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 Exception index is reset at every entry at every entry into cpu_exec() function. This may cause missing the exceptions while replaying them. This patch moves exception_index reset to the locations where they are processed. Signed-off-by: Pavel Dovgalyuk --- cpu-exec.c | 3 ++- cpus.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 88675ca..0dff591 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -366,7 +366,6 @@ int cpu_exec(CPUArchState *env) } cc->cpu_exec_enter(cpu); - cpu->exception_index = -1; /* Calculate difference between guest clock and host clock. * This delay includes the delay of the last cycle, so @@ -386,6 +385,7 @@ int cpu_exec(CPUArchState *env) if (ret == EXCP_DEBUG) { cpu_handle_debug_exception(env); } + cpu->exception_index = -1; break; } else { #if defined(CONFIG_USER_ONLY) @@ -396,6 +396,7 @@ int cpu_exec(CPUArchState *env) cc->do_interrupt(cpu); #endif ret = cpu->exception_index; + cpu->exception_index = -1; break; #else cc->do_interrupt(cpu); diff --git a/cpus.c b/cpus.c index a46182f..38af588 100644 --- a/cpus.c +++ b/cpus.c @@ -935,6 +935,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->can_do_io = 1; + cpu->exception_index = -1; current_cpu = cpu; r = kvm_init_vcpu(cpu); @@ -976,6 +977,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->can_do_io = 1; + cpu->exception_index = -1; sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); @@ -1019,6 +1021,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->can_do_io = 1; + cpu->exception_index = -1; } qemu_cond_signal(&qemu_cpu_cond);