[libvirt] [PATCH] Revert "qemu: Allow to plug virtio-net-pci into PCIe slot"
by Laine Stump
This reverts commit ede34470fde19c0f326cdb0dfca39fa86fd9ec16, which
was apparently written based on testing performed before commits
1e15be1 and 9a12b6 were pushed upstream. Once those two patches are in
place, commit ede34470 is redundant, and can even cause
incorrect/unexpected behavior when auto-assigning addresses for
virtio-net devices.
---
src/qemu/qemu_command.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 84cbfe1..0d7b155 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1680,14 +1680,6 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
*/
flags = VIR_PCI_CONNECT_TYPE_PCI | VIR_PCI_CONNECT_TYPE_PCIE;
break;
-
- case VIR_DOMAIN_DEVICE_NET:
- if (STREQ(device->data.net->model, "virtio")) {
- /* virtio-net-pci adapter in qemu has to be plugged into PCIe slot
- * in order to be able to use irqfds with vhost-net
- */
- flags = VIR_PCI_CONNECT_TYPE_PCI | VIR_PCI_CONNECT_TYPE_PCIE;
- }
}
/* Ignore implicit controllers on slot 0:0:1.0:
--
2.1.0
9 years, 3 months
[libvirt] Buffer overflow error when starting libvirtd
by Willard Dennis
Compiled libvirt 1.2.18 on Ubuntu 12.04.5 (installed over 12.04 libvirt-bin
0.9.9 package files); when I try to start libvirtd, I get the following
error / backtrace:
$ sudo /usr/sbin/libvirtd
*** stack smashing detected ***: /usr/sbin/libvirtd terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7f02fe6d3e57]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x0)[0x7f02fe6d3e20]
/usr/lib/libvirt.so.0(+0xaa359)[0x7f02fec4f359]
/usr/lib/libvirt/connection-driver/libvirt_driver_nodedev.so(+0x99fe)[0x7f02f1fc59fe]
/usr/lib/libvirt/connection-driver/libvirt_driver_nodedev.so(+0xa672)[0x7f02f1fc6672]
/usr/lib/libvirt.so.0(virStateInitialize+0xaf)[0x7f02fed1cd2f]
/usr/sbin/libvirtd(+0x17d80)[0x7f02ff98dd80]
/usr/lib/libvirt.so.0(+0xd25d2)[0x7f02fec775d2]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a)[0x7f02fe98fe9a]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f02fe6bd38d]
Not sure if this may be a bug with 1.2.18, or a fault with my
configure/compile/install process; please advise...
Thanks,
Will
9 years, 3 months
[libvirt] [PATCH 0/3] Follow up patches for QoS
by Michal Privoznik
Thanks to Peter who made me test this more and find some corner
cases. And even take a look on Coverity output.
Michal Privoznik (3):
networkBandwidthUpdate: Don't blindly dereference pointers
networkBandwidthGenericChecks: Drop useless check
cmdAttachInterface: Fully implement @floor support
src/network/bridge_driver.c | 7 ++-----
tools/virsh-domain.c | 8 ++++++--
2 files changed, 8 insertions(+), 7 deletions(-)
--
2.4.6
9 years, 3 months
[libvirt] [PATCH] domain: Fix crash if trying to live update disk <serial>
by Cole Robinson
If you pass <disk><serial> XML to UpdateDevice, and the original device
didn't have a <serial> block, libvirtd crashes trying to read the original
NULL serial string.
Use _NULLABLE string comparisons to avoid the crash. A couple other
properties needed the change too.
---
src/conf/domain_conf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fd0450f..f1e02e3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5871,28 +5871,28 @@ virDomainDiskDiffersSourceOnly(virDomainDiskDefPtr disk,
CHECK_EQ(transient, "transient", true);
- if (disk->serial && STRNEQ(disk->serial, orig_disk->serial)) {
+ if (disk->serial && STRNEQ_NULLABLE(disk->serial, orig_disk->serial)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("cannot modify field '%s' of the disk"),
"serial");
return false;
}
- if (disk->wwn && STRNEQ(disk->wwn, orig_disk->wwn)) {
+ if (disk->wwn && STRNEQ_NULLABLE(disk->wwn, orig_disk->wwn)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("cannot modify field '%s' of the disk"),
"wwn");
return false;
}
- if (disk->vendor && STRNEQ(disk->vendor, orig_disk->vendor)) {
+ if (disk->vendor && STRNEQ_NULLABLE(disk->vendor, orig_disk->vendor)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("cannot modify field '%s' of the disk"),
"vendor");
return false;
}
- if (disk->product && STRNEQ(disk->product, orig_disk->product)) {
+ if (disk->product && STRNEQ_NULLABLE(disk->product, orig_disk->product)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("cannot modify field '%s' of the disk"),
"product");
--
2.4.3
9 years, 3 months
[libvirt] [PATCH v5 0/4] qemu: Allow PCI virtio on ARM "virt" machine
by Pavel Fedin
Virt machine in qemu since v2.3.0 has PCI generic host controller, and
can use PCI devices. This provides performance improvement as well as
vhost-net with irqfd support for virtio-net. However libvirt currently
does not allow ARM virt machine to have PCI devices. This patchset adds
the necessary support.
Changes since v4:
- Rebased onto current master
- Added possibility to plug virtio-net-pci adapter directly into PCIe bus.
This is necessary for irqfds to work in qemu.
Changes since v3:
- Capability is based not on qemu version but on support of "gpex-pcihost"
device by qemu
- Added a workaround, allowing to pass "make check". The problem is that
test suite does not build capabilities cache. Unfortunately this means
that correct unit-test for the new functionality currently cannot be
written. Test suite framework needs to be improved.
Changes since v2:
Complete rework, use different approach
- Correctly model PCI Express bus on the machine. It is now possible to
explicitly specify <address-type='pci'> with attributes. This allows to
attach not only virtio, but any other PCI device to the model.
- Default is not changed and still mmio, for backwards compatibility with
existing installations. PCI bus has to be explicitly specified.
- Check for the capability in correct place, in v2 it actually did not
work
Changes since v1:
- Added capability based on qemu version number
- Recognize also "virt-" prefix
Pavel Fedin (4):
qemu: Introduce QEMU_CAPS_OBJECT_GPEX
Add PCI-Express root to ARM virt machine
Build correct command line for PCI NICs on ARM
Allow to plug virtio-net-pci into PCIe slot
src/qemu/qemu_capabilities.c | 10 ++++++++++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 11 ++++++++++-
src/qemu/qemu_domain.c | 17 +++++++++++++----
4 files changed, 34 insertions(+), 5 deletions(-)
--
1.9.5.msysgit.0
9 years, 3 months
[libvirt] [PATCH] nodedev: Fix gfeature size to be according to running kernel
by Moshe Levi
This patch add virNetDevGetGFeaturesSize to get the supported
gfeature size from the kernel
---
src/util/virnetdev.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 56 insertions(+), 4 deletions(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 1e20789..3fdf4bb 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -89,8 +89,10 @@ VIR_LOG_INIT("util.netdev");
#define RESOURCE_FILE_LEN 4096
#if HAVE_DECL_ETHTOOL_GFEATURES
+#define ETH_GSTRING_LEN 32
# define TX_UDP_TNL 25
-# define GFEATURES_SIZE 2
+# define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+# define FEATURE_BITS_TO_BLOCKS(n_bits) DIV_ROUND_UP(n_bits, 32U)
# define FEATURE_WORD(blocks, index, field) ((blocks)[(index) / 32U].field)
# define FEATURE_FIELD_FLAG(index) (1U << (index) % 32U)
# define FEATURE_BIT_IS_SET(blocks, index, field) \
@@ -3110,6 +3112,53 @@ virNetDevGFeatureAvailable(const char *ifname, struct ethtool_gfeatures *cmd)
ret = FEATURE_BIT_IS_SET(cmd->features, TX_UDP_TNL, active);
return ret;
}
+/**
+ * virNetDevGetGFeaturesSize
+ * This function return the number of gfeatures supported in
+ * the kernel
+ *
+ * @ifname: name of the interface
+ *
+ * Returns gfeature size on success, and 0 on failure or not supported.
+ */
+ static int
+virNetDevGetGFeaturesSize(const char *ifname)
+{
+ struct {
+ struct ethtool_sset_info hdr;
+ uint32_t buf[1];
+ } sset_info;
+ struct ethtool_gstrings *strings;
+ uint32_t size = 0;
+
+ sset_info.hdr.cmd = ETHTOOL_GSSET_INFO;
+ sset_info.hdr.reserved = 0;
+ sset_info.hdr.sset_mask = 1ULL << ETH_SS_FEATURES;
+
+ if (virNetDevSendEthtoolIoctl(ifname, &sset_info) == -1)
+ return size;
+ size = sset_info.hdr.sset_mask ? sset_info.hdr.data[0] : 0;
+
+ if (VIR_ALLOC_VAR(strings, struct ethtool_gstrings, sizeof(*strings) + size * ETH_GSTRING_LEN)) {
+ size = 0;
+ return size;
+ }
+
+ strings->cmd = ETHTOOL_GSTRINGS;
+ strings->string_set = ETH_SS_FEATURES;
+ strings->len = size;
+ if (size != 0 && virNetDevSendEthtoolIoctl(ifname, strings) == -1) {
+ size = 0;
+ goto cleanup;
+ }
+
+ size = FEATURE_BITS_TO_BLOCKS(size);
+
+ cleanup:
+ VIR_FREE(strings);
+ return size;
+}
+
# endif
@@ -3189,9 +3238,12 @@ virNetDevGetFeatures(const char *ifname,
# if HAVE_DECL_ETHTOOL_GFEATURES
g_cmd.cmd = ETHTOOL_GFEATURES;
- g_cmd.size = GFEATURES_SIZE;
- if (virNetDevGFeatureAvailable(ifname, &g_cmd))
- ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_TXUDPTNL));
+ g_cmd.size = virNetDevGetGFeaturesSize(ifname);
+ if (g_cmd.size == 0)
+ VIR_DEBUG("GFeatures unsupported or failure in getting GFeatures size on ifname %s", ifname);
+ else
+ if (virNetDevGFeatureAvailable(ifname, &g_cmd))
+ ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_TXUDPTNL));
# endif
if (virNetDevRDMAFeature(ifname, out) < 0)
--
1.7.1
9 years, 3 months
[libvirt] [PATCH] qemu: fix qemuDomainSupportsPCI() for ARM machines of "virt" machinetype
by Laine Stump
Commit e8d5517 updated the domain post-parse to automatically add
pcie-root et al for certain ARM "virt" machinetypes, but didn't update
the function qemuDomainSupportsPCI() which is called later on when we
are auto-assigning PCI addresses and default settings for the PCI
controller <model> and <target> attributes. The result was that PCI
addresses weren't assigned, and the controllers didn't have their
attribute default values set, leading to an error when the domain was
started, e.g.:
internal error: autogenerated dmi-to-pci-bridge options not set
This patch duplicates the check made in the earlier patch, so that PCI
address auto-assignment and target/model default values will be set.
---
The example Cole gave in his email reporting this bug is fixed by this
patch.
src/qemu/qemu_command.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ae03618..84cbfe1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1742,7 +1742,7 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
}
static bool
-qemuDomainSupportsPCI(virDomainDefPtr def)
+qemuDomainSupportsPCI(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
{
if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64))
return true;
@@ -1750,6 +1750,11 @@ qemuDomainSupportsPCI(virDomainDefPtr def)
if (STREQ(def->os.machine, "versatilepb"))
return true;
+ if ((STREQ(def->os.machine, "virt") ||
+ STRPREFIX(def->os.machine, "virt-")) &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX))
+ return true;
+
return false;
}
@@ -2267,7 +2272,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false)))
goto cleanup;
- if (qemuDomainSupportsPCI(def)) {
+ if (qemuDomainSupportsPCI(def, qemuCaps)) {
if (qemuValidateDevicePCISlotsChipsets(def, qemuCaps, addrs) < 0)
goto cleanup;
--
2.1.0
9 years, 3 months
[libvirt] [PATCH] virNetSocketCheckProtocols: handle EAI_NONAME as IPv6 unavailable
by Guido Günther
When running the test suite using "unshare -n" we might have IPv6 but no
configured addresses. Due to AI_ADDRCONFIG getaddrinfo then fails with
EAI_NONAME which we should then treat as IPv6 unavailable.
---
src/rpc/virnetsocket.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 106d09a..5e5f1ab 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -183,7 +183,8 @@ int virNetSocketCheckProtocols(bool *hasIPv4,
if ((gaierr = getaddrinfo("::1", NULL, &hints, &ai)) != 0) {
if (gaierr == EAI_ADDRFAMILY ||
- gaierr == EAI_FAMILY) {
+ gaierr == EAI_FAMILY ||
+ gaierr == EAI_NONAME) {
*hasIPv6 = false;
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
--
2.1.4
9 years, 3 months