From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0YgK-0006Nu-Fd for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:39:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0YgF-0005E9-Gb for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:39:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54113) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0YgF-0005Du-8o for qemu-devel@nongnu.org; Mon, 15 Dec 2014 11:39:31 -0500 From: Paolo Bonzini Date: Mon, 15 Dec 2014 17:38:10 +0100 Message-Id: <1418661511-22348-27-git-send-email-pbonzini@redhat.com> In-Reply-To: <1418661511-22348-1-git-send-email-pbonzini@redhat.com> References: <1418661511-22348-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 26/47] cpu-exec: reset exception_index correctly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Pavel Dovgalyuk From: Pavel Dovgalyuk 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 Signed-off-by: Paolo Bonzini --- cpu-exec.c | 3 ++- cpus.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cpu-exec.c b/cpu-exec.c index 8830255..4df9856 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -358,7 +358,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 @@ -378,6 +377,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) @@ -388,6 +388,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 0c33458..91119bb 100644 --- a/cpus.c +++ b/cpus.c @@ -934,6 +934,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) qemu_mutex_lock(&qemu_global_mutex); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); + cpu->exception_index = -1; current_cpu = cpu; r = kvm_init_vcpu(cpu); @@ -974,6 +975,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) qemu_mutex_lock_iothread(); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); + cpu->exception_index = -1; sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); @@ -1016,6 +1018,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) CPU_FOREACH(cpu) { cpu->thread_id = qemu_get_thread_id(); cpu->created = true; + cpu->exception_index = -1; } qemu_cond_signal(&qemu_cpu_cond); -- 1.8.3.1