@samitouri / QOSamiQemu / commits / af4cee59fa

colo: Remove ENABLE_COLO savevm command and mark it as deprecated

No need for it anymore now that x-colo capability is required on incoming side. There is also no need to send it for backwards compatibility since we only support COLO with the same version on both sides. We mark the command code as deprecated and now error out if such a unhandled command is encountered in loadvm_process_command(). Reviewed-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Lukas Straub <lukasstraub2@web.de> Link: https://lore.kernel.org/qemu-devel/20260302-colo_unit_test_multifd-v11-5-d653fb3b1d80@web.de Signed-off-by: Fabiano Rosas <farosas@suse.de>

Lukas Straub committed Mar 2, 2026 at 12:43 UTC af4cee59fa7efc14ff7c29d53f6fd677dbdfc861
5 files changed +5 -55
include/migration/colo.h
-2
@@ -25,8 +25,6 @@ void migrate_start_colo_process(MigrationState *s);
25 bool migration_in_colo_state(void);
26
27 /* loadvm */
28 -int migration_incoming_enable_colo(Error **errp);
29 -void migration_incoming_disable_colo(void);
28 bool migration_incoming_in_colo_state(void);
29
30 COLOMode get_colo_mode(void);
migration/migration.c
-31
@@ -604,31 +604,6 @@ int migrate_send_rp_req_pages(MigrationIncomingState *mis,
604 return migrate_send_rp_message_req_pages(mis, rb, start);
605 }
606
607 -static bool migration_colo_enabled;
608 -void migration_incoming_disable_colo(void)
609 -{
610 - ram_block_discard_disable(false);
611 - migration_colo_enabled = false;
612 -}
613 -
614 -int migration_incoming_enable_colo(Error **errp)
615 -{
616 -#ifndef CONFIG_REPLICATION
617 - error_setg(errp, "ENABLE_COLO command come in migration stream, but the "
618 - "replication module is not built in");
619 - return -ENOTSUP;
620 -#endif
621 -
622 - if (!migrate_colo()) {
623 - error_setg(errp, "ENABLE_COLO command come in migration stream"
624 - ", but x-colo capability is not set");
625 - return -EINVAL;
626 - }
627 -
628 - migration_colo_enabled = true;
629 - return 0;
630 -}
631 -
607 void migrate_add_address(SocketAddress *address)
608 {
609 MigrationIncomingState *mis = migration_incoming_get_current();
@@ -735,7 +710,6 @@ static void process_incoming_migration_bh(void *opaque)
710 runstate_set(RUN_STATE_PAUSED);
711 }
712 } else if (migrate_colo()) {
738 - migration_incoming_disable_colo();
713 vm_start();
714 } else {
715 runstate_set(global_state_get_runstate());
@@ -3542,11 +3516,6 @@ static void *migration_thread(void *opaque)
3516 qemu_savevm_send_postcopy_advise(s->to_dst_file);
3517 }
3518
3545 - if (migrate_colo()) {
3546 - /* Notify migration destination that we enable COLO */
3547 - qemu_savevm_send_colo_enable(s->to_dst_file);
3548 - }
3549 -
3519 if (migrate_auto_converge()) {
3520 /* Start RAMBlock dirty bitmap sync timer */
3521 cpu_throttle_dirty_sync_timer(true);
migration/savevm.c
+5 -20
@@ -90,7 +90,7 @@ enum qemu_vm_cmd {
90 were previously sent during
91 precopy but are dirty. */
92 MIG_CMD_PACKAGED, /* Send a wrapped stream within this stream */
93 - MIG_CMD_ENABLE_COLO, /* Enable COLO */
93 + MIG_CMD_DEPRECATED_0, /* Prior to 10.2, used as MIG_CMD_ENABLE_COLO */
94 MIG_CMD_POSTCOPY_RESUME, /* resume postcopy on dest */
95 MIG_CMD_RECV_BITMAP, /* Request for recved bitmap on dst */
96 MIG_CMD_SWITCHOVER_START, /* Switchover start notification */
@@ -1103,12 +1103,6 @@ static void qemu_savevm_command_send(QEMUFile *f,
1103 qemu_fflush(f);
1104 }
1105
1106 -void qemu_savevm_send_colo_enable(QEMUFile *f)
1107 -{
1108 - trace_savevm_send_colo_enable();
1109 - qemu_savevm_command_send(f, MIG_CMD_ENABLE_COLO, 0, NULL);
1110 -}
1111 -
1106 void qemu_savevm_send_ping(QEMUFile *f, uint32_t value)
1107 {
1108 uint32_t buf;
@@ -2423,13 +2417,6 @@ static int loadvm_handle_recv_bitmap(MigrationIncomingState *mis,
2417 return 0;
2418 }
2419
2426 -static int loadvm_process_enable_colo(MigrationIncomingState *mis,
2427 - Error **errp)
2428 -{
2429 - ERRP_GUARD();
2430 - return migration_incoming_enable_colo(errp);
2431 -}
2432 -
2420 static int loadvm_postcopy_handle_switchover_start(Error **errp)
2421 {
2422 SaveStateEntry *se;
@@ -2513,7 +2500,7 @@ static int loadvm_process_command(QEMUFile *f, Error **errp)
2500 return ret;
2501 }
2502 }
2516 - break;
2503 + return 0;
2504
2505 case MIG_CMD_PING:
2506 tmp32 = qemu_get_be32(f);
@@ -2524,7 +2511,7 @@ static int loadvm_process_command(QEMUFile *f, Error **errp)
2511 return -1;
2512 }
2513 migrate_send_rp_pong(mis, tmp32);
2527 - break;
2514 + return 0;
2515
2516 case MIG_CMD_PACKAGED:
2517 return loadvm_handle_cmd_packaged(mis, errp);
@@ -2548,14 +2535,12 @@ static int loadvm_process_command(QEMUFile *f, Error **errp)
2535 case MIG_CMD_RECV_BITMAP:
2536 return loadvm_handle_recv_bitmap(mis, len, errp);
2537
2551 - case MIG_CMD_ENABLE_COLO:
2552 - return loadvm_process_enable_colo(mis, errp);
2553 -
2538 case MIG_CMD_SWITCHOVER_START:
2539 return loadvm_postcopy_handle_switchover_start(errp);
2540 }
2541
2558 - return 0;
2542 + error_setg(errp, "MIG_CMD 0x%x deprecated (len 0x%x)", cmd, len);
2543 + return -EINVAL;
2544 }
2545
2546 /*
migration/savevm.h
-1
@@ -65,7 +65,6 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, const char *name,
65 uint16_t len,
66 uint64_t *start_list,
67 uint64_t *length_list);
68 -void qemu_savevm_send_colo_enable(QEMUFile *f);
68 int qemu_save_device_state(QEMUFile *f, Error **errp);
69 int qemu_loadvm_state(QEMUFile *f, Error **errp);
70 void qemu_loadvm_state_cleanup(MigrationIncomingState *mis);
migration/trace-events
-1
@@ -37,7 +37,6 @@ savevm_send_ping(uint32_t val) "0x%x"
37 savevm_send_postcopy_listen(void) ""
38 savevm_send_postcopy_run(void) ""
39 savevm_send_postcopy_resume(void) ""
40 -savevm_send_colo_enable(void) ""
40 savevm_send_recv_bitmap(char *name) "%s"
41 savevm_send_switchover_start(void) ""
42 savevm_state_setup(void) ""