mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
vfio/migration: Reset bytes_transferred properly
Currently, VFIO bytes_transferred is not reset properly:
1. bytes_transferred is not reset after a VM snapshot (so a migration
following a snapshot will report incorrect value).
2. bytes_transferred is a single counter for all VFIO devices, however
upon migration failure it is reset multiple times, by each VFIO
device.
Fix it by introducing a new function vfio_reset_bytes_transferred() and
calling it during migration and snapshot start.
Remove existing bytes_transferred reset in VFIO migration state
notifier, which is not needed anymore.
Fixes: 3710586caa
("qapi: Add VFIO devices migration stats in Migration stats")
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
committed by
Cédric Le Goater
parent
c174088923
commit
808642a2f6
@ -14,12 +14,25 @@
|
||||
#include "hw/vfio/vfio-common.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_VFIO
|
||||
void populate_vfio_info(MigrationInfo *info)
|
||||
{
|
||||
#ifdef CONFIG_VFIO
|
||||
if (vfio_mig_active()) {
|
||||
info->vfio = g_malloc0(sizeof(*info->vfio));
|
||||
info->vfio->transferred = vfio_mig_bytes_transferred();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void reset_vfio_bytes_transferred(void)
|
||||
{
|
||||
vfio_reset_bytes_transferred();
|
||||
}
|
||||
#else
|
||||
void populate_vfio_info(MigrationInfo *info)
|
||||
{
|
||||
}
|
||||
|
||||
void reset_vfio_bytes_transferred(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user