diff options
author | Maciej S. Szmigiero <maciej.szmigiero@oracle.com> | 2024-11-04 22:29:07 +0100 |
---|---|---|
committer | Cédric Le Goater <clg@redhat.com> | 2024-11-05 15:51:14 +0100 |
commit | 89b516152777a8b54b117d90690ed9be62ba1177 (patch) | |
tree | fc44d5fd5be39c58a54427d5209554fd5f730dda | |
parent | 2564e451713e4f983b17c57ae62a05b73ddb0d96 (diff) | |
download | qemu-89b516152777a8b54b117d90690ed9be62ba1177.zip qemu-89b516152777a8b54b117d90690ed9be62ba1177.tar.gz qemu-89b516152777a8b54b117d90690ed9be62ba1177.tar.bz2 |
vfio/migration: Add vfio_save_block_precopy_empty_hit trace event
This way it is clearly known when there's no more data to send for that
device.
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
-rw-r--r-- | hw/vfio/migration.c | 8 | ||||
-rw-r--r-- | hw/vfio/trace-events | 1 | ||||
-rw-r--r-- | include/hw/vfio/vfio-common.h | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 87ddc21..01aa110 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -370,6 +370,10 @@ static ssize_t vfio_save_block(QEMUFile *f, VFIOMigration *migration) * please refer to the Linux kernel VFIO uAPI. */ if (errno == ENOMSG) { + if (!migration->event_precopy_empty_hit) { + trace_vfio_save_block_precopy_empty_hit(migration->vbasedev->name); + migration->event_precopy_empty_hit = true; + } return 0; } @@ -379,6 +383,9 @@ static ssize_t vfio_save_block(QEMUFile *f, VFIOMigration *migration) return 0; } + /* Non-empty read: re-arm the trace event */ + migration->event_precopy_empty_hit = false; + qemu_put_be64(f, VFIO_MIG_FLAG_DEV_DATA_STATE); qemu_put_be64(f, data_size); qemu_put_buffer(f, migration->data_buffer, data_size); @@ -473,6 +480,7 @@ static int vfio_save_setup(QEMUFile *f, void *opaque, Error **errp) } migration->event_save_iterate_started = false; + migration->event_precopy_empty_hit = false; if (vfio_precopy_supported(vbasedev)) { switch (migration->device_state) { diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index 032a51a..cab1cf1 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -157,6 +157,7 @@ vfio_migration_set_device_state(const char *name, const char *state) " (%s) stat 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_block_precopy_empty_hit(const char *name) " (%s)" vfio_save_cleanup(const char *name) " (%s)" vfio_save_complete_precopy(const char *name, int ret) " (%s) ret %d" vfio_save_complete_precopy_start(const char *name) " (%s)" diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 282eadf..e0ce6ec 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -75,6 +75,7 @@ typedef struct VFIOMigration { bool initial_data_sent; bool event_save_iterate_started; + bool event_precopy_empty_hit; } VFIOMigration; struct VFIOGroup; |