[libvirt] [PATCH 1/2] util: replace error with cleanup in virNetlinkCommand
by Wangrui (K)
In funtcion virNetlinkCommand, it uses the word "error" as the goto out
keyword, but it's not an error-handling branch, so, use "cleanup" instead.
Signed-off-by: Zhang Bo <oscar.zhangbo(a)huawei.com>
---
src/util/virnetlink.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 1a09567..4f4dedc 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -212,7 +212,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
_("cannot connect to netlink socket with protocol %d"),
protocol);
rc = -1;
- goto error;
+ goto cleanup;
}
fd = nl_socket_get_fd(nlhandle);
@@ -220,14 +220,14 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
virReportSystemError(errno,
"%s", _("cannot get netlink socket fd"));
rc = -1;
- goto error;
+ goto cleanup ;
}
if (groups && nl_socket_add_membership(nlhandle, groups) < 0) {
virReportSystemError(errno,
"%s", _("cannot add netlink membership"));
rc = -1;
- goto error;
+ goto cleanup;
}
nlmsg_set_dst(nl_msg, &nladdr);
@@ -239,7 +239,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
virReportSystemError(errno,
"%s", _("cannot send to netlink socket"));
rc = -1;
- goto error;
+ goto cleanup;
}
memset(fds, 0, sizeof(fds));
@@ -255,7 +255,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
virReportSystemError(ETIMEDOUT, "%s",
_("no valid netlink response was received"));
rc = -1;
- goto error;
+ goto cleanup;
}
length = nl_recv(nlhandle, &nladdr,
@@ -268,7 +268,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
} else {
*respbuflen = length;
}
- error:
+ cleanup:
if (rc == -1) {
VIR_FREE(*resp);
*resp = NULL;
--
1.7.12.4
10 years, 7 months
[libvirt] [RFC PATCH] Add support for invtsc timer
by Ján Tomko
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/formatdomain.html.in b/docs/formatdomain.html.in
index 4f19473..1d3fd93 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1368,13 +1368,18 @@
being modified, and can be one of
"platform" (currently unsupported),
"hpet" (libxl, xen, qemu), "kvmclock" (qemu),
- "pit" (qemu), "rtc" (qemu), "tsc" (libxl) or "hypervclock"
- (qemu - <span class="since">since 1.2.2</span>).
+ "pit" (qemu), "rtc" (qemu), "tsc" (libxl), "hypervclock"
+ (qemu - <span class="since">since 1.2.2</span>) or
+ "invtsc" (qemu - <span class="since">since 1.2.5</span>).
The <code>hypervclock</code> timer adds support for the
reference time counter and the reference page for iTSC
feature for guests running the Microsoft Windows
operating system.
+
+ The <code>invtsc</code> timer adds support for the invariant
+ TSC. It runs at a constant rate in all ACPI P- C- and T-states.
+ A guest with this timer enabled cannot be migrated or saved.
</dd>
<dt><code>track</code></dt>
<dd>
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>
</choice>
</attribute>
</group>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6c3bdad..893d904 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -706,7 +706,8 @@ VIR_ENUM_IMPL(virDomainTimerName, VIR_DOMAIN_TIMER_NAME_LAST,
"hpet",
"tsc",
"kvmclock",
- "hypervclock");
+ "hypervclock",
+ "invtsc");
VIR_ENUM_IMPL(virDomainTimerTrack, VIR_DOMAIN_TIMER_TRACK_LAST,
"boot",
@@ -2931,7 +2932,8 @@ virDomainDefPostParseInternal(virDomainDefPtr def,
virDomainTimerDefPtr timer = def->clock.timers[i];
if (timer->name == VIR_DOMAIN_TIMER_NAME_KVMCLOCK ||
- timer->name == VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK) {
+ timer->name == VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK ||
+ timer->name == VIR_DOMAIN_TIMER_NAME_INVTSC) {
if (timer->tickpolicy != -1) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("timer %s doesn't support setting of "
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a92f0f3..53c02e6 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1635,6 +1635,7 @@ enum virDomainTimerNameType {
VIR_DOMAIN_TIMER_NAME_TSC,
VIR_DOMAIN_TIMER_NAME_KVMCLOCK,
VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK,
+ VIR_DOMAIN_TIMER_NAME_INVTSC,
VIR_DOMAIN_TIMER_NAME_LAST
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6c1e17d..2994427 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6736,6 +6736,11 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
have_cpu ? "" : default_model,
timer->present ? '+' : '-');
have_cpu = true;
+ } else if (timer->name == VIR_DOMAIN_TIMER_NAME_INVTSC) {
+ virBufferAsprintf(&buf, "%s,%cinvtsc",
+ have_cpu ? "" : default_model,
+ timer->present ? '+' : '-');
+ have_cpu = true;
} else if (timer->name == VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK &&
timer->present) {
virBufferAsprintf(&buf, "%s,hv_time",
@@ -8063,6 +8068,7 @@ qemuBuildCommandLine(virConnectPtr conn,
case VIR_DOMAIN_TIMER_NAME_KVMCLOCK:
case VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK:
+ case VIR_DOMAIN_TIMER_NAME_INVTSC:
/* Timers above are handled when building -cpu. */
case VIR_DOMAIN_TIMER_NAME_LAST:
break;
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;
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-clock-timer-inv-tsc.args b/tests/qemuxml2argvdata/qemuxml2argv-clock-timer-inv-tsc.args
new file mode 100644
index 0000000..ae74ae8
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-timer-inv-tsc.args
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/kvm -S -M pc \
+-cpu qemu32,+invtsc -m 214 -smp 6 \
+-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
+none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-clock-timer-inv-tsc.xml b/tests/qemuxml2argvdata/qemuxml2argv-clock-timer-inv-tsc.xml
new file mode 100644
index 0000000..b4a82e8
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-timer-inv-tsc.xml
@@ -0,0 +1,26 @@
+<domain type='kvm'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>6</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='network'/>
+ </os>
+ <features>
+ <pae/>
+ </features>
+ <clock offset='utc'>
+ <timer name='invtsc' present='yes'/>
+ </clock>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/kvm</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 14482fd..3c5024e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -641,6 +641,7 @@ mymain(void)
DO_TEST("cpu-host-kvmclock", QEMU_CAPS_ENABLE_KVM, QEMU_CAPS_CPU_HOST);
DO_TEST("kvmclock", QEMU_CAPS_KVM);
DO_TEST("clock-timer-hyperv-rtc", QEMU_CAPS_KVM);
+ DO_TEST("clock-timer-inv-tsc", QEMU_CAPS_KVM);
DO_TEST("cpu-eoi-disabled", QEMU_CAPS_ENABLE_KVM);
DO_TEST("cpu-eoi-enabled", QEMU_CAPS_ENABLE_KVM);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 3ea03e6..a659cd0 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -185,6 +185,7 @@ mymain(void)
DO_TEST("clock-catchup");
DO_TEST("kvmclock");
DO_TEST("clock-timer-hyperv-rtc");
+ DO_TEST("clock-timer-inv-tsc");
DO_TEST("cpu-eoi-disabled");
DO_TEST("cpu-eoi-enabled");
--
1.8.3.2
10 years, 7 months
[libvirt] [PATCH] maint: prohibit empty first lines
by Martin Kletzander
I just found this in one of my branches and I remembered I wanted to
send this right after a discussion with Eric, but I forgot, somehow:
https://www.redhat.com/archives/libvir-list/2014-March/msg01001.html
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
cfg.mk | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/cfg.mk b/cfg.mk
index 3f4bba0..b2d12f9 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -929,6 +929,13 @@ sc_prohibit_mixed_case_abbreviations:
halt='Use PCI, USB, SCSI, not Pci, Usb, Scsi' \
$(_sc_search_regexp)
+sc_prohibit_empty_first_line:
+ @awk 'BEGIN { fail=0; } \
+ FNR == 1 { if ($$0 == "") { print FILENAME:1:; fail=1; } } \
+ END { if (fail == 1) { \
+ print "$(ME): Prohibited empty first line" > "/dev/stderr"; \
+ } exit fail; }' $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$');
+
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
--
1.9.2
10 years, 7 months
[libvirt] [PATCH] qemu: Implement a stub cpuArchDriver.compare() handler for arm and aarch64
by Oleg Strikov
Libvirt calls cpuArchDriver.compare() while doing guest migration.
We don't have any logic to distinguish between different arm and
aarch64 models that's why this patch allows migration to any host.
Signed-off-by: Oleg Strikov <oleg.strikov(a)canonical.com>
---
src/cpu/cpu_aarch64.c | 9 ++++++++-
src/cpu/cpu_arm.c | 9 ++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/cpu/cpu_aarch64.c b/src/cpu/cpu_aarch64.c
index 3c3e749..7255d9f 100644
--- a/src/cpu/cpu_aarch64.c
+++ b/src/cpu/cpu_aarch64.c
@@ -108,11 +108,18 @@ AArch64Baseline(virCPUDefPtr *cpus,
return cpu;
}
+static virCPUCompareResult
+AArch64Compare(virCPUDefPtr host ATTRIBUTE_UNUSED,
+ virCPUDefPtr cpu ATTRIBUTE_UNUSED)
+{
+ return VIR_CPU_COMPARE_IDENTICAL;
+}
+
struct cpuArchDriver cpuDriverAARCH64 = {
.name = "aarch64",
.arch = archs,
.narch = ARRAY_CARDINALITY(archs),
- .compare = NULL,
+ .compare = AArch64Compare,
.decode = AArch64Decode,
.encode = NULL,
.free = AArch64DataFree,
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index ec80b35..53bf4f4 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -109,11 +109,18 @@ ArmBaseline(virCPUDefPtr *cpus,
return cpu;
}
+static virCPUCompareResult
+ArmCompare(virCPUDefPtr host ATTRIBUTE_UNUSED,
+ virCPUDefPtr cpu ATTRIBUTE_UNUSED)
+{
+ return VIR_CPU_COMPARE_IDENTICAL;
+}
+
struct cpuArchDriver cpuDriverArm = {
.name = "arm",
.arch = archs,
.narch = ARRAY_CARDINALITY(archs),
- .compare = NULL,
+ .compare = ArmCompare,
.decode = ArmDecode,
.encode = NULL,
.free = ArmDataFree,
--
1.7.9.5
10 years, 7 months
[libvirt] [PATCH 0/4] esx, vmware: conditionally allow newer virtualHW versions
by Martin Kletzander
With this one should be able to connect with
e.g. 'esx://localhost?allow_unsafe=1' to newer ESX hypervisor than supported.
Docs are in [1/4] and [2/4] with esx and vmware changes, respectively.
Reason for the parameter is explained in [3/4].
Tests are in [4/4].
Martin Kletzander (4):
esx: parse new URI param 'allow_unsafe'
vmware: parse new URI param 'allow_unsafe'
vmx: allow version safety bypass with allowUnsafe
tests: vmx support for allowUnsafe
docs/drvesx.html.in | 14 ++++++++++++++
docs/drvvmware.html.in | 35 +++++++++++++++++++++++++++++++++++
src/esx/esx_driver.c | 6 ++++--
src/esx/esx_util.c | 13 ++++++++++++-
src/esx/esx_util.h | 2 ++
src/vmware/vmware_conf.c | 4 ++--
src/vmware/vmware_conf.h | 2 ++
src/vmware/vmware_driver.c | 20 ++++++++++++++++++--
src/vmx/vmx.c | 24 ++++++++++++++++++------
src/vmx/vmx.h | 4 +++-
tests/vmx2xmldata/vmx2xml-unsafe.vmx | 2 ++
tests/vmx2xmldata/vmx2xml-unsafe.xml | 18 ++++++++++++++++++
tests/vmx2xmltest.c | 36 +++++++++++++++++++++++++++++++-----
13 files changed, 161 insertions(+), 19 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-unsafe.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-unsafe.xml
--
1.9.2
10 years, 7 months
[libvirt] [PATCH] ESX: add virStorageVolGetInfo in iSCSI backend.
by Dawid Zamirski
Since the ESX storage implements VMFS and iSCSI storage backends and
chooses relevant backend dynamically at runtime, there was a segfault
when issuing vol-info on iSCSI volume due to unimplemented
virStorageGetInfo function. This patch implements that function that was
missing in iSCSI backend and returns expected result without a segfault.
---
src/esx/esx_storage_backend_iscsi.c | 47 +++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_backend_iscsi.c
index 4619629..3d31908 100644
--- a/src/esx/esx_storage_backend_iscsi.c
+++ b/src/esx/esx_storage_backend_iscsi.c
@@ -621,6 +621,52 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool ATTRIBUTE_UNUSED,
+static int
+esxStorageVolGetInfo(virStorageVolPtr volume,
+ virStorageVolInfoPtr info)
+{
+ int result = -1;
+ esxPrivate *priv = volume->conn->storagePrivateData;
+ esxVI_ScsiLun *scsiLunList = NULL;
+ esxVI_ScsiLun *scsiLun;
+ esxVI_HostScsiDisk *hostScsiDisk = NULL;
+
+ if (esxVI_LookupScsiLunList(priv->primary, &scsiLunList) < 0) {
+ goto cleanup;
+ }
+
+ for (scsiLun = scsiLunList; scsiLun;
+ scsiLun = scsiLun->_next) {
+ hostScsiDisk = esxVI_HostScsiDisk_DynamicCast(scsiLun);
+
+ if (hostScsiDisk &&
+ STREQ(hostScsiDisk->deviceName, volume->name)) {
+ break;
+ }
+ }
+
+ if (!hostScsiDisk) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not find volume with name: %s"),
+ volume->name);
+ goto cleanup;
+ }
+
+ info->type = VIR_STORAGE_VOL_BLOCK;
+ info->capacity = hostScsiDisk->capacity->block->value *
+ hostScsiDisk->capacity->blockSize->value;
+ info->allocation = info->capacity;
+
+ result = 0;
+
+ cleanup:
+ esxVI_ScsiLun_Free(&scsiLunList);
+
+ return result;
+}
+
+
+
static char *
esxStorageVolGetXMLDesc(virStorageVolPtr volume,
unsigned int flags)
@@ -752,6 +798,7 @@ virStorageDriver esxStorageBackendISCSI = {
.storageVolLookupByKey = esxStorageVolLookupByKey, /* 1.0.1 */
.storageVolCreateXML = esxStorageVolCreateXML, /* 1.0.1 */
.storageVolCreateXMLFrom = esxStorageVolCreateXMLFrom, /* 1.0.1 */
+ .storageVolGetInfo = esxStorageVolGetInfo, /* 1.2.4 */
.storageVolGetXMLDesc = esxStorageVolGetXMLDesc, /* 1.0.1 */
.storageVolDelete = esxStorageVolDelete, /* 1.0.1 */
.storageVolWipe = esxStorageVolWipe, /* 1.0.1 */
--
1.9.0
10 years, 7 months
[libvirt] technicality
by ENGLISH, Sean Matthew
Hi,
Is it accurate to say that:
*To virtualize the hardware memory, VMware ESX forces the real hardware MMU
point to the shadow page table.*
I guess it's true, isn't it?
Sincerely,
Matthew
10 years, 7 months
[libvirt] [Solved]:LibvirtError: Operation not supported : JSON monitor is required
by xeon_feng
Hello everyone
I have solved the problem(LibvirtError: Operation not supported : JSON monitor is required).
yajl-devel package must be intalled before compile and install libvirt 1.2.4 .....
then rebuild and install libvirt-python 1.2.4
every thing is OK.....
Hi
Thanks for chenhanxiao(a)cn.fujitsu.com help , I have resole the problem (libvirt 1.2.4 and virt-manager 0.9.0 are not incompatible)..but when I created VM by virt-manager ,it reported :
unable to complete install: 'Opertation not supported: JSON monitor is required.'
Traceback(most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py",line 44, in cb_wrapper callback(asyncjob, *args, **kwargs)
......
LibvirtError: Operation not supported : JSON monitor is required.
what is wrong ?
Please help me....... Tanks a lot ....
Xeon.Feng
last problem: libvirt 1.2.4 and virt-manager 0.9.0 are not incompatible
""""""""""
Hello everyone
I encountered a problem when I completed the update of libvirt from 0.10 to 1.2.4 .
The problem was that virt-manager(version 0.9.0) could not start and reported error : "ImportError: /usr/lib64/libvirt.so.0: version 'LIBVIRT_PRIVIATE_0.10.2' not found (required by /usr/lib64/python2.6/site-packages/libvirtmod.so)".
I found the libvirt.so.0 link file just in the /usr/lib64/ directory , but it was linking to libvirt.so.0.1002.4 .not to the libvirt.so.0.10.2
I made libvirt.so.0 to link to libvirt.so.0.10.2 and restarted virt-manager , virt-manager started normally then restarted libvirtd failure, reporting error:l “ibvirtd: /usr/lib64/libvirt.so.0: version 'LIBVIRT_1.2.3' not found (require by libvirtd) .....”
I made libvirt.so.0 to link to libvirt.so.0.1002.4 and restart libvirtd , libvirtd started normally again.
Please help me to resolve the problem and give me some advise....
Thanks a lot..
Xeon.Feng
"""""""
10 years, 7 months
[libvirt] [PATCH v2] Add invariant TSC cpu flag
by Ján Tomko
Add suport for invariant TSC flag (CPUID 0x80000007, bit 8 of EDX).
If this flag is enabled, the TSC ticks at a constant rate across
all ACPI P-, C- and T-states.
This can be enabled by adding:
<feature name='invtsc'/>
to the <cpu> element.
Migration and saving the domain does not work with this flag.
QEMU support for this is not merged yet:
https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg05024.html
The feature name "invtsc" differs from the name "" used by the linux kernel:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch...
---
v1: https://www.redhat.com/archives/libvir-list/2014-May/msg00183.html
src/cpu/cpu_map.xml | 5 +++++
src/qemu/qemu_migration.c | 14 ++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index 7d34d40..ffaeb92 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -327,6 +327,11 @@
<cpuid function='0x00000007' ebx='0x00100000'/>
</feature>
+ <!-- Advanced Power Management edx features -->
+ <feature name='invtsc'>
+ <cpuid function='0x80000007' edx='0x00000100'/>
+ </feature>
+
<!-- models -->
<model name='486'>
<feature name='fpu'/>
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a9f7fea..9ae3047 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->cpu->nfeatures; i++) {
+ virCPUFeatureDefPtr feature = &def->cpu->features[i];
+
+ if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
+ continue;
+
+ if (STREQ(feature->name, "invtsc")) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("domain has CPU feature: %s"),
+ feature->name);
+ return false;
+ }
+ }
+
return true;
}
--
1.8.3.2
10 years, 7 months