[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() l
From: |
Avihai Horon |
Subject: |
[PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic |
Date: |
Mon, 16 Dec 2024 11:46:31 +0200 |
During dirty page log sync, vfio_devices_all_dirty_tracking() is used to
check if dirty tracking has been started in order to avoid errors. The
current logic checks if migration is in ACTIVE or DEVICE states to
ensure dirty tracking has been started.
However, recently there has been an effort to simplify the migration
status API and reduce it to a single migration_is_running() function.
To accommodate this, refactor vfio_devices_all_dirty_tracking() logic so
it won't use migration_is_active() and migration_is_device(). Instead,
use internal VFIO dirty tracking flags.
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
---
hw/vfio/common.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index dcef44fe55..a99796403e 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -170,11 +170,30 @@ bool vfio_device_state_is_precopy(VFIODevice *vbasedev)
migration->device_state == VFIO_DEVICE_STATE_PRE_COPY_P2P;
}
+static bool vfio_devices_all_device_dirty_tracking_started(
+ const VFIOContainerBase *bcontainer)
+{
+ VFIODevice *vbasedev;
+
+ QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) {
+ if (!vbasedev->dirty_tracking) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
static bool vfio_devices_all_dirty_tracking(VFIOContainerBase *bcontainer)
{
VFIODevice *vbasedev;
- if (!migration_is_active() && !migration_is_device()) {
+ if (!migration_is_running()) {
+ return false;
+ }
+
+ if (!(vfio_devices_all_device_dirty_tracking_started(bcontainer) ||
+ bcontainer->dirty_pages_started)) {
return false;
}
--
2.40.1
- [PATCH 0/9] migration: Drop/unexport migration_is_device() and migration_is_active(), Avihai Horon, 2024/12/16
- [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic,
Avihai Horon <=
- Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic, Joao Martins, 2024/12/16
- Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic, Joao Martins, 2024/12/16
- Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic, Avihai Horon, 2024/12/16
- Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic, Joao Martins, 2024/12/16
- Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic, Joao Martins, 2024/12/16
- Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic, Joao Martins, 2024/12/16
- Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic, Avihai Horon, 2024/12/17
[PATCH 3/9] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic, Avihai Horon, 2024/12/16