From nobody Fri May 16 07:48:56 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 1500290895754502.6139056836183; Mon, 17 Jul 2017 04:28:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2935785A05; Mon, 17 Jul 2017 11:28:12 +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 EE8675C89F; Mon, 17 Jul 2017 11:28:11 +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 829181833033; Mon, 17 Jul 2017 11:28:11 +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 v6HBRr6A020646 for ; Mon, 17 Jul 2017 07:27:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 59B645C54A; Mon, 17 Jul 2017 11:27:53 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08EB95C89F; Mon, 17 Jul 2017 11:27:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2935785A05 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.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 2935785A05 From: sferdjao@redhat.com To: libvir-list@redhat.com Date: Mon, 17 Jul 2017 07:27:26 -0400 Message-Id: <20170717112727.28348-3-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 2/3] conf: introduce 'poll_us' attribute for domain interface 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 17 Jul 2017 11:28:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Sahid Orentino Ferdjaoui In this commit we introduce 'poll_us' attribute which will be passed then to the QEMU command line to enable support of busy polling. This commit also take into account that attribute to generate the XML. Signed-off-by: Sahid Orentino Ferdjaoui --- Addressed comments: - Moved the RNG and doc from patch3 to that one - Added an xml2xml test - Renamed var pollus to poll_us docs/formatdomain.html.in | 12 +++++++- docs/schemas/domaincommon.rng | 5 ++++ src/conf/domain_conf.c | 16 +++++++++++ src/conf/domain_conf.h | 1 + .../qemuxml2argv-net-virtio-poll-us.xml | 23 +++++++++++++++ .../qemuxml2xmlout-net-virtio-poll-us.xml | 33 ++++++++++++++++++= ++++ tests/qemuxml2xmltest.c | 1 + 7 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-poll-us.= xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-poll= -us.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c12efcf..c0516e3 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5071,7 +5071,7 @@ qemu-kvm -net nic,model=3D? /dev/null <source network=3D'default'/> <target dev=3D'vnet1'/> <model type=3D'virtio'/> - <driver name=3D'vhost' txmode=3D'iothread' ioeventfd=3D'on' even= t_idx=3D'off' queues=3D'5' rx_queue_size=3D'256'> + <driver name=3D'vhost' txmode=3D'iothread' ioeventfd=3D'on' even= t_idx=3D'off' queues=3D'5' rx_queue_size=3D'256' poll_us=3D'50'> <host csum=3D'off' gso=3D'off' tso4=3D'off' tso6=3D'off' ecn=3D'o= ff' ufo=3D'off' mrg_rxbuf=3D'off'/> <guest csum=3D'off' tso4=3D'off' tso6=3D'off' ecn=3D'off' ufo=3D'= off'/> </driver> @@ -5201,6 +5201,16 @@ qemu-kvm -net nic,model=3D? /dev/null In general you should leave this option alone, unless you are very certain you know what you are doing. +
+ The optional poll_us attribute configure the + maximum number of microseconds that could be spent on busy + polling. It improves the performance, but requires more + CPU. This option is only available with vhost backend driver. + Since 2.7.0 (QEMU and KVM only)
<= br/> + + In general you should leave this option alone, unless you + are very certain you know what you are doing. +
virtio options
For virtio interfaces, diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index fc1a40f..0cd2dc0 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2723,6 +2723,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3feeccb..51735dc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9920,6 +9920,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, char *event_idx =3D NULL; char *queues =3D NULL; char *rx_queue_size =3D NULL; + char *poll_us =3D NULL; char *str =3D NULL; char *filter =3D NULL; char *internal =3D NULL; @@ -10093,6 +10094,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop= t, event_idx =3D virXMLPropString(cur, "event_idx"); queues =3D virXMLPropString(cur, "queues"); rx_queue_size =3D virXMLPropString(cur, "rx_queue_size"); + poll_us =3D virXMLPropString(cur, "poll_us"); } else if (xmlStrEqual(cur->name, BAD_CAST "filterref")) { if (filter) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -10490,6 +10492,17 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo= pt, } def->driver.virtio.rx_queue_size =3D q; } + if (poll_us) { + unsigned int us; + if (virStrToLong_uip(poll_us, NULL, 10, &us) < 0) { + virReportError(VIR_ERR_XML_DETAIL, + _("'poll_us' attribute must be positive: %s= "), + poll_us); + goto error; + } + if (us > 1) + def->driver.virtio.poll_us =3D us; + } if ((str =3D virXPathString("string(./driver/host/@csum)", ctxt)))= { if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -10687,6 +10700,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop= t, VIR_FREE(event_idx); VIR_FREE(queues); VIR_FREE(rx_queue_size); + VIR_FREE(poll_us); VIR_FREE(str); VIR_FREE(filter); VIR_FREE(type); @@ -22558,6 +22572,8 @@ virDomainVirtioNetDriverFormat(char **outstr, if (def->driver.virtio.rx_queue_size) virBufferAsprintf(&buf, " rx_queue_size=3D'%u'", def->driver.virtio.rx_queue_size); + if (def->driver.virtio.poll_us) + virBufferAsprintf(&buf, " poll_us=3D'%u'", def->driver.virtio.poll= _us); =20 virDomainVirtioOptionsFormat(&buf, def->virtio); =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index af15ee8..ae3616b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -969,6 +969,7 @@ struct _virDomainNetDef { virTristateSwitch event_idx; unsigned int queues; /* Multiqueue virtio-net */ unsigned int rx_queue_size; + unsigned int poll_us; /* busy polling for tap */ struct { virTristateSwitch csum; virTristateSwitch gso; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-poll-us.xml b/t= ests/qemuxml2argvdata/qemuxml2argv-net-virtio-poll-us.xml new file mode 100644 index 0000000..46ef7d6 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-poll-us.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/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-poll-us.xml= b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-poll-us.xml new file mode 100644 index 0000000..7f81d15 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-poll-us.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + +
+ + + + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5e4b1d1..7abba30 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -538,6 +538,7 @@ mymain(void) DO_TEST("net-eth-hostip", NONE); DO_TEST("net-virtio-network-portgroup", NONE); DO_TEST("net-virtio-rxqueuesize", NONE); + DO_TEST("net-virtio-poll-us", NONE); DO_TEST("net-hostdev", NONE); DO_TEST("net-hostdev-vfio", NONE); DO_TEST("net-midonet", NONE); --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list