@samitouri / QOSamiQemu / commits / 455a6167f2

migration: Fix low possibility downtime violation

When QEMU queried the estimated version of pending data and thinks it's ready to converge, it'll send another accurate query to make sure of it. It is needed to make sure we collect the latest reports and that equation still holds true. However we missed one tiny little difference here on "<" v.s. "<=" when comparing pending_size (A) to threshold_size (B).. QEMU src only re-query if A<B, but will kickoff switchover if A<=B. I think it means it is possible to happen if A (as an estimate only so far) accidentally equals to B, then re-query won't happen and switchover will proceed without considering new dirtied data. It turns out it was an accident in my commit 7aaa1fc072 when refactoring the code around. Fix this by using the same equation in both places. Fixes: 7aaa1fc072 ("migration: Rewrite the migration complete detect logic") Cc: qemu-stable@nongnu.org Reviewed-by: Juraj Marcin <jmarcin@redhat.com> Link: https://lore.kernel.org/r/20260421202110.306051-3-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>

Peter Xu committed Apr 21, 2026 at 16:20 UTC 455a6167f25416ce97ea966d6e8301df9fda9a47
1 file changed +1 -1
migration/migration.c
+1 -1
@@ -3258,7 +3258,7 @@ static MigIterateState migration_iteration_run(MigrationState *s)
3258 * postcopy started, so ESTIMATE should always match with EXACT
3259 * during postcopy phase.
3260 */
3261 - if (pending_size < s->threshold_size) {
3261 + if (pending_size <= s->threshold_size) {
3262 qemu_savevm_state_pending_exact(&must_precopy, &can_postcopy);
3263 pending_size = must_precopy + can_postcopy;
3264 trace_migrate_pending_exact(pending_size, must_precopy,