From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCqx7-0002kV-V3 for qemu-devel@nongnu.org; Fri, 23 Aug 2013 08:59:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCqx2-0001rS-V1 for qemu-devel@nongnu.org; Fri, 23 Aug 2013 08:58:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCqx2-0001rA-Nx for qemu-devel@nongnu.org; Fri, 23 Aug 2013 08:58:52 -0400 Date: Fri, 23 Aug 2013 15:58:47 +0300 From: Gleb Natapov Message-ID: <20130823125846.GE15513@redhat.com> References: <1377260760-32056-1-git-send-email-james.hogan@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1377260760-32056-1-git-send-email-james.hogan@imgtec.com> Subject: Re: [Qemu-devel] [PATCH] kvm: sync cpu state on internal error before dump List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: James Hogan Cc: Paolo Bonzini , qemu-devel@nongnu.org, kvm@vger.kernel.org On Fri, Aug 23, 2013 at 01:26:00PM +0100, James Hogan wrote: > When a KVM internal error occurs QEMU dumps the CPU state, however it > doesn't synchronise the state from KVM first so the dumped state is out > of date. Add the synchronisation calls before the dump in both locations > (which is used depends on whether the arch says to stop or not). > x86_cpu_dump_state() calls cpu_synchronize_state() already. > Note that x86 does a sync in its kvm_arch_stop_on_emulation_error() > function so at least for emulation errors is unaffected. > > Signed-off-by: James Hogan > Cc: Gleb Natapov > Cc: Paolo Bonzini > Cc: kvm@vger.kernel.org > --- > kvm-all.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/kvm-all.c b/kvm-all.c > index b788fcd..803141a 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -1546,6 +1546,7 @@ static int kvm_handle_internal_error(CPUState *cpu, struct kvm_run *run) > if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) { > fprintf(stderr, "emulation failure\n"); > if (!kvm_arch_stop_on_emulation_error(cpu)) { > + kvm_cpu_synchronize_state(cpu); > cpu_dump_state(cpu, stderr, fprintf, CPU_DUMP_CODE); > return EXCP_INTERRUPT; > } > @@ -1701,6 +1702,7 @@ int kvm_cpu_exec(CPUState *cpu) > } while (ret == 0); > > if (ret < 0) { > + kvm_cpu_synchronize_state(cpu); > cpu_dump_state(cpu, stderr, fprintf, CPU_DUMP_CODE); > vm_stop(RUN_STATE_INTERNAL_ERROR); > } > -- > 1.8.1.2 > -- Gleb.