[libvirt] [PATCH] Add support for virtio-net.tx_queue_size
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1460323
Just like I've added support for setting rx_queue_size (in
c56cdf259 and friends), qemu just gained support for setting tx
ring size.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/formatdomain.html.in | 16 +++++++++++++++-
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 16 ++++++++++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 8 ++++++++
src/qemu/qemu_domain.c | 16 +++++++++++-----
...e.args => qemuxml2argv-net-virtio-rxtxqueuesize.args} | 4 ++--
...ize.xml => qemuxml2argv-net-virtio-rxtxqueuesize.xml} | 2 +-
tests/qemuxml2argvtest.c | 5 +++--
...e.xml => qemuxml2xmlout-net-virtio-rxtxqueuesize.xml} | 2 +-
tests/qemuxml2xmltest.c | 2 +-
13 files changed, 67 insertions(+), 13 deletions(-)
rename tests/qemuxml2argvdata/{qemuxml2argv-net-virtio-rxqueuesize.args => qemuxml2argv-net-virtio-rxtxqueuesize.args} (85%)
rename tests/qemuxml2argvdata/{qemuxml2argv-net-virtio-rxqueuesize.xml => qemuxml2argv-net-virtio-rxtxqueuesize.xml} (93%)
rename tests/qemuxml2xmloutdata/{qemuxml2xmlout-net-virtio-rxqueuesize.xml => qemuxml2xmlout-net-virtio-rxtxqueuesize.xml} (96%)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 7f4bc1d21..d37c89eff 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5065,7 +5065,7 @@ qemu-kvm -net nic,model=? /dev/null
<source network='default'/>
<target dev='vnet1'/>
<model type='virtio'/>
- <b><driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5' rx_queue_size='256'>
+ <b><driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5' rx_queue_size='256' tx_queue_size='256'>
<host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off' mrg_rxbuf='off'/>
<guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
</driver>
@@ -5195,6 +5195,20 @@ qemu-kvm -net nic,model=? /dev/null
<b>In general you should leave this option alone, unless you
are very certain you know what you are doing.</b>
</dd>
+ <dt><code>tx_queue_size</code></dt>
+ <dd>
+ The optional <code>tx_queue_size</code> attribute controls
+ the size of virtio ring for each queue as described above.
+ The default value is hypervisor dependent and may change
+ across its releases. Moreover, some hypervisors may pose
+ some restrictions on actual value. For instance, latest
+ QEMU (as of 2017-07-13) requires value to be a power of two
+ from [256, 1024] range.
+ <span class="since">Since 3.6.0 (QEMU and KVM only)</span><br/><br/>
+
+ <b>In general you should leave this option alone, unless you
+ are very certain you know what you are doing.</b>
+ </dd>
<dt>virtio options</dt>
<dd>
For virtio interfaces,
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 77136108a..7e133a8c1 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2702,6 +2702,11 @@
<ref name='positiveInteger'/>
</attribute>
</optional>
+ <optional>
+ <attribute name='tx_queue_size'>
+ <ref name='positiveInteger'/>
+ </attribute>
+ </optional>
<optional>
<attribute name="txmode">
<choice>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 570cc5c93..7cf638da4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9863,6 +9863,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
char *event_idx = NULL;
char *queues = NULL;
char *rx_queue_size = NULL;
+ char *tx_queue_size = NULL;
char *str = NULL;
char *filter = NULL;
char *internal = NULL;
@@ -10036,6 +10037,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
event_idx = virXMLPropString(cur, "event_idx");
queues = virXMLPropString(cur, "queues");
rx_queue_size = virXMLPropString(cur, "rx_queue_size");
+ tx_queue_size = virXMLPropString(cur, "tx_queue_size");
} else if (xmlStrEqual(cur->name, BAD_CAST "filterref")) {
if (filter) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -10433,6 +10435,16 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
}
def->driver.virtio.rx_queue_size = q;
}
+ if (tx_queue_size) {
+ unsigned int q;
+ if (virStrToLong_uip(tx_queue_size, NULL, 10, &q) < 0) {
+ virReportError(VIR_ERR_XML_DETAIL,
+ _("'tx_queue_size' attribute must be positive number: %s"),
+ tx_queue_size);
+ goto error;
+ }
+ def->driver.virtio.tx_queue_size = q;
+ }
if ((str = virXPathString("string(./driver/host/@csum)", ctxt))) {
if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -10630,6 +10642,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
VIR_FREE(event_idx);
VIR_FREE(queues);
VIR_FREE(rx_queue_size);
+ VIR_FREE(tx_queue_size);
VIR_FREE(str);
VIR_FREE(filter);
VIR_FREE(type);
@@ -22497,6 +22510,9 @@ virDomainVirtioNetDriverFormat(char **outstr,
if (def->driver.virtio.rx_queue_size)
virBufferAsprintf(&buf, " rx_queue_size='%u'",
def->driver.virtio.rx_queue_size);
+ if (def->driver.virtio.tx_queue_size)
+ virBufferAsprintf(&buf, " tx_queue_size='%u'",
+ def->driver.virtio.tx_queue_size);
virDomainVirtioOptionsFormat(&buf, def->virtio);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 1baf85453..1cb8b802c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -967,6 +967,7 @@ struct _virDomainNetDef {
virTristateSwitch event_idx;
unsigned int queues; /* Multiqueue virtio-net */
unsigned int rx_queue_size;
+ unsigned int tx_queue_size;
struct {
virTristateSwitch csum;
virTristateSwitch gso;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index db9f9b8b1..f502dd464 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -430,6 +430,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"virtio.iommu_platform",
"virtio.ats",
"loadparm",
+ "virtio-net.tx_queue_size",
);
@@ -1695,6 +1696,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioNet[] = {
{ "tx", QEMU_CAPS_VIRTIO_TX_ALG },
{ "event_idx", QEMU_CAPS_VIRTIO_NET_EVENT_IDX },
{ "rx_queue_size", QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE },
+ { "tx_queue_size", QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE },
{ "host_mtu", QEMU_CAPS_VIRTIO_NET_HOST_MTU },
};
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index fb22815e9..63e792a19 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -416,6 +416,7 @@ typedef enum {
QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, /* virtio-*-pci.iommu_platform */
QEMU_CAPS_VIRTIO_PCI_ATS, /* virtio-*-pci.ats */
QEMU_CAPS_LOADPARM, /* -machine loadparm */
+ QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE, /* virtio-net-*.tx_queue_size */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e290abff6..43fba3b0a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3790,6 +3790,14 @@ qemuBuildNicDevStr(virDomainDefPtr def,
}
virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size);
}
+ if (usingVirtio && net->driver.virtio.tx_queue_size) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtio tx_queue_size option is not supported with this QEMU binary"));
+ goto error;
+ }
+ virBufferAsprintf(&buf, ",tx_queue_size=%u", net->driver.virtio.tx_queue_size);
+ }
if (usingVirtio && net->mtu) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ae260de00..b17727811 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3169,11 +3169,17 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
goto cleanup;
}
- if (STREQ_NULLABLE(net->model, "virtio") &&
- net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_queue_size - 1)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("rx_queue_size has to be a power of two"));
- goto cleanup;
+ if (STREQ_NULLABLE(net->model, "virtio")) {
+ if (net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_queue_size - 1)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("rx_queue_size has to be a power of two"));
+ goto cleanup;
+ }
+ if (net->driver.virtio.tx_queue_size & (net->driver.virtio.tx_queue_size - 1)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("tx_queue_size has to be a power of two"));
+ goto cleanup;
+ }
}
if (net->mtu &&
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.args
similarity index 85%
rename from tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args
rename to tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.args
index 07c358a02..c78da3d17 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.args
@@ -21,7 +21,7 @@ server,nowait \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--device virtio-net-pci,rx_queue_size=512,vlan=0,id=net0,mac=00:11:22:33:44:55,\
-bus=pci.0,addr=0x3 \
+-device virtio-net-pci,rx_queue_size=512,tx_queue_size=1024,vlan=0,id=net0,\
+mac=00:11:22:33:44:55,bus=pci.0,addr=0x3 \
-net user,vlan=0,name=hostnet0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.xml
similarity index 93%
rename from tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.xml
rename to tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.xml
index d64e31df2..b51931d52 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.xml
@@ -22,7 +22,7 @@
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
<model type='virtio'/>
- <driver rx_queue_size='512'/>
+ <driver rx_queue_size='512' tx_queue_size='1024'/>
</interface>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 302c9c892..8ad2ca71b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1146,8 +1146,9 @@ mymain(void)
QEMU_CAPS_VIRTIO_S390);
DO_TEST("net-virtio-ccw",
QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
- DO_TEST("net-virtio-rxqueuesize",
- QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE);
+ DO_TEST("net-virtio-rxtxqueuesize",
+ QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE,
+ QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE);
DO_TEST_PARSE_ERROR("net-virtio-rxqueuesize-invalid-size", NONE);
DO_TEST("net-eth", NONE);
DO_TEST("net-eth-ifname", NONE);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxqueuesize.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxtxqueuesize.xml
similarity index 96%
rename from tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxqueuesize.xml
rename to tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxtxqueuesize.xml
index 78433026c..5c33a58ad 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxqueuesize.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxtxqueuesize.xml
@@ -29,7 +29,7 @@
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
<model type='virtio'/>
- <driver rx_queue_size='512'/>
+ <driver rx_queue_size='512' tx_queue_size='1024'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<input type='mouse' bus='ps2'/>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 79347671f..578b07a95 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -523,7 +523,7 @@ mymain(void)
DO_TEST("net-eth-ifname", NONE);
DO_TEST("net-eth-hostip", NONE);
DO_TEST("net-virtio-network-portgroup", NONE);
- DO_TEST("net-virtio-rxqueuesize", NONE);
+ DO_TEST("net-virtio-rxtxqueuesize", NONE);
DO_TEST("net-hostdev", NONE);
DO_TEST("net-hostdev-vfio", NONE);
DO_TEST("net-midonet", NONE);
--
2.13.0
7 years, 5 months
[libvirt] [PATCH] cpu_x86: Properly disable unknown CPU features
by Jiri Denemark
CPU features unknown to a hypervisor will not be present in dataDisabled
even though the feature won't naturally be enabled because it is
unknown. Thus any features we asked for which are not in dataEnabled
should be considered disabled.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/cpu/cpu_x86.c | 9 +-
tests/cputest.c | 1 +
.../x86_64-cpuid-Core-i7-5600U-arat-disabled.xml | 5 +
.../x86_64-cpuid-Core-i7-5600U-arat-enabled.xml | 8 +
.../x86_64-cpuid-Core-i7-5600U-arat-guest.xml | 29 +++
.../x86_64-cpuid-Core-i7-5600U-arat-host.xml | 30 +++
.../x86_64-cpuid-Core-i7-5600U-arat-json.xml | 14 ++
.../x86_64-cpuid-Core-i7-5600U-arat.json | 202 +++++++++++++++++++++
.../x86_64-cpuid-Core-i7-5600U-arat.xml | 41 +++++
9 files changed, 335 insertions(+), 4 deletions(-)
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 53359ff9b..286445421 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2664,12 +2664,11 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
x86DataCopy(&disabled, &dataDisabled->data.x86) < 0)
goto cleanup;
- x86DataSubtract(&enabled, &model->data);
-
for (i = 0; i < map->nfeatures; i++) {
virCPUx86FeaturePtr feature = map->features[i];
- if (x86DataIsSubset(&enabled, &feature->data)) {
+ if (x86DataIsSubset(&enabled, &feature->data) &&
+ !x86DataIsSubset(&model->data, &feature->data)) {
VIR_DEBUG("Feature '%s' enabled by the hypervisor", feature->name);
if (cpu->check == VIR_CPU_CHECK_FULL)
virBufferAsprintf(&bufAdded, "%s,", feature->name);
@@ -2678,7 +2677,9 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
goto cleanup;
}
- if (x86DataIsSubset(&disabled, &feature->data)) {
+ if (x86DataIsSubset(&disabled, &feature->data) ||
+ (x86DataIsSubset(&model->data, &feature->data) &&
+ !x86DataIsSubset(&enabled, &feature->data))) {
VIR_DEBUG("Feature '%s' disabled by the hypervisor", feature->name);
if (cpu->check == VIR_CPU_CHECK_FULL)
virBufferAsprintf(&bufRemoved, "%s,", feature->name);
diff --git a/tests/cputest.c b/tests/cputest.c
index 89c645e64..ebcade6be 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -991,6 +991,7 @@ mymain(void)
DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4600U", true);
DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4510U", true);
DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U", true);
+ DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U-arat", true);
DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-E6850", true);
DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-Q9500", false);
DO_TEST_CPUID(VIR_ARCH_X86_64, "FX-8150", false);
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml
new file mode 100644
index 000000000..4a0477f78
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml
@@ -0,0 +1,5 @@
+<!-- Features disabled by QEMU -->
+<cpudata arch='x86'>
+ <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0800c1dc' edx='0xb0600000'/>
+ <cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml
new file mode 100644
index 000000000..5cffacef5
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml
@@ -0,0 +1,8 @@
+<!-- Features enabled by QEMU -->
+<cpudata arch='x86'>
+ <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0xf7fa3223' edx='0x0f8bfbff'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x001c0fbb' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000001' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x40000001' ecx_in='0x00' eax='0x010000fa' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/>
+</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml
new file mode 100644
index 000000000..877895cf1
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml
@@ -0,0 +1,29 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='forbid'>Broadwell</model>
+ <vendor>Intel</vendor>
+ <feature policy='require' name='vme'/>
+ <feature policy='require' name='ds'/>
+ <feature policy='require' name='acpi'/>
+ <feature policy='require' name='ss'/>
+ <feature policy='require' name='ht'/>
+ <feature policy='require' name='tm'/>
+ <feature policy='require' name='pbe'/>
+ <feature policy='require' name='dtes64'/>
+ <feature policy='require' name='monitor'/>
+ <feature policy='require' name='ds_cpl'/>
+ <feature policy='require' name='vmx'/>
+ <feature policy='require' name='smx'/>
+ <feature policy='require' name='est'/>
+ <feature policy='require' name='tm2'/>
+ <feature policy='require' name='xtpr'/>
+ <feature policy='require' name='pdcm'/>
+ <feature policy='require' name='osxsave'/>
+ <feature policy='require' name='f16c'/>
+ <feature policy='require' name='rdrand'/>
+ <feature policy='require' name='arat'/>
+ <feature policy='require' name='tsc_adjust'/>
+ <feature policy='require' name='xsaveopt'/>
+ <feature policy='require' name='pdpe1gb'/>
+ <feature policy='require' name='abm'/>
+ <feature policy='require' name='invtsc'/>
+</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
new file mode 100644
index 000000000..9b24941e0
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml
@@ -0,0 +1,30 @@
+<cpu>
+ <arch>x86_64</arch>
+ <model>Broadwell</model>
+ <vendor>Intel</vendor>
+ <feature name='vme'/>
+ <feature name='ds'/>
+ <feature name='acpi'/>
+ <feature name='ss'/>
+ <feature name='ht'/>
+ <feature name='tm'/>
+ <feature name='pbe'/>
+ <feature name='dtes64'/>
+ <feature name='monitor'/>
+ <feature name='ds_cpl'/>
+ <feature name='vmx'/>
+ <feature name='smx'/>
+ <feature name='est'/>
+ <feature name='tm2'/>
+ <feature name='xtpr'/>
+ <feature name='pdcm'/>
+ <feature name='osxsave'/>
+ <feature name='f16c'/>
+ <feature name='rdrand'/>
+ <feature name='arat'/>
+ <feature name='tsc_adjust'/>
+ <feature name='xsaveopt'/>
+ <feature name='pdpe1gb'/>
+ <feature name='abm'/>
+ <feature name='invtsc'/>
+</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml
new file mode 100644
index 000000000..4f253fc08
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml
@@ -0,0 +1,14 @@
+<cpu mode='custom' match='exact'>
+ <model fallback='forbid'>Broadwell</model>
+ <vendor>Intel</vendor>
+ <feature policy='require' name='vme'/>
+ <feature policy='require' name='ss'/>
+ <feature policy='require' name='vmx'/>
+ <feature policy='require' name='f16c'/>
+ <feature policy='require' name='rdrand'/>
+ <feature policy='require' name='hypervisor'/>
+ <feature policy='require' name='tsc_adjust'/>
+ <feature policy='require' name='xsaveopt'/>
+ <feature policy='require' name='pdpe1gb'/>
+ <feature policy='require' name='abm'/>
+</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json
new file mode 100644
index 000000000..f2aa7f318
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json
@@ -0,0 +1,202 @@
+{
+ "return": {
+ "model": {
+ "name": "base",
+ "props": {
+ "pfthreshold": false,
+ "pku": false,
+ "rtm": true,
+ "tsc_adjust": true,
+ "tsc-deadline": true,
+ "xstore-en": false,
+ "tsc-scale": false,
+ "sse": true,
+ "smap": true,
+ "stepping": 4,
+ "tce": false,
+ "kvm_steal_time": true,
+ "smep": true,
+ "rdpid": false,
+ "xcrypt": false,
+ "sse4_2": true,
+ "monitor": false,
+ "sse4_1": true,
+ "kvm-mmu": false,
+ "flushbyasid": false,
+ "kvm-steal-time": true,
+ "lm": true,
+ "tsc": true,
+ "adx": true,
+ "fxsr": true,
+ "sha-ni": false,
+ "tm": false,
+ "pclmuldq": true,
+ "xgetbv1": false,
+ "xstore": false,
+ "vmcb_clean": false,
+ "vme": true,
+ "vendor": "GenuineIntel",
+ "ffxsr": false,
+ "de": true,
+ "avx512f": false,
+ "pse": true,
+ "ds-cpl": false,
+ "tbm": false,
+ "ia64": false,
+ "phe-en": false,
+ "f16c": true,
+ "ds": false,
+ "mpx": false,
+ "tsc-adjust": true,
+ "aes": true,
+ "avx2": true,
+ "pbe": false,
+ "cx16": true,
+ "ds_cpl": false,
+ "movbe": true,
+ "perfctr-nb": false,
+ "nrip_save": false,
+ "kvm_mmu": false,
+ "ospke": false,
+ "avx512ifma": false,
+ "vmx": true,
+ "sep": true,
+ "xsaveopt": true,
+ "sse4a": false,
+ "avx512dq": false,
+ "i64": true,
+ "avx512-4vnniw": false,
+ "xsave": true,
+ "erms": true,
+ "hle": true,
+ "nodeid_msr": false,
+ "est": false,
+ "svm_lock": false,
+ "xop": false,
+ "model-id": "Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz",
+ "abm": true,
+ "avx512er": false,
+ "sse4.1": true,
+ "sse4.2": true,
+ "pause-filter": false,
+ "lahf-lm": true,
+ "kvm-nopiodelay": true,
+ "cmp_legacy": false,
+ "acpi": false,
+ "fma4": false,
+ "popcnt": true,
+ "mmx": true,
+ "osxsave": false,
+ "pcommit": false,
+ "avx512pf": false,
+ "clwb": false,
+ "dca": false,
+ "pdcm": false,
+ "xcrypt-en": false,
+ "3dnow": false,
+ "invtsc": false,
+ "tm2": false,
+ "hypervisor": true,
+ "kvmclock-stable-bit": true,
+ "fxsr-opt": false,
+ "pcid": true,
+ "sse4-1": true,
+ "sse4-2": true,
+ "avx512-vpopcntdq": false,
+ "avx512-4fmaps": false,
+ "pause_filter": false,
+ "svm-lock": false,
+ "rdrand": true,
+ "nrip-save": false,
+ "avx512vl": false,
+ "x2apic": true,
+ "kvmclock": true,
+ "pge": true,
+ "family": 6,
+ "dtes64": false,
+ "xd": true,
+ "kvm_pv_eoi": true,
+ "ace2": false,
+ "kvm_pv_unhalt": true,
+ "xtpr": false,
+ "perfctr_nb": false,
+ "avx512bw": false,
+ "nx": true,
+ "lwp": false,
+ "msr": true,
+ "ace2-en": false,
+ "decodeassists": false,
+ "perfctr-core": false,
+ "pn": false,
+ "fma": true,
+ "nodeid-msr": false,
+ "kvm_asyncpf": true,
+ "clflush": true,
+ "cx8": true,
+ "mce": true,
+ "avx512cd": false,
+ "cr8legacy": false,
+ "mca": true,
+ "pni": true,
+ "rdseed": true,
+ "apic": true,
+ "fsgsbase": true,
+ "cmp-legacy": false,
+ "kvm-pv-unhalt": true,
+ "rdtscp": true,
+ "mmxext": false,
+ "cid": false,
+ "ssse3": true,
+ "extapic": false,
+ "pse36": true,
+ "mtrr": true,
+ "ibs": false,
+ "la57": false,
+ "avx": true,
+ "syscall": true,
+ "umip": false,
+ "invpcid": true,
+ "avx512vbmi": false,
+ "kvm-asyncpf": true,
+ "vmcb-clean": false,
+ "pmm": false,
+ "cmov": true,
+ "perfctr_core": false,
+ "misalignsse": false,
+ "clflushopt": false,
+ "pat": true,
+ "lbrv": false,
+ "3dnowprefetch": true,
+ "fpu": true,
+ "pae": true,
+ "wdt": false,
+ "tsc_scale": false,
+ "skinit": false,
+ "fxsr_opt": false,
+ "kvm_nopiodelay": true,
+ "pmm-en": false,
+ "phe": false,
+ "3dnowext": false,
+ "osvw": false,
+ "ht": false,
+ "pdpe1gb": true,
+ "kvm-pv-eoi": true,
+ "npt": false,
+ "xsavec": false,
+ "lahf_lm": true,
+ "pclmulqdq": true,
+ "svm": false,
+ "sse3": true,
+ "sse2": true,
+ "ss": true,
+ "topoext": false,
+ "smx": false,
+ "bmi1": true,
+ "bmi2": true,
+ "xsaves": false,
+ "model": 61
+ }
+ }
+ },
+ "id": "model-expansion"
+}
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml
new file mode 100644
index 000000000..ecb4a6e15
--- /dev/null
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml
@@ -0,0 +1,41 @@
+<!-- Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz -->
+<cpudata arch='x86'>
+ <cpuid eax_in='0x00000000' ecx_in='0x00' eax='0x00000014' ebx='0x756e6547' ecx='0x6c65746e' edx='0x49656e69'/>
+ <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x000306d4' ebx='0x00100800' ecx='0x7ffafbff' edx='0xbfebfbff'/>
+ <cpuid eax_in='0x00000002' ecx_in='0x00' eax='0x76036301' ebx='0x00f0b5ff' ecx='0x00000000' edx='0x00c30000'/>
+ <cpuid eax_in='0x00000003' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000004' ecx_in='0x00' eax='0x1c004121' ebx='0x01c0003f' ecx='0x0000003f' edx='0x00000000'/>
+ <cpuid eax_in='0x00000004' ecx_in='0x01' eax='0x1c004122' ebx='0x01c0003f' ecx='0x0000003f' edx='0x00000000'/>
+ <cpuid eax_in='0x00000004' ecx_in='0x02' eax='0x1c004143' ebx='0x01c0003f' ecx='0x000001ff' edx='0x00000000'/>
+ <cpuid eax_in='0x00000004' ecx_in='0x03' eax='0x1c03c163' ebx='0x03c0003f' ecx='0x00000fff' edx='0x00000006'/>
+ <cpuid eax_in='0x00000005' ecx_in='0x00' eax='0x00000040' ebx='0x00000040' ecx='0x00000003' edx='0x11142120'/>
+ <cpuid eax_in='0x00000006' ecx_in='0x00' eax='0x00000077' ebx='0x00000002' ecx='0x00000009' edx='0x00000000'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x021c2fbb' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000009' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000a' ecx_in='0x00' eax='0x07300403' ebx='0x00000000' ecx='0x00000000' edx='0x00000603'/>
+ <cpuid eax_in='0x0000000b' ecx_in='0x00' eax='0x00000001' ebx='0x00000002' ecx='0x00000100' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000b' ecx_in='0x01' eax='0x00000004' ebx='0x00000004' ecx='0x00000201' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000c' ecx_in='0x00' eax='0x00000000' ebx='0x00000001' ecx='0x00000001' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000d' ecx_in='0x00' eax='0x00000007' ebx='0x00000340' ecx='0x00000340' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000001' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000d' ecx_in='0x02' eax='0x00000100' ebx='0x00000240' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000e' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x0000000f' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000010' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000011' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000012' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000013' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000014' ecx_in='0x00' eax='0x00000000' ebx='0x00000001' ecx='0x00000001' edx='0x00000000'/>
+ <cpuid eax_in='0x80000000' ecx_in='0x00' eax='0x80000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/>
+ <cpuid eax_in='0x80000002' ecx_in='0x00' eax='0x65746e49' ebx='0x2952286c' ecx='0x726f4320' edx='0x4d542865'/>
+ <cpuid eax_in='0x80000003' ecx_in='0x00' eax='0x37692029' ebx='0x3036352d' ecx='0x43205530' edx='0x40205550'/>
+ <cpuid eax_in='0x80000004' ecx_in='0x00' eax='0x362e3220' ebx='0x7a484730' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80000005' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80000006' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01006040' edx='0x00000000'/>
+ <cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
+ <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00003027' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x80860000' ecx_in='0x00' eax='0x00000000' ebx='0x00000001' ecx='0x00000001' edx='0x00000000'/>
+ <cpuid eax_in='0xc0000000' ecx_in='0x00' eax='0x00000000' ebx='0x00000001' ecx='0x00000001' edx='0x00000000'/>
+</cpudata>
--
2.13.1
7 years, 5 months
[libvirt] [PATCH] virpcimock: Fix memory leak in pci_driver_new
by ZhiPeng Lu
@driverpath, allocated by virAsprintfQuiet, was not freed and leaked.
Signed-off-by: Zhipeng Lu <lu.zhipeng(a)zte.com.cn>
---
tests/virpcimock.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index e9408aa..dec9e01 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -480,6 +480,7 @@ pci_driver_new(const char *name, int fail, ...)
if (VIR_APPEND_ELEMENT_QUIET(pciDrivers, nPCIDrivers, driver) < 0)
ABORT_OOM();
+ VIR_FREE(driverpath);
}
static struct pciDriver *
--
1.8.3.1
7 years, 5 months
[libvirt] [PATCH] qemu: hotplug virtio_scsi over lsilogic when sicsi controller is not present
by Liang Yan
It may be better to check virtio-scsi controller first since it is
supported better in qemu level.
Signed-off-by: Liang Yan<lyan(a)suse.com>
---
src/qemu/qemu_domain_address.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index b5b863fe4..9bec0790f 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -90,10 +90,10 @@ qemuDomainSetSCSIControllerModel(const virDomainDef *def,
} else {
if (qemuDomainIsPSeries(def)) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
- } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
- *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
+ } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
+ *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
} else {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to determine model for scsi controller"));
--
2.13.2
7 years, 5 months
[libvirt] [PATCH] qemu: shared disks with cache=directsync should be safe for migration
by Peng Hao
From: Hao Peng <peng.hao2(a)zte.com.cn>
At present shared disks can be migrated with either readonly or cache=none. But
cache=directsync should be safe for migration, because both cache=directsync and cache=none
don't use the host page cache, and cache=direct write through qemu block layer cache.
Signed-off-by: Peng Hao <peng.hao2(a)zte.com.cn>
Reviewed-by: Wang Yechao <wang.yechao255(a)zte.com.cn>
---
src/qemu/qemu_migration.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index c23fffe..9d509dd 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1160,11 +1160,12 @@ qemuMigrationIsSafe(virDomainDefPtr def,
const char *src = virDomainDiskGetSource(disk);
/* Our code elsewhere guarantees shared disks are either readonly (in
- * which case cache mode doesn't matter) or used with cache=none */
+ * which case cache mode doesn't matter) or used with cache=none or used with cache=directsync */
if (virStorageSourceIsEmpty(disk->src) ||
disk->src->readonly ||
disk->src->shared ||
- disk->cachemode == VIR_DOMAIN_DISK_CACHE_DISABLE)
+ disk->cachemode == VIR_DOMAIN_DISK_CACHE_DISABLE ||
+ disk->cachemode == VIR_DOMAIN_DISK_CACHE_DIRECTSYNC)
continue;
/* disks which are migrated by qemu are safe too */
@@ -1188,7 +1189,7 @@ qemuMigrationIsSafe(virDomainDefPtr def,
virReportError(VIR_ERR_MIGRATE_UNSAFE, "%s",
_("Migration may lead to data corruption if disks"
- " use cache != none"));
+ " use cache != none or cache != directsync"));
return false;
}
--
1.8.3.1
7 years, 5 months
[libvirt] Trouble with /var/lib/libvirt/qemu/save mount
by Orion Poplawski
I'm trying to get libvirt-guests ON_SHUTDOWN=suspend to work on EL7 with a
separate mount point for /var/lib/libvirt/qemu/save. It appears that during
host shutdown that /var/lib/libvirt/qemu/save gets unmounted before
libvirt-guests gets run, resulting in the save images running out of space on
my system and being mounted over on boot.
I've tried adding:
RequiresMountsFor=/var/lib/libvirt/qemu/save
to /usr/lib/systemd/system/libvirt-guests.service, but that does not appear to
help. Any other ideas?
Thanks.
--
Orion Poplawski
Technical Manager 720-772-5637
NWRA, Boulder/CoRA Office FAX: 303-415-9702
3380 Mitchell Lane orion(a)nwra.com
Boulder, CO 80301 http://www.nwra.com
7 years, 5 months
Re: [libvirt] [Qemu-devel] change x86 default machine type to Q35?
by Eduardo Habkost
(CCing libvir-list)
On Mon, Jul 10, 2017 at 07:45:54PM +0300, Michael S. Tsirkin wrote:
> On Mon, Jul 10, 2017 at 10:59:43AM -0300, Eduardo Habkost wrote:
> > On Mon, Jul 10, 2017 at 10:42:26AM +0300, Marcel Apfelbaum wrote:
> > > On 07/07/2017 21:03, Eduardo Habkost wrote:
> > > > On Fri, Jul 07, 2017 at 06:17:57PM +0300, Michael S. Tsirkin wrote:
> > > > > On Fri, Jul 07, 2017 at 10:39:49AM -0300, Eduardo Habkost wrote:
> > > > > > On Wed, Jul 05, 2017 at 12:32:10PM +0300, Marcel Apfelbaum wrote:
> > [...]
> > > > > > >
> > > > > > > The upper layers should manage the defaults by themselves so
> > > > > > > are not supposed to be affected.
> > > > > >
> > > > > > But they would be. libvirt uses the default machine-type from
> > > > > > QEMU.
> > > > >
> > > > > How about extending the command for supported machines with a
> > > > > recommended machine type, and teaching libvirt to use that?
> > > >
> > > > I don't think QEMU has enough information to decide if it should
> > > > recommend "q35" or "pc".
> > >
> > > We don't really need a complicated rule set, we would just recommend q35
> > > by default. Libvirt will try to create the default machine and if fails
> > > for some reason (what would it be?) it can switch to PC.
> > >
> > > The advanced logic would be "old systems should use PC", where old
> > > means Windows XP and before and so on. But this logic should appear
> > > in management layers above.
> >
> > In this case, is there any difference between "changing the
> > default to q35" and "recommending q35", for libvirt users?
> >
> > --
> > Eduardo
>
> No but libvirt users do not manage e.g. pci slots manually.
> They do not use the -cdrom flag.
> Etc.
> So changing the default is unlikely to break things for them.
>
I see. If this part is really true (can libvirt developers
confirm that?), then the proposed end result makes sense (not
having a default for running QEMU directly, but changing default
to "q35" for people using libvirt).
But I don't see why we would need a new mechanism to make QEMU
recommend a machine-type for libvirt, if libvirt could simply
choose its own default (or maybe also refuse to pick a default,
if libvirt developers decide that's the best solution).
> People not using libvirt use some or all of this
> and other such functionality,
> and changing the default might break things for them.
--
Eduardo
7 years, 5 months
[libvirt] [PATCH] qemu: process: Remove unused qemuCaps
by Cole Robinson
After 405c0f07f5 qemuCaps is unused here, remove it from the call
stack
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu/qemu_process.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e6522a294..34974c6e5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1877,9 +1877,7 @@ qemuProcessMonitorReportLogError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
static int
-qemuProcessLookupPTYs(virDomainDefPtr def ATTRIBUTE_UNUSED,
- virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
- virDomainChrDefPtr *devices,
+qemuProcessLookupPTYs(virDomainChrDefPtr *devices,
int count,
virHashTablePtr info)
{
@@ -1927,24 +1925,18 @@ qemuProcessLookupPTYs(virDomainDefPtr def ATTRIBUTE_UNUSED,
static int
qemuProcessFindCharDevicePTYsMonitor(virDomainObjPtr vm,
- virQEMUCapsPtr qemuCaps,
virHashTablePtr info)
{
size_t i = 0;
- if (qemuProcessLookupPTYs(vm->def, qemuCaps,
- vm->def->serials, vm->def->nserials,
- info) < 0)
+ if (qemuProcessLookupPTYs(vm->def->serials, vm->def->nserials, info) < 0)
return -1;
- if (qemuProcessLookupPTYs(vm->def, qemuCaps,
- vm->def->parallels, vm->def->nparallels,
+ if (qemuProcessLookupPTYs(vm->def->parallels, vm->def->nparallels,
info) < 0)
return -1;
- if (qemuProcessLookupPTYs(vm->def, qemuCaps,
- vm->def->channels, vm->def->nchannels,
- info) < 0)
+ if (qemuProcessLookupPTYs(vm->def->channels, vm->def->nchannels, info) < 0)
return -1;
/* For historical reasons, console[0] can be just an alias
* for serial[0]. That's why we need to update it as well. */
@@ -1962,8 +1954,7 @@ qemuProcessFindCharDevicePTYsMonitor(virDomainObjPtr vm,
}
}
- if (qemuProcessLookupPTYs(vm->def, qemuCaps,
- vm->def->consoles + i, vm->def->nconsoles - i,
+ if (qemuProcessLookupPTYs(vm->def->consoles + i, vm->def->nconsoles - i,
info) < 0)
return -1;
@@ -2111,7 +2102,6 @@ static int
qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int asyncJob,
- virQEMUCapsPtr qemuCaps,
qemuDomainLogContextPtr logCtxt)
{
int ret = -1;
@@ -2135,8 +2125,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
ret = -1;
if (ret == 0) {
- if ((ret = qemuProcessFindCharDevicePTYsMonitor(vm, qemuCaps,
- info)) < 0)
+ if ((ret = qemuProcessFindCharDevicePTYsMonitor(vm, info)) < 0)
goto cleanup;
if ((ret = qemuProcessRefreshChannelVirtioState(driver, vm, info,
@@ -5870,7 +5859,7 @@ qemuProcessLaunch(virConnectPtr conn,
goto cleanup;
VIR_DEBUG("Waiting for monitor to show up");
- if (qemuProcessWaitForMonitor(driver, vm, asyncJob, priv->qemuCaps, logCtxt) < 0)
+ if (qemuProcessWaitForMonitor(driver, vm, asyncJob, logCtxt) < 0)
goto cleanup;
if (qemuConnectAgent(driver, vm) < 0)
@@ -6724,7 +6713,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
qemuDomainObjTaint(driver, vm, VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH, logCtxt);
VIR_DEBUG("Waiting for monitor to show up");
- if (qemuProcessWaitForMonitor(driver, vm, QEMU_ASYNC_JOB_NONE, priv->qemuCaps, NULL) < 0)
+ if (qemuProcessWaitForMonitor(driver, vm, QEMU_ASYNC_JOB_NONE, NULL) < 0)
goto error;
if (qemuConnectAgent(driver, vm) < 0)
--
2.13.0
7 years, 5 months
[libvirt] [PATCH] news: qemu platform serial devices now use -chardev
by Cole Robinson
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
docs/news.xml | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index f44d676c1..10faad673 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -42,6 +42,17 @@
</change>
</section>
<section title="Improvements">
+ <change>
+ <summary>
+ qemu: arm/aarch64 serial devices can now use chardev features
+ </summary>
+ <description>
+ qemu VMs that depend on platform serial devices can now use
+ qemu's -chardev option, which enables access to advanced features
+ like log file configuration. This applies to the default serial
+ devices for arm, aarch64, and some ppc configurations.
+ </description>
+ </change>
</section>
<section title="Bug fixes">
</section>
--
2.13.0
7 years, 5 months
[libvirt] [PATCH] Avoid hidden cgroup mount points
by Juan Hernandez
Currently the scan of the /proc/mounts file used to find cgroup mount
points doesn't take into account that mount points may hidden by other
mount points. For, example in certain Kubernetes environments the
/proc/mounts contains the following lines:
cgroup /sys/fs/cgroup/net_prio,net_cls cgroup ...
tmpfs /sys/fs/cgroup tmpfs ...
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup ...
In this particular environment the first mount point is hidden by the
second one. The correct mount point is the third one, but libvirt will
never process it because it only checks the first mount point for each
controller (net_cls in this case). So libvirt will try to use the first
mount point, which doesn't actually exist, and the complete detection
process will fail.
To avoid that issue this patch changes the virCgroupDetectMountsFromFile
function so that when there are duplicates it takes the information from
the last line in /proc/mounts. This requires removing the previous
explicit condition to skip duplicates, and adding code to free the
memory used by the processing of duplicated lines.
Related-To: https://bugzilla.redhat.com/1468214
Related-To: https://github.com/kubevirt/libvirt/issues/4
Signed-off-by: Juan Hernandez <jhernand(a)redhat.com>
---
src/util/vircgroup.c | 23 ++++++++++++++---------
tests/vircgroupdata/kubevirt.mounts | 36 ++++++++++++++++++++++++++++++++++++
tests/vircgroupdata/kubevirt.parsed | 10 ++++++++++
tests/vircgrouptest.c | 1 +
4 files changed, 61 insertions(+), 9 deletions(-)
create mode 100644 tests/vircgroupdata/kubevirt.mounts
create mode 100644 tests/vircgroupdata/kubevirt.parsed
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 5aa1db5..41d90e7 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -397,6 +397,7 @@ virCgroupDetectMountsFromFile(virCgroupPtr group,
const char *typestr = virCgroupControllerTypeToString(i);
int typelen = strlen(typestr);
char *tmp = entry.mnt_opts;
+ struct virCgroupController *controller = &group->controllers[i];
while (tmp) {
char *next = strchr(tmp, ',');
int len;
@@ -406,18 +407,21 @@ virCgroupDetectMountsFromFile(virCgroupPtr group,
} else {
len = strlen(tmp);
}
- /* NB, the same controller can appear >1 time in mount list
- * due to bind mounts from one location to another. Pick the
- * first entry only
- */
- if (typelen == len && STREQLEN(typestr, tmp, len) &&
- !group->controllers[i].mountPoint) {
+
+ if (typelen == len && STREQLEN(typestr, tmp, len)) {
char *linksrc;
struct stat sb;
char *tmp2;
- if (VIR_STRDUP(group->controllers[i].mountPoint,
- entry.mnt_dir) < 0)
+ /* Note that the lines in /proc/mounts have the same
+ * order than the mount operations, and that there may
+ * be duplicates due to bind mounts. This means
+ * that the same mount point may be processed more than
+ * once. We need to save the results of the last one,
+ * and we need to be careful to release the memory used
+ * by previous processing. */
+ VIR_FREE(controller->mountPoint);
+ if (VIR_STRDUP(controller->mountPoint, entry.mnt_dir) < 0)
goto error;
tmp2 = strrchr(entry.mnt_dir, '/');
@@ -453,7 +457,8 @@ virCgroupDetectMountsFromFile(virCgroupPtr group,
VIR_WARN("Expecting a symlink at %s for controller %s",
linksrc, typestr);
} else {
- group->controllers[i].linkPoint = linksrc;
+ VIR_FREE(controller->linkPoint);
+ controller->linkPoint = linksrc;
}
}
}
diff --git a/tests/vircgroupdata/kubevirt.mounts b/tests/vircgroupdata/kubevirt.mounts
new file mode 100644
index 0000000..b0d31bb
--- /dev/null
+++ b/tests/vircgroupdata/kubevirt.mounts
@@ -0,0 +1,36 @@
+tmpfs /sys/fs/cgroup tmpfs rw,nosuid,nodev,noexec,relatime,mode=755 0 0
+cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
+cgroup /sys/fs/cgroup/cpuacct,cpu cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0
+cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
+cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
+cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
+cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
+cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
+cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
+cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
+cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
+cgroup /sys/fs/cgroup/net_prio,net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_prio,net_cls 0 0
+tmpfs /host-sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,relatime,mode=755 0 0
+cgroup /host-sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
+cgroup /host-sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0
+cgroup /host-sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
+cgroup /host-sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
+cgroup /host-sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
+cgroup /host-sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
+cgroup /host-sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
+cgroup /host-sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
+cgroup /host-sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
+cgroup /host-sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
+cgroup /host-sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_prio,net_cls 0 0
+tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,relatime,mode=755 0 0
+cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
+cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0
+cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
+cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
+cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
+cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
+cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
+cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
+cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
+cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
+cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_prio,net_cls 0 0
diff --git a/tests/vircgroupdata/kubevirt.parsed b/tests/vircgroupdata/kubevirt.parsed
new file mode 100644
index 0000000..3377af0
--- /dev/null
+++ b/tests/vircgroupdata/kubevirt.parsed
@@ -0,0 +1,10 @@
+cpu /sys/fs/cgroup/cpu,cpuacct
+cpuacct /sys/fs/cgroup/cpu,cpuacct
+cpuset /sys/fs/cgroup/cpuset
+memory /sys/fs/cgroup/memory
+devices /sys/fs/cgroup/devices
+freezer /sys/fs/cgroup/freezer
+blkio /sys/fs/cgroup/blkio
+net_cls /sys/fs/cgroup/net_cls,net_prio
+perf_event /sys/fs/cgroup/perf_event
+name=systemd /sys/fs/cgroup/systemd
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
index 8af5e2c..b932b1a 100644
--- a/tests/vircgrouptest.c
+++ b/tests/vircgrouptest.c
@@ -885,6 +885,7 @@ mymain(void)
DETECT_MOUNTS("cgroups3");
DETECT_MOUNTS("all-in-one");
DETECT_MOUNTS("no-cgroups");
+ DETECT_MOUNTS("kubevirt");
if (virTestRun("New cgroup for self", testCgroupNewForSelf, NULL) < 0)
ret = -1;
--
2.9.4
7 years, 5 months