[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 5/8] migration/ram: Factor out check for advised postcopy
From: |
David Hildenbrand |
Subject: |
[PATCH v3 5/8] migration/ram: Factor out check for advised postcopy |
Date: |
Thu, 12 Jan 2023 17:44:00 +0100 |
Let's factor out this check, to be used in virtio-mem context next.
While at it, fix a spelling error in a related comment.
Signed-off-by: David Hildenbrand <david@redhat.com>
---
include/migration/misc.h | 4 +++-
migration/migration.c | 7 +++++++
migration/ram.c | 8 +-------
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/include/migration/misc.h b/include/migration/misc.h
index 465906710d..8b49841016 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -67,8 +67,10 @@ bool migration_has_failed(MigrationState *);
/* ...and after the device transmission */
bool migration_in_postcopy_after_devices(MigrationState *);
void migration_global_dump(Monitor *mon);
-/* True if incomming migration entered POSTCOPY_INCOMING_DISCARD */
+/* True if incoming migration entered POSTCOPY_INCOMING_DISCARD */
bool migration_in_incoming_postcopy(void);
+/* True if incoming migration entered POSTCOPY_INCOMING_ADVISE */
+bool migration_incoming_postcopy_advised(void);
/* True if background snapshot is active */
bool migration_in_bg_snapshot(void);
diff --git a/migration/migration.c b/migration/migration.c
index 1d33a7efa0..b7677c14a9 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2094,6 +2094,13 @@ bool migration_in_incoming_postcopy(void)
return ps >= POSTCOPY_INCOMING_DISCARD && ps < POSTCOPY_INCOMING_END;
}
+bool migration_incoming_postcopy_advised(void)
+{
+ PostcopyState ps = postcopy_state_get();
+
+ return ps >= POSTCOPY_INCOMING_ADVISE && ps < POSTCOPY_INCOMING_END;
+}
+
bool migration_in_bg_snapshot(void)
{
MigrationState *s = migrate_get_current();
diff --git a/migration/ram.c b/migration/ram.c
index 334309f1c6..e51a7ee0ce 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -4091,12 +4091,6 @@ int ram_load_postcopy(QEMUFile *f, int channel)
return ret;
}
-static bool postcopy_is_advised(void)
-{
- PostcopyState ps = postcopy_state_get();
- return ps >= POSTCOPY_INCOMING_ADVISE && ps < POSTCOPY_INCOMING_END;
-}
-
static bool postcopy_is_running(void)
{
PostcopyState ps = postcopy_state_get();
@@ -4167,7 +4161,7 @@ static int ram_load_precopy(QEMUFile *f)
MigrationIncomingState *mis = migration_incoming_get_current();
int flags = 0, ret = 0, invalid_flags = 0, len = 0, i = 0;
/* ADVISE is earlier, it shows the source has the postcopy capability on */
- bool postcopy_advised = postcopy_is_advised();
+ bool postcopy_advised = migration_incoming_postcopy_advised();
if (!migrate_use_compression()) {
invalid_flags |= RAM_SAVE_FLAG_COMPRESS_PAGE;
}
--
2.39.0
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), (continued)
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Peter Xu, 2023/01/12
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Peter Xu, 2023/01/12
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), David Hildenbrand, 2023/01/13
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Peter Xu, 2023/01/13
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Peter Xu, 2023/01/13
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), David Hildenbrand, 2023/01/16
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Peter Xu, 2023/01/16
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), David Hildenbrand, 2023/01/16
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), David Hildenbrand, 2023/01/13
[PATCH v3 4/8] migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and VMSTATE_BITMAP_TEST(), David Hildenbrand, 2023/01/12
[PATCH v3 5/8] migration/ram: Factor out check for advised postcopy,
David Hildenbrand <=
[PATCH v3 6/8] virtio-mem: Fail if a memory backend with "prealloc=on" is specified, David Hildenbrand, 2023/01/12
[PATCH v3 7/8] virtio-mem: Migrate immutable properties early, David Hildenbrand, 2023/01/12
[PATCH v3 8/8] virtio-mem: Proper support for preallocation with migration, David Hildenbrand, 2023/01/12
Re: [PATCH v3 0/8] virtio-mem: Handle preallocation with migration, David Hildenbrand, 2023/01/12