Re: [PATCH v2 16/16] vfio/migration: Add tracepoints for precopy/stopcopy query ioctls
On 4/29/2026 18:43, Peter Xu wrote: External email: Use caution opening links or attachments On Wed, Apr 29, 2026 at 05:46:19PM +0300, Avihai Horon wrote: Ah sorry, I just noticed this now while doing some other work -- if you respin the series, could you add the device name to both traces? And while at it keep the traces alphabetically sorted? Could you help check if below fixup is suitable to be squashed? Yes, looks good, thanks! Thanks, ===8<=== From 930723da46e16c2ed5405916a7e10d4f560e22fa Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Wed, 29 Apr 2026 11:41:49 -0400 Subject: [PATCH] fixup! vfio/migration: Add tracepoints for precopy/stopcopy query ioctls Signed-off-by: Peter Xu --- hw/vfio/migration.c | 6 -- hw/vfio/trace-events | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 04d9f94edb..150e28656e 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -350,7 +350,8 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev) ret = 0; } -trace_vfio_query_stop_copy_size(migration->stopcopy_size, ret); +trace_vfio_query_stop_copy_size(vbasedev->name, +migration->stopcopy_size, ret); return ret; } @@ -374,7 +375,8 @@ static int vfio_query_precopy_size(VFIOMigration *migration) ret = 0; } -trace_vfio_query_precopy_size(migration->precopy_init_size, +trace_vfio_query_precopy_size(migration->vbasedev->name, + migration->precopy_init_size, migration->precopy_dirty_size, ret); return ret; diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index 854a7e4b19..ab27ff5ea2 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -162,6 +162,8 @@ vfio_migration_realize(const char *name) " (%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_query_stop_copy_size(const char *name, uint64_t size, int ret) " (%s) stopcopy size %"PRIu64" ret %d" +vfio_query_precopy_size(const char *name, uint64_t init_size, uint64_t dirty_size, int ret) " (%s) init %"PRIu64" dirty %"PRIu64" ret %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)" @@ -176,8 +178,6 @@ vfio_save_setup(const char *name, uint64_t data_buffer_size) " (%s) data buffer vfio_state_pending(const char *name, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size, bool exact) " (%s) stopcopy size %"PRIu64" precopy initial size %"PRIu64" precopy dirty size %"PRIu64 " exact %d" vfio_vmstate_change(const char *name, int running, const char *reason, const char *dev_state) " (%s) running %d reason %s device state %s" vfio_vmstate_change_prepare(const char *name, int running, const char *reason, const char *dev_state) " (%s) running %d reason %s device state %s" -vfio_query_stop_copy_size(uint64_t size, int ret) "stopcopy size %"PRIu64" ret %d" -vfio_query_precopy_size(uint64_t init_size, uint64_t dirty_size, int ret) "init %"PRIu64" dirty %"PRIu64" ret %d" #iommufd.c -- 2.53.0 -- Peter Xu
Re: [PATCH v2 16/16] vfio/migration: Add tracepoints for precopy/stopcopy query ioctls
On Wed, Apr 29, 2026 at 05:46:19PM +0300, Avihai Horon wrote: > Ah sorry, I just noticed this now while doing some other work -- if you > respin the series, could you add the device name to both traces? And while > at it keep the traces alphabetically sorted? Could you help check if below fixup is suitable to be squashed? Thanks, ===8<=== >From 930723da46e16c2ed5405916a7e10d4f560e22fa Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Wed, 29 Apr 2026 11:41:49 -0400 Subject: [PATCH] fixup! vfio/migration: Add tracepoints for precopy/stopcopy query ioctls Signed-off-by: Peter Xu --- hw/vfio/migration.c | 6 -- hw/vfio/trace-events | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 04d9f94edb..150e28656e 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -350,7 +350,8 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev) ret = 0; } -trace_vfio_query_stop_copy_size(migration->stopcopy_size, ret); +trace_vfio_query_stop_copy_size(vbasedev->name, +migration->stopcopy_size, ret); return ret; } @@ -374,7 +375,8 @@ static int vfio_query_precopy_size(VFIOMigration *migration) ret = 0; } -trace_vfio_query_precopy_size(migration->precopy_init_size, +trace_vfio_query_precopy_size(migration->vbasedev->name, + migration->precopy_init_size, migration->precopy_dirty_size, ret); return ret; diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index 854a7e4b19..ab27ff5ea2 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -162,6 +162,8 @@ vfio_migration_realize(const char *name) " (%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_query_stop_copy_size(const char *name, uint64_t size, int ret) " (%s) stopcopy size %"PRIu64" ret %d" +vfio_query_precopy_size(const char *name, uint64_t init_size, uint64_t dirty_size, int ret) " (%s) init %"PRIu64" dirty %"PRIu64" ret %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)" @@ -176,8 +178,6 @@ vfio_save_setup(const char *name, uint64_t data_buffer_size) " (%s) data buffer vfio_state_pending(const char *name, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size, bool exact) " (%s) stopcopy size %"PRIu64" precopy initial size %"PRIu64" precopy dirty size %"PRIu64 " exact %d" vfio_vmstate_change(const char *name, int running, const char *reason, const char *dev_state) " (%s) running %d reason %s device state %s" vfio_vmstate_change_prepare(const char *name, int running, const char *reason, const char *dev_state) " (%s) running %d reason %s device state %s" -vfio_query_stop_copy_size(uint64_t size, int ret) "stopcopy size %"PRIu64" ret %d" -vfio_query_precopy_size(uint64_t init_size, uint64_t dirty_size, int ret) "init %"PRIu64" dirty %"PRIu64" ret %d" #iommufd.c -- 2.53.0 -- Peter Xu
Re: [PATCH v2 16/16] vfio/migration: Add tracepoints for precopy/stopcopy query ioctls
On 4/21/2026 23:21, Peter Xu wrote:
External email: Use caution opening links or attachments
Add two tracepoints for both precopy and stopcopy query ioctls. When at
it, add one warn_report_once() for each of them when it fails.
Signed-off-by: Peter Xu
---
hw/vfio/migration.c | 33 +++--
hw/vfio/trace-events | 2 ++
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index e6e6a0d53d..04d9f94edb 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -329,6 +329,7 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
struct vfio_device_feature_mig_data_size *mig_data_size =
(struct vfio_device_feature_mig_data_size *)feature->data;
VFIOMigration *migration = vbasedev->migration;
+int ret;
feature->argsz = sizeof(buf);
feature->flags =
@@ -340,12 +341,18 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
* is reported so downtime limit won't be violated.
*/
migration->stopcopy_size = VFIO_MIG_STOP_COPY_SIZE;
-return -errno;
+ret = -errno;
+warn_report_once("VFIO device %s ioctl(VFIO_DEVICE_FEATURE) on "
+ "VFIO_DEVICE_FEATURE_MIG_DATA_SIZE failed (%d)",
+ vbasedev->name, ret);
+} else {
+migration->stopcopy_size = mig_data_size->stop_copy_length;
+ret = 0;
}
-migration->stopcopy_size = mig_data_size->stop_copy_length;
+trace_vfio_query_stop_copy_size(migration->stopcopy_size, ret);
-return 0;
+return ret;
}
static int vfio_query_precopy_size(VFIOMigration *migration)
@@ -353,18 +360,24 @@ static int vfio_query_precopy_size(VFIOMigration
*migration)
struct vfio_precopy_info precopy = {
.argsz = sizeof(precopy),
};
-
-migration->precopy_init_size = 0;
-migration->precopy_dirty_size = 0;
+int ret;
if (ioctl(migration->data_fd, VFIO_MIG_GET_PRECOPY_INFO, &precopy)) {
-return -errno;
+migration->precopy_init_size = 0;
+migration->precopy_dirty_size = 0;
+ret = -errno;
+warn_report_once("VFIO device %s ioctl(VFIO_MIG_GET_PRECOPY_INFO) "
+ "failed (%d)", migration->vbasedev->name, ret);
+} else {
+migration->precopy_init_size = precopy.initial_bytes;
+migration->precopy_dirty_size = precopy.dirty_bytes;
+ret = 0;
}
-migration->precopy_init_size = precopy.initial_bytes;
-migration->precopy_dirty_size = precopy.dirty_bytes;
+trace_vfio_query_precopy_size(migration->precopy_init_size,
+ migration->precopy_dirty_size, ret);
-return 0;
+return ret;
}
/* Returns the size of saved data on success and -errno on error */
diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
index 287df0b8cb..854a7e4b19 100644
--- a/hw/vfio/trace-events
+++ b/hw/vfio/trace-events
@@ -176,6 +176,8 @@ vfio_save_setup(const char *name, uint64_t data_buffer_size)
" (%s) data buffer
vfio_state_pending(const char *name, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size,
bool exact) " (%s) stopcopy size %"PRIu64" precopy initial size %"PRIu64" precopy dirty size
%"PRIu64 " exact %d"
vfio_vmstate_change(const char *name, int running, const char *reason, const char
*dev_state) " (%s) running %d reason %s device state %s"
vfio_vmstate_change_prepare(const char *name, int running, const char *reason, const
char *dev_state) " (%s) running %d reason %s device state %s"
+vfio_query_stop_copy_size(uint64_t size, int ret) "stopcopy size %"PRIu64" ret
%d"
+vfio_query_precopy_size(uint64_t init_size, uint64_t dirty_size, int ret) "init %"PRIu64"
dirty %"PRIu64" ret %d"
Ah sorry, I just noticed this now while doing some other work -- if you
respin the series, could you add the device name to both traces? And
while at it keep the traces alphabetically sorted?
Thanks.
#iommufd.c
--
2.53.0
Re: [PATCH v2 16/16] vfio/migration: Add tracepoints for precopy/stopcopy query ioctls
On 4/21/2026 23:21, Peter Xu wrote: External email: Use caution opening links or attachments Add two tracepoints for both precopy and stopcopy query ioctls. When at it, add one warn_report_once() for each of them when it fails. Signed-off-by: Peter Xu --- hw/vfio/migration.c | 33 +++-- hw/vfio/trace-events | 2 ++ 2 files changed, 25 insertions(+), 10 deletions(-) Reviewed-by: Avihai Horon
Re: [PATCH v2 16/16] vfio/migration: Add tracepoints for precopy/stopcopy query ioctls
On 4/21/26 22:21, Peter Xu wrote:
Add two tracepoints for both precopy and stopcopy query ioctls. When at
it, add one warn_report_once() for each of them when it fails.
Signed-off-by: Peter Xu
---
hw/vfio/migration.c | 33 +++--
hw/vfio/trace-events | 2 ++
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index e6e6a0d53d..04d9f94edb 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -329,6 +329,7 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
struct vfio_device_feature_mig_data_size *mig_data_size =
(struct vfio_device_feature_mig_data_size *)feature->data;
VFIOMigration *migration = vbasedev->migration;
+int ret;
feature->argsz = sizeof(buf);
feature->flags =
@@ -340,12 +341,18 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
* is reported so downtime limit won't be violated.
*/
migration->stopcopy_size = VFIO_MIG_STOP_COPY_SIZE;
-return -errno;
+ret = -errno;
+warn_report_once("VFIO device %s ioctl(VFIO_DEVICE_FEATURE) on "
+ "VFIO_DEVICE_FEATURE_MIG_DATA_SIZE failed (%d)",
+ vbasedev->name, ret);
+} else {
+migration->stopcopy_size = mig_data_size->stop_copy_length;
+ret = 0;
}
-migration->stopcopy_size = mig_data_size->stop_copy_length;
+trace_vfio_query_stop_copy_size(migration->stopcopy_size, ret);
-return 0;
+return ret;
}
static int vfio_query_precopy_size(VFIOMigration *migration)
@@ -353,18 +360,24 @@ static int vfio_query_precopy_size(VFIOMigration
*migration)
struct vfio_precopy_info precopy = {
.argsz = sizeof(precopy),
};
-
-migration->precopy_init_size = 0;
-migration->precopy_dirty_size = 0;
+int ret;
if (ioctl(migration->data_fd, VFIO_MIG_GET_PRECOPY_INFO, &precopy)) {
-return -errno;
+migration->precopy_init_size = 0;
+migration->precopy_dirty_size = 0;
+ret = -errno;
+warn_report_once("VFIO device %s ioctl(VFIO_MIG_GET_PRECOPY_INFO) "
+ "failed (%d)", migration->vbasedev->name, ret);
+} else {
+migration->precopy_init_size = precopy.initial_bytes;
+migration->precopy_dirty_size = precopy.dirty_bytes;
+ret = 0;
}
-migration->precopy_init_size = precopy.initial_bytes;
-migration->precopy_dirty_size = precopy.dirty_bytes;
+trace_vfio_query_precopy_size(migration->precopy_init_size,
+ migration->precopy_dirty_size, ret);
This is possibly an overflow (in the kernel) :
vfio_query_precopy_size init 18446744073281946832 dirty 0 ret 0
vfio_state_pending (4fbce62c-8ce2-4cc9-b429-41635bc94f24) stopcopy size
3735178384 precopy initial size 18446744073281946832 precopy dirty size 0 exact
1
vfio_state_pending (:b1:01.0) stopcopy size 7106032 precopy initial size 0
precopy dirty size 496 exact 0
vfio_state_pending (4fbce62c-8ce2-4cc9-b429-41635bc94f24) stopcopy size
3734129808 precopy initial size 18446744073280898256 precopy dirty size 0 exact 0
vfio_state_pending (:b1:01.0) stopcopy size 7106032 precopy initial size 0
precopy dirty size 0 exact 0
vfio_state_pending (4fbce62c-8ce2-4cc9-b429-41635bc94f24) stopcopy size
3733081232 precopy initial size 18446744073279849680 precopy dirty size 0 exact 0
vfio_state_pending (:b1:01.0) stopcopy size 7106032 precopy initial size 0
precopy dirty size 0 exact 0
vfio_state_pending (4fbce62c-8ce2-4cc9-b429-41635bc94f24) stopcopy size
3732032656 precopy initial size 18446744073278801104 precopy dirty size 0 exact 0
vfio_state_pending (:b1:01.0) stopcopy size 7106032 precopy initial size 0
precopy dirty size 0 exact 0
vfio_state_pending (4fbce62c-8ce2-4cc9-b429-41635bc94f24) stopcopy size
3730984080 precopy initial size 18446744073277752528 precopy dirty size 0 exact 0
C.
-return 0;
+return ret;
}
/* Returns the size of saved data on success and -errno on error */
diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
index 287df0b8cb..854a7e4b19 100644
--- a/hw/vfio/trace-events
+++ b/hw/vfio/trace-events
@@ -176,6 +176,8 @@ vfio_save_setup(const char *name, uint64_t data_buffer_size)
" (%s) data buffer
vfio_state_pending(const char *name, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size,
bool exact) " (%s) stopcopy size %"PRIu64" precopy initial size %"PRIu64" precopy dirty size
%"PRIu64 " exact %d"
vfio_vmstate_change(const char *name, int running, const char *reason, const char
*dev_state) " (%s) running %d reason %s device state %s"
vfio_vmstate_change_prepare(const char *name, int running, const char *reason, const
char *dev_state) " (%s) running %d reason %s device state %s"
+vfio_query_stop_copy_size(uint64_t size, int ret) "sto
Re: [PATCH v2 16/16] vfio/migration: Add tracepoints for precopy/stopcopy query ioctls
On 4/21/26 22:21, Peter Xu wrote:
Add two tracepoints for both precopy and stopcopy query ioctls. When at
it, add one warn_report_once() for each of them when it fails.
Signed-off-by: Peter Xu
Tested-by: Cédric Le Goater
Thanks,
C.
---
hw/vfio/migration.c | 33 +++--
hw/vfio/trace-events | 2 ++
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index e6e6a0d53d..04d9f94edb 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -329,6 +329,7 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
struct vfio_device_feature_mig_data_size *mig_data_size =
(struct vfio_device_feature_mig_data_size *)feature->data;
VFIOMigration *migration = vbasedev->migration;
+int ret;
feature->argsz = sizeof(buf);
feature->flags =
@@ -340,12 +341,18 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
* is reported so downtime limit won't be violated.
*/
migration->stopcopy_size = VFIO_MIG_STOP_COPY_SIZE;
-return -errno;
+ret = -errno;
+warn_report_once("VFIO device %s ioctl(VFIO_DEVICE_FEATURE) on "
+ "VFIO_DEVICE_FEATURE_MIG_DATA_SIZE failed (%d)",
+ vbasedev->name, ret);
+} else {
+migration->stopcopy_size = mig_data_size->stop_copy_length;
+ret = 0;
}
-migration->stopcopy_size = mig_data_size->stop_copy_length;
+trace_vfio_query_stop_copy_size(migration->stopcopy_size, ret);
-return 0;
+return ret;
}
static int vfio_query_precopy_size(VFIOMigration *migration)
@@ -353,18 +360,24 @@ static int vfio_query_precopy_size(VFIOMigration
*migration)
struct vfio_precopy_info precopy = {
.argsz = sizeof(precopy),
};
-
-migration->precopy_init_size = 0;
-migration->precopy_dirty_size = 0;
+int ret;
if (ioctl(migration->data_fd, VFIO_MIG_GET_PRECOPY_INFO, &precopy)) {
-return -errno;
+migration->precopy_init_size = 0;
+migration->precopy_dirty_size = 0;
+ret = -errno;
+warn_report_once("VFIO device %s ioctl(VFIO_MIG_GET_PRECOPY_INFO) "
+ "failed (%d)", migration->vbasedev->name, ret);
+} else {
+migration->precopy_init_size = precopy.initial_bytes;
+migration->precopy_dirty_size = precopy.dirty_bytes;
+ret = 0;
}
-migration->precopy_init_size = precopy.initial_bytes;
-migration->precopy_dirty_size = precopy.dirty_bytes;
+trace_vfio_query_precopy_size(migration->precopy_init_size,
+ migration->precopy_dirty_size, ret);
-return 0;
+return ret;
}
/* Returns the size of saved data on success and -errno on error */
diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
index 287df0b8cb..854a7e4b19 100644
--- a/hw/vfio/trace-events
+++ b/hw/vfio/trace-events
@@ -176,6 +176,8 @@ vfio_save_setup(const char *name, uint64_t data_buffer_size)
" (%s) data buffer
vfio_state_pending(const char *name, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size,
bool exact) " (%s) stopcopy size %"PRIu64" precopy initial size %"PRIu64" precopy dirty size
%"PRIu64 " exact %d"
vfio_vmstate_change(const char *name, int running, const char *reason, const char
*dev_state) " (%s) running %d reason %s device state %s"
vfio_vmstate_change_prepare(const char *name, int running, const char *reason, const
char *dev_state) " (%s) running %d reason %s device state %s"
+vfio_query_stop_copy_size(uint64_t size, int ret) "stopcopy size %"PRIu64" ret
%d"
+vfio_query_precopy_size(uint64_t init_size, uint64_t dirty_size, int ret) "init %"PRIu64"
dirty %"PRIu64" ret %d"
#iommufd.c
Re: [PATCH v2 16/16] vfio/migration: Add tracepoints for precopy/stopcopy query ioctls
On 4/21/26 22:21, Peter Xu wrote:
Add two tracepoints for both precopy and stopcopy query ioctls. When at
it, add one warn_report_once() for each of them when it fails.
Signed-off-by: Peter Xu
Reviewed-by: Cédric Le Goater
Thanks,
C.
---
hw/vfio/migration.c | 33 +++--
hw/vfio/trace-events | 2 ++
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index e6e6a0d53d..04d9f94edb 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -329,6 +329,7 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
struct vfio_device_feature_mig_data_size *mig_data_size =
(struct vfio_device_feature_mig_data_size *)feature->data;
VFIOMigration *migration = vbasedev->migration;
+int ret;
feature->argsz = sizeof(buf);
feature->flags =
@@ -340,12 +341,18 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
* is reported so downtime limit won't be violated.
*/
migration->stopcopy_size = VFIO_MIG_STOP_COPY_SIZE;
-return -errno;
+ret = -errno;
+warn_report_once("VFIO device %s ioctl(VFIO_DEVICE_FEATURE) on "
+ "VFIO_DEVICE_FEATURE_MIG_DATA_SIZE failed (%d)",
+ vbasedev->name, ret);
+} else {
+migration->stopcopy_size = mig_data_size->stop_copy_length;
+ret = 0;
}
-migration->stopcopy_size = mig_data_size->stop_copy_length;
+trace_vfio_query_stop_copy_size(migration->stopcopy_size, ret);
-return 0;
+return ret;
}
static int vfio_query_precopy_size(VFIOMigration *migration)
@@ -353,18 +360,24 @@ static int vfio_query_precopy_size(VFIOMigration
*migration)
struct vfio_precopy_info precopy = {
.argsz = sizeof(precopy),
};
-
-migration->precopy_init_size = 0;
-migration->precopy_dirty_size = 0;
+int ret;
if (ioctl(migration->data_fd, VFIO_MIG_GET_PRECOPY_INFO, &precopy)) {
-return -errno;
+migration->precopy_init_size = 0;
+migration->precopy_dirty_size = 0;
+ret = -errno;
+warn_report_once("VFIO device %s ioctl(VFIO_MIG_GET_PRECOPY_INFO) "
+ "failed (%d)", migration->vbasedev->name, ret);
+} else {
+migration->precopy_init_size = precopy.initial_bytes;
+migration->precopy_dirty_size = precopy.dirty_bytes;
+ret = 0;
}
-migration->precopy_init_size = precopy.initial_bytes;
-migration->precopy_dirty_size = precopy.dirty_bytes;
+trace_vfio_query_precopy_size(migration->precopy_init_size,
+ migration->precopy_dirty_size, ret);
-return 0;
+return ret;
}
/* Returns the size of saved data on success and -errno on error */
diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
index 287df0b8cb..854a7e4b19 100644
--- a/hw/vfio/trace-events
+++ b/hw/vfio/trace-events
@@ -176,6 +176,8 @@ vfio_save_setup(const char *name, uint64_t data_buffer_size)
" (%s) data buffer
vfio_state_pending(const char *name, uint64_t stopcopy_size, uint64_t precopy_init_size, uint64_t precopy_dirty_size,
bool exact) " (%s) stopcopy size %"PRIu64" precopy initial size %"PRIu64" precopy dirty size
%"PRIu64 " exact %d"
vfio_vmstate_change(const char *name, int running, const char *reason, const char
*dev_state) " (%s) running %d reason %s device state %s"
vfio_vmstate_change_prepare(const char *name, int running, const char *reason, const
char *dev_state) " (%s) running %d reason %s device state %s"
+vfio_query_stop_copy_size(uint64_t size, int ret) "stopcopy size %"PRIu64" ret
%d"
+vfio_query_precopy_size(uint64_t init_size, uint64_t dirty_size, int ret) "init %"PRIu64"
dirty %"PRIu64" ret %d"
#iommufd.c
