From nobody Fri May 16 07:47:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500290896367875.622311008672; Mon, 17 Jul 2017 04:28:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AEC57C0587E4; Mon, 17 Jul 2017 11:28:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 794127011E; Mon, 17 Jul 2017 11:28:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1400F1853E30; Mon, 17 Jul 2017 11:28:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6HBRtKT020658 for ; Mon, 17 Jul 2017 07:27:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 47A345C8A5; Mon, 17 Jul 2017 11:27:55 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBFD15C8A3; Mon, 17 Jul 2017 11:27:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AEC57C0587E4 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AEC57C0587E4 From: sferdjao@redhat.com To: libvir-list@redhat.com Date: Mon, 17 Jul 2017 07:27:27 -0400 Message-Id: <20170717112727.28348-4-sferdjao@redhat.com> In-Reply-To: <20170717112727.28348-1-sferdjao@redhat.com> References: <20170717112727.28348-1-sferdjao@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Sahid Orentino Ferdjaoui , laine@redhat.com Subject: [libvirt] [PATCHv2 3/3] This patch finalizes support of 'poll_us' attribute as an option of the NIC driver-specific element, the commit also takes care of hotplug. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 17 Jul 2017 11:28:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Sahid Orentino Ferdjaoui That option is supported for all networks which are using a tap device. To be used the backend should be specificly set to use vhost. Signed-off-by: Sahid Orentino Ferdjaoui --- Addressed comments: - Added comment to explain why we should explicitly set the driver name. src/qemu/qemu_command.c | 28 ++++++++++++++++++= ++++ src/qemu/qemu_hotplug.c | 12 ++++++++++ .../qemuxml2argv-net-virtio-netdev-pollus-fail.xml | 23 ++++++++++++++++++ ...xml2argv-net-virtio-netdev-pollus-qemu-fail.xml | 23 ++++++++++++++++++ .../qemuxml2argv-net-virtio-netdev-pollus.args | 25 +++++++++++++++++++ .../qemuxml2argv-net-virtio-netdev-pollus.xml | 23 ++++++++++++++++++ tests/qemuxml2argvtest.c | 9 +++++++ 7 files changed, 143 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-p= ollus-fail.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-p= ollus-qemu-fail.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-p= ollus.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-p= ollus.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6ac26af..1fc2a88 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3899,6 +3899,9 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, } if (net->tune.sndbuf_specified) virBufferAsprintf(&buf, "sndbuf=3D%lu,", net->tune.sndbuf); + if (net->driver.virtio.poll_us) + virBufferAsprintf(&buf, "poll-us=3D%u,", + net->driver.virtio.poll_us); } =20 virObjectUnref(cfg); @@ -8330,6 +8333,31 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr drive= r, return -1; } =20 + if (net->driver.virtio.poll_us > 0) { + if (net->driver.virtio.name !=3D VIR_DOMAIN_NET_BACKEND_TYPE_VHOST= ) { + /* virtio.name is set only if driver is specificly + * indicated. Since 'poll_us' option is only available for + * vhost-net we don't want libvirt to fallback to QEMU if + * not available. That's why we request users to set the + * driver. */ + virReportError( + VIR_ERR_CONFIG_UNSUPPORTED, + _("Busy polling (poll_us) is only supported with vhost " + "backend driver")); + return -1; + } + /* Nothing besides TAP devices supports busy polling. */ + if (!(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_DIRECT || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Busy polling is not supported for: %s"), + virDomainNetTypeToString(actualType)); + return -1; + } + } + /* and only TAP devices support nwfilter rules */ if (net->filter && !(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 4bc4972..78f61e7 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1015,6 +1015,18 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, return -1; } =20 + /* and nothing besides TAP devices supports busy polling. */ + if (net->driver.virtio.poll_us > 0 && + !(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_DIRECT || + actualType =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Busy polling is not supported for: %s"), + virDomainNetTypeToString(actualType)); + return -1; + } + /* and only TAP devices support nwfilter rules */ if (net->filter && !(actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus-f= ail.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus-fail= .xml new file mode 100644 index 0000000..3b664b9 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus-fail.xml @@ -0,0 +1,23 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus-q= emu-fail.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus= -qemu-fail.xml new file mode 100644 index 0000000..18999c3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus-qemu-fai= l.xml @@ -0,0 +1,23 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus.a= rgs b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus.args new file mode 100644 index 0000000..15e26fb --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus.args @@ -0,0 +1,25 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-no-acpi \ +-boot c \ +-usb \ +-netdev tap,fd=3D3,id=3Dhostnet0,poll-us=3D50 \ +-device virtio-net-pci,netdev=3Dhostnet0,id=3Dnet0,mac=3D52:54:00:23:bc:ba= ,bus=3Dpci.0,\ +addr=3D0x3 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x4 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus.x= ml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus.xml new file mode 100644 index 0000000..46ef7d6 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev-pollus.xml @@ -0,0 +1,23 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b95ea46..8311d9a 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1156,6 +1156,15 @@ mymain(void) QEMU_CAPS_NODEFCONFIG); DO_TEST("net-virtio-netdev", QEMU_CAPS_NETDEV, QEMU_CAPS_NODEFCONFIG); + DO_TEST("net-virtio-netdev-pollus", + QEMU_CAPS_NETDEV, + QEMU_CAPS_NETDEV_POLL_US); + DO_TEST_FAILURE("net-virtio-netdev-pollus-fail", + QEMU_CAPS_NETDEV, + QEMU_CAPS_NETDEV_POLL_US); + DO_TEST_FAILURE("net-virtio-netdev-pollus-qemu-fail", + QEMU_CAPS_NETDEV, + QEMU_CAPS_NETDEV_POLL_US); DO_TEST("net-virtio-s390", QEMU_CAPS_VIRTIO_S390); DO_TEST("net-virtio-ccw", --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list