diff -Nru qemu-6.2+dfsg/debian/changelog qemu-6.2+dfsg/debian/changelog --- qemu-6.2+dfsg/debian/changelog 2022-09-13 18:23:19.000000000 +1000 +++ qemu-6.2+dfsg/debian/changelog 2022-10-26 15:01:38.000000000 +1000 @@ -1,3 +1,10 @@ +qemu (1:6.2+dfsg-2ubuntu6.5lp1982284b3) jammy; urgency=medium + + * d/p/lp1982284-migration-Read-state-once.patch + (LP: #1982284) + + -- Brett Milford Wed, 26 Oct 2022 05:01:38 +0000 + qemu (1:6.2+dfsg-2ubuntu6.5) jammy; urgency=medium * d/p/u/lp-1981339-*: Fix s390x emulation of newer kernels (LP: #1981339) diff -Nru qemu-6.2+dfsg/debian/patches/lp1982284-migration-Read-state-once.patch qemu-6.2+dfsg/debian/patches/lp1982284-migration-Read-state-once.patch --- qemu-6.2+dfsg/debian/patches/lp1982284-migration-Read-state-once.patch 1970-01-01 10:00:00.000000000 +1000 +++ qemu-6.2+dfsg/debian/patches/lp1982284-migration-Read-state-once.patch 2022-10-26 15:01:25.000000000 +1000 @@ -0,0 +1,92 @@ +From 552de79bfdd5e9e53847eb3c6d6e4cd898a4370e Mon Sep 17 00:00:00 2001 +From: "Dr. David Alan Gilbert" +Date: Wed, 13 Apr 2022 12:33:29 +0100 +Subject: [PATCH] migration: Read state once + +The 'status' field for the migration is updated normally using +an atomic operation from the migration thread. +Most readers of it aren't that careful, and in most cases it doesn't +matter. + +In query_migrate->fill_source_migration_info the 'state' +is read twice; the first time to decide which state fields to fill in, +and then secondly to copy the state to the status field; that can end up +with a status that's inconsistent; e.g. setting up the fields +for 'setup' and then having an 'active' status. In that case +libvirt gets upset by the lack of ram info. +The symptom is: + libvirt.libvirtError: internal error: migration was active, but no RAM info was set + +Read the state exactly once in fill_source_migration_info. + +This is a possible fix for: +https://bugzilla.redhat.com/show_bug.cgi?id=2074205 + +Signed-off-by: Dr. David Alan Gilbert +Message-Id: <20220413113329.103696-1-dgilbert@redhat.com> +Reviewed-by: Juan Quintela +Reviewed-by: Peter Xu +Signed-off-by: Dr. David Alan Gilbert +--- + +From 552de79bfdd5e9e53847eb3c6d6e4cd898a4370e Mon Sep 17 00:00:00 2001 +From: "Dr. David Alan Gilbert" +Date: Wed, 13 Apr 2022 12:33:29 +0100 +Subject: [PATCH] migration: Read state once + +The 'status' field for the migration is updated normally using +an atomic operation from the migration thread. +Most readers of it aren't that careful, and in most cases it doesn't +matter. + +In query_migrate->fill_source_migration_info the 'state' +is read twice; the first time to decide which state fields to fill in, +and then secondly to copy the state to the status field; that can end up +with a status that's inconsistent; e.g. setting up the fields +for 'setup' and then having an 'active' status. In that case +libvirt gets upset by the lack of ram info. +The symptom is: + libvirt.libvirtError: internal error: migration was active, but no RAM info was set + +Read the state exactly once in fill_source_migration_info. + +This is a possible fix for: +https://bugzilla.redhat.com/show_bug.cgi?id=2074205 + +Signed-off-by: Dr. David Alan Gilbert +Message-Id: <20220413113329.103696-1-dgilbert@redhat.com> +Reviewed-by: Juan Quintela +Reviewed-by: Peter Xu +Signed-off-by: Dr. David Alan Gilbert +--- + migration/migration.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/migration/migration.c ++++ b/migration/migration.c +@@ -1056,6 +1056,7 @@ static void populate_disk_info(Migration + static void fill_source_migration_info(MigrationInfo *info) + { + MigrationState *s = migrate_get_current(); ++ int state = qatomic_read(&s->state); + GSList *cur_blocker = migration_blockers; + + info->blocked_reasons = NULL; +@@ -1075,7 +1076,7 @@ static void fill_source_migration_info(M + } + info->has_blocked_reasons = info->blocked_reasons != NULL; + +- switch (s->state) { ++ switch (state) { + case MIGRATION_STATUS_NONE: + /* no migration has happened ever */ + /* do not overwrite destination migration status */ +@@ -1120,7 +1121,7 @@ static void fill_source_migration_info(M + info->has_status = true; + break; + } +- info->status = s->state; ++ info->status = state; + } + + typedef enum WriteTrackingSupport { diff -Nru qemu-6.2+dfsg/debian/patches/series qemu-6.2+dfsg/debian/patches/series --- qemu-6.2+dfsg/debian/patches/series 2022-09-13 18:16:45.000000000 +1000 +++ qemu-6.2+dfsg/debian/patches/series 2022-10-26 14:57:36.000000000 +1000 @@ -46,3 +46,4 @@ ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE.patch ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE_NOCHAIN.patch ubuntu/lp-1981339-target-s390x-Exit-tb-after-executing-ex_value.patch +lp1982284-migration-Read-state-once.patch