On Fri, Dec 12, 2025 at 08:33:43PM +0530, Ani Sinha wrote:
> sev_launch_finish() and sev_snp_launch_finish() could be called multiple times
> if the confidential guest is capable of being reset/rebooted. The migration
> blockers should not be added multiple times, once per invocation. This change
> makes sure that the migration blockers are added only one time and not every
> time upon invocvation of launch_finish() calls.
> + static bool added_migration_blocker;
> - error_setg(&sev_mig_blocker,
> - "SEV: Migration is not implemented");
> - migrate_add_blocker(&sev_mig_blocker, &error_fatal);
> + if (!added_migration_blocker) {
> + /* add migration blocker */
> + error_setg(&sev_mig_blocker,
> + "SEV: Migration is not implemented");
> + migrate_add_blocker(&sev_mig_blocker, &error_fatal);
> + added_migration_blocker = true;
> + }
Maybe move this to another place which is called only once? The
migration blocker should not be very sensitive to initialization
ordering, so I'd expect finding another place where you don't need
the added_migration_blocker tracker variable isn't too much of a
problem.
take care,
Gerd