qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [for 2.9] migration/tracing: Add tracing on save
@ 2016-12-12 12:58 Dr. David Alan Gilbert (git)
  2017-01-24 13:39 ` Juan Quintela
  2017-01-25  5:02 ` Amit Shah
  0 siblings, 2 replies; 3+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2016-12-12 12:58 UTC (permalink / raw)
  To: qemu-devel, quintela, amit.shah

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>
---
 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 6dded4f..83ef913 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 0bc9f35..42b9069 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -299,6 +299,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);
     }
@@ -318,6 +320,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;
 
@@ -427,11 +430,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) {
@@ -443,11 +448,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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [for 2.9] migration/tracing: Add tracing on save
  2016-12-12 12:58 [Qemu-devel] [for 2.9] migration/tracing: Add tracing on save Dr. David Alan Gilbert (git)
@ 2017-01-24 13:39 ` Juan Quintela
  2017-01-25  5:02 ` Amit Shah
  1 sibling, 0 replies; 3+ messages in thread
From: Juan Quintela @ 2017-01-24 13:39 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git); +Cc: qemu-devel, amit.shah

"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> 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>

Reviewed-by: Juan Quintela <quintela@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [for 2.9] migration/tracing: Add tracing on save
  2016-12-12 12:58 [Qemu-devel] [for 2.9] migration/tracing: Add tracing on save Dr. David Alan Gilbert (git)
  2017-01-24 13:39 ` Juan Quintela
@ 2017-01-25  5:02 ` Amit Shah
  1 sibling, 0 replies; 3+ messages in thread
From: Amit Shah @ 2017-01-25  5:02 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git); +Cc: qemu-devel, quintela

On (Mon) 12 Dec 2016 [12:58:38], Dr. David Alan Gilbert (git) wrote:
> 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>

Reviewed-by: Amit Shah <amit.shah@redhat.com>

		Amit

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-25  5:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-12 12:58 [Qemu-devel] [for 2.9] migration/tracing: Add tracing on save Dr. David Alan Gilbert (git)
2017-01-24 13:39 ` Juan Quintela
2017-01-25  5:02 ` Amit Shah

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).