From: Avihai Horon <avihaih@nvidia.com>
To: <qemu-devel@nongnu.org>
Cc: "Alex Williamson" <alex.williamson@redhat.com>,
"Cédric Le Goater" <clg@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Eric Blake" <eblake@redhat.com>, "Peter Xu" <peterx@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Joao Martins" <joao.m.martins@oracle.com>,
"Maor Gottlieb" <maorg@nvidia.com>,
"Avihai Horon" <avihaih@nvidia.com>
Subject: [PATCH v3 4/4] vfio/migration: Enhance VFIO migration state tracing
Date: Wed, 15 May 2024 16:21:38 +0300 [thread overview]
Message-ID: <20240515132138.4560-5-avihaih@nvidia.com> (raw)
In-Reply-To: <20240515132138.4560-1-avihaih@nvidia.com>
Move trace_vfio_migration_set_state() to the top of the function, add
recover_state to it, and add a new trace event to
vfio_migration_set_device_state().
This improves tracing of device state changes as state changes are now
also logged when vfio_migration_set_state() fails (covering recover
state and device reset transitions) and in no-op state transitions to
the same state.
Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
---
hw/vfio/migration.c | 8 ++++++--
hw/vfio/trace-events | 3 ++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index f2b7a3067b..7f0d76ab50 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -129,6 +129,9 @@ static void vfio_migration_set_device_state(VFIODevice *vbasedev,
{
VFIOMigration *migration = vbasedev->migration;
+ trace_vfio_migration_set_device_state(vbasedev->name,
+ mig_state_to_str(state));
+
migration->device_state = state;
vfio_migration_send_event(vbasedev);
}
@@ -146,6 +149,9 @@ static int vfio_migration_set_state(VFIODevice *vbasedev,
(struct vfio_device_feature_mig_state *)feature->data;
int ret;
+ trace_vfio_migration_set_state(vbasedev->name, mig_state_to_str(new_state),
+ mig_state_to_str(recover_state));
+
if (new_state == migration->device_state) {
return 0;
}
@@ -203,8 +209,6 @@ static int vfio_migration_set_state(VFIODevice *vbasedev,
migration->data_fd = mig_state->data_fd;
}
- trace_vfio_migration_set_state(vbasedev->name, mig_state_to_str(new_state));
-
return 0;
reset_device:
diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
index f0474b244b..64161bf6f4 100644
--- a/hw/vfio/trace-events
+++ b/hw/vfio/trace-events
@@ -152,7 +152,8 @@ vfio_load_device_config_state(const char *name) " (%s)"
vfio_load_state(const char *name, uint64_t data) " (%s) data 0x%"PRIx64
vfio_load_state_device_data(const char *name, uint64_t data_size, int ret) " (%s) size 0x%"PRIx64" ret %d"
vfio_migration_realize(const char *name) " (%s)"
-vfio_migration_set_state(const char *name, const char *state) " (%s) state %s"
+vfio_migration_set_device_state(const char *name, const char *state) " (%s) state %s"
+vfio_migration_set_state(const char *name, const char *new_state, const char *recover_state) " (%s) new state %s, recover state %s"
vfio_migration_state_notifier(const char *name, int state) " (%s) state %d"
vfio_save_block(const char *name, int data_size) " (%s) data_size %d"
vfio_save_cleanup(const char *name) " (%s)"
--
2.26.3
next prev parent reply other threads:[~2024-05-15 13:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 13:21 [PATCH v3 0/4] qapi/vfio: Add VFIO migration QAPI event Avihai Horon
2024-05-15 13:21 ` [PATCH v3 1/4] " Avihai Horon
2024-05-15 13:21 ` [PATCH v3 2/4] vfio/migration: Emit " Avihai Horon
2024-05-15 16:20 ` Cédric Le Goater
2024-05-15 13:21 ` [PATCH v3 3/4] vfio/migration: Don't emit STOP_COPY VFIO migration QAPI event twice Avihai Horon
2024-05-15 13:21 ` Avihai Horon [this message]
2024-05-15 16:19 ` [PATCH v3 4/4] vfio/migration: Enhance VFIO migration state tracing Cédric Le Goater
2024-05-16 16:29 ` [PATCH v3 0/4] qapi/vfio: Add VFIO migration QAPI event Cédric Le Goater
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=20240515132138.4560-5-avihaih@nvidia.com \
--to=avihaih@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=clg@redhat.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=joao.m.martins@oracle.com \
--cc=maorg@nvidia.com \
--cc=michael.roth@amd.com \
--cc=peterx@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).