[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/8] colo: Setup ram cache in normal migration path
From: |
Lukas Straub |
Subject: |
[PATCH 2/8] colo: Setup ram cache in normal migration path |
Date: |
Thu, 22 Jun 2023 14:15:26 +0200 |
Now that x-colo capability needs to be always enabled on the
incoming side we can use that to initialize the ram cache in
the normal migration path.
Signed-off-by: Lukas Straub <lukasstraub2@web.de>
---
migration/migration.c | 16 ++++++++++++----
migration/savevm.c | 10 +---------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index dc05c6f6ea..050bd8ffc8 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -404,10 +404,6 @@ int migration_incoming_enable_colo(void)
return -EINVAL;
}
- if (ram_block_discard_disable(true)) {
- error_report("COLO: cannot disable RAM discard");
- return -EBUSY;
- }
migration_colo_enabled = true;
return 0;
}
@@ -519,6 +515,18 @@ process_incoming_migration_co(void *opaque)
goto fail;
}
+ if (migrate_colo()) {
+ if (ram_block_discard_disable(true)) {
+ error_report("COLO: cannot disable RAM discard");
+ goto fail;
+ }
+
+ if (colo_init_ram_cache() < 0) {
+ error_report("Init ram cache failed");
+ goto fail;
+ }
+ }
+
mis->largest_page_size = qemu_ram_pagesize_largest();
postcopy_state_set(POSTCOPY_INCOMING_NONE);
migrate_set_state(&mis->state, MIGRATION_STATUS_NONE,
diff --git a/migration/savevm.c b/migration/savevm.c
index bc284087f9..155abb0fda 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2302,15 +2302,7 @@ static int
loadvm_handle_recv_bitmap(MigrationIncomingState *mis,
static int loadvm_process_enable_colo(MigrationIncomingState *mis)
{
- int ret = migration_incoming_enable_colo();
-
- if (!ret) {
- ret = colo_init_ram_cache();
- if (ret) {
- migration_incoming_disable_colo();
- }
- }
- return ret;
+ return migration_incoming_enable_colo();
}
/*
--
2.39.2
pgpQUKLtpsEwv.pgp
Description: OpenPGP digital signature
- [PATCH 0/8] colo migration cleanups, Lukas Straub, 2023/06/22
- [PATCH 1/8] colo: Only support the same qemu version on source and destination, Lukas Straub, 2023/06/22
- [PATCH 2/8] colo: Setup ram cache in normal migration path,
Lukas Straub <=
- [PATCH 3/8] colo: Replace migration_incoming_colo_enabled() with migrate_colo(), Lukas Straub, 2023/06/22
- [PATCH 5/8] colo: Don't send ENABLE_COLO command, Lukas Straub, 2023/06/22
- [PATCH 6/8] colo: Reject colo with postcopy capability enabled, Lukas Straub, 2023/06/22
- [PATCH 4/8] colo: Remove ENABLE_COLO loadvm command functions, Lukas Straub, 2023/06/22
- [PATCH 7/8] colo: Reject colo with block migration capability enabled, Lukas Straub, 2023/06/22
- [PATCH 8/8] ram: Remove useless colo special-casing, Lukas Straub, 2023/06/22