On 05/06/14 15:27, Ján Tomko wrote:
Not yet merged in upstream QEMU:
https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg05024.html
Add support for invariant TSC timer running at constant rate in
all ACPI P-, C- and T-states.
It can be enabled by specifying:
<clock>
<timer name='invtsc' present='yes'/>
</clock>
in the domain XML.
Migration and saving the domain does not work with this timer.
The support for this timer is indicated by bit 8 of EDX after calling
CPUID with 0x80000007. It does not show up in /proc/cpuinfo [1]
and since we're calling qemu without 'enforce', it doesn't error
out if the host doesn't support this.
Alternatively, we could expose it in libvirt as a cpu flag:
<cpu mode='custom' match='exact'>
<model fallback='forbid'>qemu64</model>
<feature policy='require' name='invtsc'/>
</cpu>
or maybe add +invtsc to qemu args when the 'nonstop_tsc' flag is
requested?
[1]:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch...
---
docs/formatdomain.html.in | 9 ++++++--
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 6 +++--
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 6 +++++
src/qemu/qemu_migration.c | 14 ++++++++++++
.../qemuxml2argv-clock-timer-inv-tsc.args | 5 +++++
.../qemuxml2argv-clock-timer-inv-tsc.xml | 26 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmltest.c | 1 +
10 files changed, 66 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-clock-timer-inv-tsc.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-clock-timer-inv-tsc.xml
...
diff --git a/docs/schemas/domaincommon.rng
b/docs/schemas/domaincommon.rng
index 4249ed5..5154826 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -918,6 +918,7 @@
<choice>
<value>kvmclock</value>
<value>hypervclock</value>
+ <value>invtsc</value>
I'd prefer to change the name of the feature to "invarianttsc" in
libvirt's representation, but that's just bikeshedding.
</choice>
</attribute>
</group>
...
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a9f7fea..c1ffc0f 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1513,6 +1513,20 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr
vm,
return false;
}
+ for (i = 0; i < def->clock.ntimers; i++) {
+ virDomainTimerDefPtr timer = def->clock.timers[i];
+
+ if (timer->present != 1)
+ continue;
+
+ if (timer->name == VIR_DOMAIN_TIMER_NAME_INVTSC) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("domain has '%s' timer"),
+ virDomainTimerNameTypeToString(timer->name));
+ return false;
+ }
+ }
+
return true;
}
It's a shame that this doesn't work across migration in a way HyperV has
designed it.
ACK once the qemu functionality will be released
Peter