qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: peterx@redhat.com, Laurent Vivier <lvivier@redhat.com>,
	Fabiano Rosas <farosas@suse.de>
Subject: [PATCH] Migration: Add trace points for vmstate handler insertion/removal
Date: Fri, 18 Oct 2024 10:44:26 -0400	[thread overview]
Message-ID: <20241018144426.826802-1-peterx@redhat.com> (raw)

SaveStateEntry has lots of magics internally, on alias_id, get_id() being
able to overwrite the original idstr, compat fields, ID_ANY, and so on.  It
may not be always clear that what all these fields are being registered for
some device we care.

Add trace points for SaveStateEntry insertions/removals, so that we know
what was being registered.  For insertions, we dump everything that might
be useful.  For removal, only section_id is needed because that's the
unique identifier for an SeveStateEntry.

Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/savevm.c     | 7 +++++++
 migration/trace-events | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/migration/savevm.c b/migration/savevm.c
index e796436979..57f058bd40 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -718,6 +718,11 @@ static void savevm_state_handler_insert(SaveStateEntry *nse)
 
     assert(priority <= MIG_PRI_MAX);
 
+    trace_vmstate_handler_insert(
+        nse->idstr, nse->instance_id, nse->alias_id, nse->version_id,
+        nse->section_id, nse->compat ? nse->compat->idstr : NULL,
+        nse->compat ? nse->compat->instance_id : 0);
+
     /*
      * This should never happen otherwise migration will probably fail
      * silently somewhere because we can be wrongly applying one
@@ -754,6 +759,8 @@ static void savevm_state_handler_remove(SaveStateEntry *se)
     SaveStateEntry *next;
     MigrationPriority priority = save_state_priority(se);
 
+    trace_vmstate_handler_remove(se->section_id);
+
     if (se == savevm_state.handler_pri_head[priority]) {
         next = QTAILQ_NEXT(se, entry);
         if (next != NULL && save_state_priority(next) == priority) {
diff --git a/migration/trace-events b/migration/trace-events
index 0638183056..3411f2f699 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -50,6 +50,8 @@ vmstate_load(const char *idstr, const char *vmsd_name) "%s, %s"
 vmstate_downtime_save(const char *type, const char *idstr, uint32_t instance_id, int64_t downtime) "type=%s idstr=%s instance_id=%d downtime=%"PRIi64
 vmstate_downtime_load(const char *type, const char *idstr, uint32_t instance_id, int64_t downtime) "type=%s idstr=%s instance_id=%d downtime=%"PRIi64
 vmstate_downtime_checkpoint(const char *checkpoint) "%s"
+vmstate_handler_insert(char *idstr, uint32_t instance_id, int alias_id, int version_id, int section_id, char *compat_idstr, int compat_instance_id) "id=%s instance_id=%"PRIu32" alias_id=%d version_id=%d section_id=%d compat_id=%s compat_instance_id=%d"
+vmstate_handler_remove(int section_id) "section_id=%d"
 postcopy_pause_incoming(void) ""
 postcopy_pause_incoming_continued(void) ""
 postcopy_page_req_sync(void *host_addr) "sync page req %p"
-- 
2.45.0



             reply	other threads:[~2024-10-18 14:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 14:44 Peter Xu [this message]
2024-10-18 14:50 ` [PATCH] Migration: Add trace points for vmstate handler insertion/removal Fabiano Rosas
2024-10-18 21:27 ` Peter Xu

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=20241018144426.826802-1-peterx@redhat.com \
    --to=peterx@redhat.com \
    --cc=farosas@suse.de \
    --cc=lvivier@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 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).