From: Avihai Horon <avihaih@nvidia.com>
To: <qemu-devel@nongnu.org>
Cc: "Alex Williamson" <alex.williamson@redhat.com>,
"Cédric Le Goater" <clg@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Leonardo Bras" <leobras@redhat.com>,
"Yanghang Liu" <yanghliu@redhat.com>,
"Avihai Horon" <avihaih@nvidia.com>
Subject: [PATCH 4/6] vfio/migration: Change vfio_mig_active() semantics
Date: Mon, 28 Aug 2023 18:18:40 +0300 [thread overview]
Message-ID: <20230828151842.11303-5-avihaih@nvidia.com> (raw)
In-Reply-To: <20230828151842.11303-1-avihaih@nvidia.com>
vfio_mig_active() is used by migration_populate_vfio_info() to populate
VFIO migration info when it is active. Currently, VFIO migration is
considered active if there are VFIO devices and none of them has a
migration blocker.
Change that and consider VFIO migration to be active if there is a VFIO
device that is using VFIO migration, regardless of whether a device has
migration blocker or not.
This is done in preparation for next patches which will block VFIO
migration with postcopy migration or background snapshot, as they are
not compatible together. It will allow adding a migration blocker for
such cases even if the VFIO device already has a blocker.
Note that migration_populate_vfio_info() still behaves correctly, as if
there is a VFIO device with migration blocker, migration can't be
started and thus migration_populate_vfio_info() will never be called.
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
---
hw/vfio/common.c | 24 +++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 57a76feab1..373f6e5932 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -342,25 +342,6 @@ static int vfio_bitmap_alloc(VFIOBitmap *vbmap, hwaddr size)
static int vfio_get_dirty_bitmap(VFIOContainer *container, uint64_t iova,
uint64_t size, ram_addr_t ram_addr);
-bool vfio_mig_active(void)
-{
- VFIOGroup *group;
- VFIODevice *vbasedev;
-
- if (QLIST_EMPTY(&vfio_group_list)) {
- return false;
- }
-
- QLIST_FOREACH(group, &vfio_group_list, next) {
- QLIST_FOREACH(vbasedev, &group->device_list, next) {
- if (vbasedev->migration_blocker) {
- return false;
- }
- }
- }
- return true;
-}
-
static Error *multiple_devices_migration_blocker;
static unsigned int vfio_migratable_devices_num(void)
@@ -446,6 +427,11 @@ void vfio_unblock_multiple_devices_migration(void)
multiple_devices_migration_blocker = NULL;
}
+bool vfio_mig_active(void)
+{
+ return vfio_migratable_devices_num();
+}
+
bool vfio_viommu_preset(VFIODevice *vbasedev)
{
return vbasedev->group->container->space->as != &address_space_memory;
--
2.26.3
next prev parent reply other threads:[~2023-08-28 15:20 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-28 15:18 [PATCH 0/6] vfio/migration: Block VFIO migration with postcopy and background snapshot Avihai Horon
2023-08-28 15:18 ` [PATCH 1/6] migration: Add migration prefix to functions in target.c Avihai Horon
2023-08-29 13:23 ` Cédric Le Goater
2023-08-29 14:04 ` Peter Xu
2023-08-29 15:59 ` Avihai Horon
2023-08-28 15:18 ` [PATCH 2/6] vfio/migration: Fail adding device with enable-migration=on and existing blocker Avihai Horon
2023-08-29 13:23 ` Cédric Le Goater
2023-08-28 15:18 ` [PATCH 3/6] vfio/migration: Add vfio_migratable_devices_num() Avihai Horon
2023-08-29 13:24 ` Cédric Le Goater
2023-08-28 15:18 ` Avihai Horon [this message]
2023-08-28 15:18 ` [PATCH 5/6] vfio/migration: Block VFIO migration with postcopy migration Avihai Horon
2023-08-29 13:24 ` Cédric Le Goater
2023-08-29 15:52 ` Avihai Horon
2023-08-29 14:53 ` Peter Xu
2023-08-29 16:20 ` Avihai Horon
2023-08-29 18:27 ` Peter Xu
2023-08-30 7:01 ` Avihai Horon
2023-08-30 8:37 ` Cédric Le Goater
2023-08-30 9:21 ` Avihai Horon
2023-08-30 9:53 ` Cédric Le Goater
2023-08-30 10:12 ` Avihai Horon
2023-08-30 11:17 ` Cédric Le Goater
2023-08-30 14:22 ` Peter Xu
2023-08-30 16:06 ` Avihai Horon
2023-08-28 15:18 ` [PATCH 6/6] vfio/migration: Block VFIO migration with background snapshot Avihai Horon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230828151842.11303-5-avihaih@nvidia.com \
--to=avihaih@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=clg@redhat.com \
--cc=leobras@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=yanghliu@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).