Patchwork PPC: KVM: Synchronize regs on CPU dump

login
register
mail settings
Submitter Alexander Graf
Date March 13, 2012, 11:19 p.m.
Message ID <1331680797-24546-1-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/146506/
State New
Headers show

Comments

Alexander Graf - March 13, 2012, 11:19 p.m.
When we dump the CPU registers, there's a certain chance they haven't been
synchronized with KVM yet, so we have to manually trigger that.

This aligns the code with x86 and fixes a bug where the register state was
bogus on invalid/unknown kvm exit reasons.

Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-ppc/translate.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 9be88cc..4b8c769 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -9319,6 +9319,8 @@  void cpu_dump_state (CPUState *env, FILE *f, fprintf_function cpu_fprintf,
 
     int i;
 
+    cpu_synchronize_state(env);
+
     cpu_fprintf(f, "NIP " TARGET_FMT_lx "   LR " TARGET_FMT_lx " CTR "
                 TARGET_FMT_lx " XER " TARGET_FMT_lx "\n",
                 env->nip, env->lr, env->ctr, env->xer);