From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sessmg22.ericsson.net (sessmg22.ericsson.net [193.180.251.58]) by dpdk.org (Postfix) with ESMTP id 31FBE1B229 for ; Wed, 4 Oct 2017 12:00:57 +0200 (CEST) X-AuditID: c1b4fb3a-0adff70000003fec-f6-59d4b1580242 Received: from ESESSHC009.ericsson.se (Unknown_Domain [153.88.183.45]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id C4.A3.16364.851B4D95; Wed, 4 Oct 2017 12:00:56 +0200 (CEST) Received: from ESESSMB107.ericsson.se ([169.254.7.166]) by ESESSHC009.ericsson.se ([153.88.183.45]) with mapi id 14.03.0352.000; Wed, 4 Oct 2017 12:00:56 +0200 From: Jan Scheurich To: "'dev@dpdk.org'" CC: Jan Scheurich Thread-Topic: [PATCH v3] vhost: Expose virtio interrupt need on rte_vhost API Thread-Index: AdM0qvMtmEYHE931SOqKPNtAgfQLVAITE/QQ Date: Wed, 4 Oct 2017 10:00:56 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [153.88.183.20] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrELMWRmVeSWpSXmKPExsUyM2K7rm7ExiuRBse3WFq8+7SdyYHR49eC pawBjFFcNimpOZllqUX6dglcGV+6W9gLDktXfNx/i7WBsVmsi5GTQ0LARGLOv3tMXYxcHEIC Rxgl5mz+AOUsZpQ4c3IBSxcjBwebgIHE7N0OIA0iAsoSs45tZwOxmQX0JA6tb2ABsYUFfCSu 7u1nhKjxldhw5AELhG0kcejhAnYQm0VARWLi0gNgcV6gmqmrnzKB2EJA9pOf98HinAJ+EiuO vQGLMwqISXw/tYYJYpe4xK0n85kgjhaQWLLnPDOELSrx8vE/VghbUeLq9OVQ9ToSC3Z/grpT W2LZwtfMEHsFJU7OfMIygVF0FpKxs5C0zELSMgtJywJGllWMosWpxcW56UZGeqlFmcnFxfl5 enmpJZsYgTFxcMtvqx2MB587HmIU4GBU4uGtW3UlUog1say4MvcQowQHs5IIb8AGoBBvSmJl VWpRfnxRaU5q8SFGaQ4WJXFeh30XIoQE0hNLUrNTUwtSi2CyTBycUg2MMluKDTJs90vonZY3 aheaFaLEqaTIfvtSdWTC+w+qpUtbe4+da4rV73MuWXB2TsPhSeddep0Eaq/teL/cqcazqGX5 KzlhO4OlbnZeGTtWKKhdYYlon/Bl6pJQBZugOQ/yZygU9C3c4jBrXsAx6+hlTibT0tRaBP0C NbMDk/+XJLP+P+t5wl6JpTgj0VCLuag4EQD7mdDMhQIAAA== Subject: Re: [dpdk-dev] [PATCH v3] vhost: Expose virtio interrupt need on rte_vhost API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Oct 2017 10:00:57 -0000 Friendly reminder:=20 Could somebody please have a look at this patch now that the DPDK summit is over? Thanks, Jan > -----Original Message----- > From: Jan Scheurich > Sent: Saturday, 23 September, 2017 22:32 > To: 'dev@dpdk.org' > Subject: [PATCH v3] vhost: Expose virtio interrupt need on rte_vhost API >=20 > Performance tests with the OVS DPDK datapath have shown > that the tx throughput over a vhostuser port into a VM with > an interrupt-based virtio driver is limited by the overhead > incurred by virtio interrupts. The OVS PMD spends up to 30% > of its cycles in system calls kicking the eventfd. Also the core > running the vCPU is heavily loaded with generating the virtio > interrupts in KVM on the host and handling these interrupts > in the virtio-net driver in the guest. This limits the throughput > to about 500-700 Kpps with a single vCPU. >=20 > OVS is trying to address this issue by batching packets to a > vhostuser port for some time to limit the virtio interrupt > frequency. With a 50 us batching period we have measured an > iperf3 throughput increase by 15% and a PMD utilization > decrease from 45% to 30%. >=20 > On the other hand, guests using virtio PMDs do not profit from > time-based tx batching. Instead they experience a 2-3% > performance penalty and an average latency increase of > 30-40 us. OVS therefore intends to apply time-based tx > batching only for vhostuser tx queues that need to trigger > virtio interrupts. >=20 > Today this information is hidden inside the rte_vhost library > and not accessible to users of the API. This patch adds a > function to the API to query it. >=20 > Signed-off-by: Jan Scheurich >=20 > --- >=20 > v2 -> v3: > Fixed even more white-space errors and warnings > v1 -> v2: > Fixed too long commit lines > Fixed white-space errors and warnings >=20 > lib/librte_vhost/rte_vhost.h | 12 ++++++++++++ > lib/librte_vhost/vhost.c | 19 +++++++++++++++++++ > 2 files changed, 31 insertions(+) >=20 > diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h > index 8c974eb..d62338b 100644 > --- a/lib/librte_vhost/rte_vhost.h > +++ b/lib/librte_vhost/rte_vhost.h > @@ -444,6 +444,18 @@ int rte_vhost_get_vhost_vring(int vid, uint16_t vrin= g_idx, > */ > uint32_t rte_vhost_rx_queue_count(int vid, uint16_t qid); >=20 > +/** > + * Does the virtio driver request interrupts for a vhost tx queue? > + * > + * @param vid > + * vhost device ID > + * @param qid > + * virtio queue index in mq case > + * @return > + * 1 if true, 0 if false > + */ > +int rte_vhost_tx_interrupt_requested(int vid, uint16_t qid); > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c > index 0b6aa1c..c6e636e 100644 > --- a/lib/librte_vhost/vhost.c > +++ b/lib/librte_vhost/vhost.c > @@ -503,3 +503,22 @@ struct virtio_net * >=20 > return *((volatile uint16_t *)&vq->avail->idx) - vq->last_avail_idx; > } > + > +int rte_vhost_tx_interrupt_requested(int vid, uint16_t qid) > +{ > + struct virtio_net *dev; > + struct vhost_virtqueue *vq; > + > + dev =3D get_device(vid); > + if (dev =3D=3D NULL) > + return 0; > + > + vq =3D dev->virtqueue[qid]; > + if (vq =3D=3D NULL) > + return 0; > + > + if (unlikely(vq->enabled =3D=3D 0 || vq->avail =3D=3D NULL)) > + return 0; > + > + return !(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT); > +}