summary refs log tree commit diff stats
path: root/hw/vfio/migration.c
diff options
context:
space:
mode:
authorAvihai Horon <avihaih@nvidia.com>2024-05-15 16:21:38 +0300
committerCédric Le Goater <clg@redhat.com>2024-05-16 16:59:20 +0200
commit11ebce2a5544cacab31e8ff169c6f0ceef37f4e8 (patch)
tree50d6ac19098309bfab030f1ce0c1098ea486a851 /hw/vfio/migration.c
parent64366eddf15a6224263c1152f9b0a1a97965e932 (diff)
downloadfocaccia-qemu-11ebce2a5544cacab31e8ff169c6f0ceef37f4e8.tar.gz
focaccia-qemu-11ebce2a5544cacab31e8ff169c6f0ceef37f4e8.zip
vfio/migration: Enhance VFIO migration state tracing
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>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/migration.c')
-rw-r--r--hw/vfio/migration.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 56edffaf62..34d4be2ce1 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);
 }
@@ -150,6 +153,9 @@ static int vfio_migration_set_state(VFIODevice *vbasedev,
         g_strdup_printf("%s: Failed setting device state to %s.",
                         vbasedev->name, mig_state_to_str(new_state));
 
+    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;
     }
@@ -209,8 +215,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: