On 04/03/2025 0:17, Maciej S. Szmigiero wrote:
External email: Use caution opening links or attachments


On 2.03.2025 15:48, Avihai Horon wrote:

On 19/02/2025 22:34, Maciej S. Szmigiero wrote:
External email: Use caution opening links or attachments


From: "Maciej S. Szmigiero" <maciej.szmigi...@oracle.com>

This property allows configuring at runtime whether to transfer the

IIUC, in this patch it's not configurable at runtime, so let's drop "at runtime".

Dropped this expression from this patch description.

particular device state via multifd channels when live migrating that
device.

It defaults to AUTO, which means that VFIO device state transfer via
multifd channels is attempted in configurations that otherwise support it.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigi...@oracle.com>
---
  hw/vfio/migration-multifd.c   | 17 ++++++++++++++++-
  hw/vfio/pci.c                 |  3 +++
  include/hw/vfio/vfio-common.h |  2 ++
  3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/migration-multifd.c b/hw/vfio/migration-multifd.c
index 0cfa9d31732a..18a5ff964a37 100644
--- a/hw/vfio/migration-multifd.c
+++ b/hw/vfio/migration-multifd.c
@@ -460,11 +460,26 @@ bool vfio_multifd_transfer_supported(void)

  bool vfio_multifd_transfer_enabled(VFIODevice *vbasedev)
  {
-    return false;
+    VFIOMigration *migration = vbasedev->migration;
+
+    return migration->multifd_transfer;
  }

  bool vfio_multifd_transfer_setup(VFIODevice *vbasedev, Error **errp)
  {
+    VFIOMigration *migration = vbasedev->migration;
+
+    /*
+     * Make a copy of this setting at the start in case it is changed
+     * mid-migration.
+     */
+    if (vbasedev->migration_multifd_transfer == ON_OFF_AUTO_AUTO) {
+        migration->multifd_transfer = vfio_multifd_transfer_supported();
+    } else {
+        migration->multifd_transfer =
+            vbasedev->migration_multifd_transfer == ON_OFF_AUTO_ON;
+    }

Making a copy of this value is only relevant for the next patch where it's turned mutable, so let's move this code to patch #32.

But we still need to handle the "AUTO" condition so it would need
very similar code just to get reworked into the above in the next
patch.
I think that's just not worth code churn between patches.

Ah, I understand.
In that case, we can move only the comment "Make a copy of this setting ..." to patch #32.

Thanks.


Reply via email to