mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
qapi: Add VFIO devices migration stats in Migration stats
Added amount of bytes transferred to the VM at destination by all VFIO devices Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
a22651053b
commit
3710586caa
6 changed files with 71 additions and 0 deletions
|
@ -45,6 +45,8 @@
|
|||
#define VFIO_MIG_FLAG_DEV_SETUP_STATE (0xffffffffef100003ULL)
|
||||
#define VFIO_MIG_FLAG_DEV_DATA_STATE (0xffffffffef100004ULL)
|
||||
|
||||
static int64_t bytes_transferred;
|
||||
|
||||
static inline int vfio_mig_access(VFIODevice *vbasedev, void *val, int count,
|
||||
off_t off, bool iswrite)
|
||||
{
|
||||
|
@ -255,6 +257,7 @@ static int vfio_save_buffer(QEMUFile *f, VFIODevice *vbasedev, uint64_t *size)
|
|||
*size = data_size;
|
||||
}
|
||||
|
||||
bytes_transferred += data_size;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -785,6 +788,7 @@ static void vfio_migration_state_notifier(Notifier *notifier, void *data)
|
|||
case MIGRATION_STATUS_CANCELLING:
|
||||
case MIGRATION_STATUS_CANCELLED:
|
||||
case MIGRATION_STATUS_FAILED:
|
||||
bytes_transferred = 0;
|
||||
ret = vfio_migration_set_state(vbasedev,
|
||||
~(VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RESUMING),
|
||||
VFIO_DEVICE_STATE_RUNNING);
|
||||
|
@ -866,6 +870,11 @@ err:
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int64_t vfio_mig_bytes_transferred(void)
|
||||
{
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
|
||||
{
|
||||
VFIOContainer *container = vbasedev->group->container;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue