qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Alex Bennée" <alex@bennee.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"open list:Overall" <kvm@vger.kernel.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH v2 09/10] target-arm/kvm.c: better error reporting
Date: Thu, 10 Jul 2014 16:50:06 +0100	[thread overview]
Message-ID: <1405007407-23549-10-git-send-email-alex.bennee@linaro.org> (raw)
In-Reply-To: <1405007407-23549-1-git-send-email-alex.bennee@linaro.org>

From: Alex Bennée <alex@bennee.com>

When we have a problem syncing CP registers between kvm<->qemu it's a
lot more useful to have the names of the registers in the log than just
a random abort() and core dump.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
v2
  - less verbose log message
  - fix checkpatch warnings

diff --git a/target-arm/kvm.c b/target-arm/kvm.c
index 319784d..72e242d 100644
--- a/target-arm/kvm.c
+++ b/target-arm/kvm.c
@@ -279,6 +279,16 @@ void kvm_arm_register_device(MemoryRegion *mr, uint64_t devid, uint64_t group,
     memory_region_ref(kd->mr);
 }
 
+static void failed_cpreg_operation(ARMCPU *cpu, uint64_t regidx, int ret,
+                                   const char *func)
+{
+    uint32_t cpreg_id = kvm_to_cpreg_id(regidx);
+    ARMCPRegInfo *cpreg = g_hash_table_lookup(cpu->cp_regs, &cpreg_id);
+    qemu_log_mask(LOG_UNIMP,
+                  "%s: failed (%d) KVM reg op %"PRIx64" (%s)\n",
+                  func, ret, regidx, cpreg ? cpreg->name : "unknown");
+}
+
 bool write_kvmstate_to_list(ARMCPU *cpu)
 {
     CPUState *cs = CPU(cpu);
@@ -309,6 +319,7 @@ bool write_kvmstate_to_list(ARMCPU *cpu)
             abort();
         }
         if (ret) {
+            failed_cpreg_operation(cpu, regidx, ret, __func__);
             ok = false;
         }
     }
@@ -345,6 +356,7 @@ bool write_list_to_kvmstate(ARMCPU *cpu)
              * "you tried to set a register which is constant with
              * a different value from what it actually contains".
              */
+            failed_cpreg_operation(cpu, regidx, ret, __func__);
             ok = false;
         }
     }
-- 
2.0.1

  parent reply	other threads:[~2014-07-10 15:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10 15:49 [Qemu-devel] [PATCH v2 00/10] aarch64 migration for TCG and KVM Alex Bennée
2014-07-10 15:49 ` [Qemu-devel] [PATCH v2 01/10] target-arm/cpu.h: document various program state functions Alex Bennée
2014-08-04 12:28   ` Peter Maydell
2014-07-10 15:49 ` [Qemu-devel] [PATCH v2 02/10] target-arm/cpu.h: common pstate save/restore Alex Bennée
2014-08-04 12:47   ` Peter Maydell
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 03/10] target-arm: Support save/load for 64 bit CPUs Alex Bennée
2014-08-04 12:50   ` Peter Maydell
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 04/10] target-arm: replace cpsr/xpsr/pstate_read calls Alex Bennée
2014-07-15 13:40   ` Riku Voipio
2014-08-04 12:59   ` Peter Maydell
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 05/10] arm/nwfps: replace cpsr_write with set_condition_codes Alex Bennée
2014-07-15 13:41   ` Riku Voipio
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 06/10] linux-user/main.c: __kernel_cmpxchg set env->CF directly Alex Bennée
2014-07-15 13:39   ` Riku Voipio
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 07/10] target-arm: remove last users of cpsr_write Alex Bennée
2014-07-15 13:43   ` Riku Voipio
2014-08-04 13:01   ` Peter Maydell
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 08/10] target-arm: remove final users of pstate_write Alex Bennée
2014-07-15 13:44   ` Riku Voipio
2014-07-10 15:50 ` Alex Bennée [this message]
2014-08-04 13:03   ` [Qemu-devel] [PATCH v2 09/10] target-arm/kvm.c: better error reporting Peter Maydell
2014-07-10 15:50 ` [Qemu-devel] [PATCH v2 10/10] target-arm/kvm: make reg sync code common between kvm32/64 Alex Bennée
2014-08-04 13:04   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405007407-23549-10-git-send-email-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=alex@bennee.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).