[PATCH 4/4] qemu: Allow migration with invtsc if tsc frequency is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Migration with invtsc is allowed by QEMU as long as TSC frequency is
explicitly specified.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 1e052a197..924929632 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2324,12 +2324,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;
+                }
             }
         }
 
-- 
2.12.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux