]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Allow migration with invtsc if tsc frequency is set
authorJiri Denemark <jdenemar@redhat.com>
Fri, 24 Mar 2017 08:27:26 +0000 (09:27 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 27 Mar 2017 18:16:32 +0000 (20:16 +0200)
Migration with invtsc is allowed by QEMU as long as TSC frequency is
explicitly specified.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_migration.c

index 86a66b5ef072d96cc2b2d0b9ed9d6f9d9e4823d9..2aa73e263f384adda9a49baf313c86c8be4a6ac2 100644 (file)
@@ -2473,12 +2473,29 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver,
             return false;
 
         if (vm->def->cpu) {
-            /* QEMU blocks migration and save with invariant TSC enabled */
+            /* QEMU blocks migration and save with invariant TSC enabled
+             * unless TSC frequency is explicitly set.
+             */
             if (virCPUCheckFeature(vm->def->os.arch, vm->def->cpu,
                                    "invtsc") == 1) {
-                virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                               _("domain has 'invtsc' CPU feature"));
-                return false;
+                bool block = true;
+
+                for (i = 0; i < vm->def->clock.ntimers; i++) {
+                    virDomainTimerDefPtr timer = vm->def->clock.timers[i];
+
+                    if (timer->name == VIR_DOMAIN_TIMER_NAME_TSC &&
+                        timer->frequency > 0) {
+                        block = false;
+                        break;
+                    }
+                }
+
+                if (block) {
+                    virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                                   _("domain has 'invtsc' CPU feature but "
+                                     "TSC frequency is not specified"));
+                    return false;
+                }
             }
         }