All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 15/15] migration/tracing: Add tracing on save
Date: Tue, 24 Jan 2017 18:47:42 +0000	[thread overview]
Message-ID: <20170124184742.1639-16-dgilbert@redhat.com> (raw)
In-Reply-To: <20170124184742.1639-1-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Add some tracing to vmstate_subsection_save and vmstate_save_state
to help in debugging when you're not sure if a conditional piece
of data is being saved.

In vmstate_subsection_save I renamed the inner vmsd to avoid the aliasing
and be able to print both names.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20161212125838.14425-1-dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/trace-events |  4 ++++
 migration/vmstate.c    | 15 ++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/migration/trace-events b/migration/trace-events
index ba6bee4..48e531d 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -40,6 +40,10 @@ savevm_state_iterate(void) ""
 savevm_state_cleanup(void) ""
 savevm_state_complete_precopy(void) ""
 vmstate_save(const char *idstr, const char *vmsd_name) "%s, %s"
+vmstate_save_state_loop(const char *name, const char *field, int n_elems) "%s/%s[%d]"
+vmstate_save_state_top(const char *idstr) "%s"
+vmstate_subsection_save_loop(const char *name, const char *sub) "%s/%s"
+vmstate_subsection_save_top(const char *idstr) "%s"
 vmstate_load(const char *idstr, const char *vmsd_name) "%s, %s"
 qemu_announce_self_iter(const char *mac) "%s"
 
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 8ddd230..2b2b3a5 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -306,6 +306,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
 {
     VMStateField *field = vmsd->fields;
 
+    trace_vmstate_save_state_top(vmsd->name);
+
     if (vmsd->pre_save) {
         vmsd->pre_save(opaque);
     }
@@ -325,6 +327,7 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
             int64_t old_offset, written_bytes;
             QJSON *vmdesc_loop = vmdesc;
 
+            trace_vmstate_save_state_loop(vmsd->name, field->name, n_elems);
             for (i = 0; i < n_elems; i++) {
                 void *addr = base_addr + size * i;
 
@@ -434,11 +437,13 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
     const VMStateDescription **sub = vmsd->subsections;
     bool subsection_found = false;
 
+    trace_vmstate_subsection_save_top(vmsd->name);
     while (sub && *sub && (*sub)->needed) {
         if ((*sub)->needed(opaque)) {
-            const VMStateDescription *vmsd = *sub;
+            const VMStateDescription *vmsdsub = *sub;
             uint8_t len;
 
+            trace_vmstate_subsection_save_loop(vmsd->name, vmsdsub->name);
             if (vmdesc) {
                 /* Only create subsection array when we have any */
                 if (!subsection_found) {
@@ -450,11 +455,11 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
             }
 
             qemu_put_byte(f, QEMU_VM_SUBSECTION);
-            len = strlen(vmsd->name);
+            len = strlen(vmsdsub->name);
             qemu_put_byte(f, len);
-            qemu_put_buffer(f, (uint8_t *)vmsd->name, len);
-            qemu_put_be32(f, vmsd->version_id);
-            vmstate_save_state(f, vmsd, opaque, vmdesc);
+            qemu_put_buffer(f, (uint8_t *)vmsdsub->name, len);
+            qemu_put_be32(f, vmsdsub->version_id);
+            vmstate_save_state(f, vmsdsub, opaque, vmdesc);
 
             if (vmdesc) {
                 json_end_object(vmdesc);
-- 
2.9.3

  parent reply	other threads:[~2017-01-24 18:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-24 18:47 [Qemu-devel] [PULL 00/15] migration queue Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 01/15] MAINTAINERS: Add myself as a migration submaintainer Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 02/15] migration: extend VMStateInfo Dr. David Alan Gilbert (git)
2017-01-25 11:46   ` Fam Zheng
2017-01-25 12:00     ` Dr. David Alan Gilbert
2017-01-25 12:07       ` Cornelia Huck
2017-01-25 12:12       ` Fam Zheng
2017-01-25 12:19       ` Cornelia Huck
2017-01-25 13:22         ` Dr. David Alan Gilbert
2017-01-25 14:20           ` Cornelia Huck
2017-01-25 14:44             ` Dr. David Alan Gilbert
2017-01-26 12:14               ` Cornelia Huck
2017-01-27 18:20                 ` Dr. David Alan Gilbert
2017-02-01 10:18                   ` Cornelia Huck
2017-01-24 18:47 ` [Qemu-devel] [PULL 03/15] migration: migrate QTAILQ Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 04/15] tests/migration: Add test for QTAILQ migration Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 05/15] migration: add error_report Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 06/15] block/vvfat: Remove the undesirable comment Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 07/15] migration: Add a new option to enable only-migratable Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 08/15] migration: Allow "device add" options to only add migratable devices Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 09/15] migration: disallow migrate_add_blocker during migration Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 10/15] migration: Fail migration blocker for --only-migratable Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 11/15] migration: re-active images while migration been canceled after inactive them Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 12/15] migration: Change name of live migration thread Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 13/15] PCI/migration merge vmstate_pci_device and vmstate_pcie_device Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` [Qemu-devel] [PULL 14/15] migration: transform remaining DPRINTF into trace_ Dr. David Alan Gilbert (git)
2017-01-24 18:47 ` Dr. David Alan Gilbert (git) [this message]
2017-01-25 10:41 ` [Qemu-devel] [PULL 00/15] migration queue 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=20170124184742.1639-16-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.