All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vhost: Expose virtio interrupt requirement on rte_vhos API
@ 2017-09-23 19:16 Jan Scheurich
  2017-09-24 14:02 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Scheurich @ 2017-09-23 19:16 UTC (permalink / raw)
  To: 'dev@dpdk.org'; +Cc: 'dev@openvswitch.org'

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.

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%.

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.

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.

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>

---

 lib/librte_vhost/rte_vhost.h | 12 ++++++++++++
 lib/librte_vhost/vhost.c     | 19 +++++++++++++++++++
 2 files changed, 31 insertions(+)

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 vring_idx,
  */
 uint32_t rte_vhost_rx_queue_count(int vid, uint16_t qid);

+/**
+ * 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..bd1ebf9 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -503,3 +503,22 @@ struct virtio_net *

        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 = get_device(vid);
+    if (dev == NULL)
+        return 0;
+
+    vq = dev->virtqueue[qid];
+    if (vq == NULL)
+        return 0;
+
+    if (unlikely(vq->enabled == 0 || vq->avail == NULL))
+        return 0;
+
+    return !(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
+}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] vhost: Expose virtio interrupt requirement on rte_vhos API
  2017-09-23 19:16 [PATCH] vhost: Expose virtio interrupt requirement on rte_vhos API Jan Scheurich
@ 2017-09-24 14:02 ` Stephen Hemminger
       [not found]   ` <CAOaVG14gM4x7HKeYzyZ0bkvL_yAVLF+9AUufBd1eufKRs9U84A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2017-09-24 14:02 UTC (permalink / raw)
  To: Jan Scheurich; +Cc: dev, dev

I heard Fd.io has a faster vhost driver. Has anyone investigated?

On Sep 23, 2017 8:16 PM, "Jan Scheurich" <jan.scheurich@ericsson.com> wrote:

> 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.
>
> 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%.
>
> 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.
>
> 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.
>
> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
>
> ---
>
>  lib/librte_vhost/rte_vhost.h | 12 ++++++++++++
>  lib/librte_vhost/vhost.c     | 19 +++++++++++++++++++
>  2 files changed, 31 insertions(+)
>
> 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
> vring_idx,
>   */
>  uint32_t rte_vhost_rx_queue_count(int vid, uint16_t qid);
>
> +/**
> + * 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..bd1ebf9 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -503,3 +503,22 @@ struct virtio_net *
>
>         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 = get_device(vid);
> +    if (dev == NULL)
> +        return 0;
> +
> +    vq = dev->virtqueue[qid];
> +    if (vq == NULL)
> +        return 0;
> +
> +    if (unlikely(vq->enabled == 0 || vq->avail == NULL))
> +        return 0;
> +
> +    return !(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
> +}
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: Expose virtio interrupt requirement on rte_vhos API
       [not found]   ` <CAOaVG14gM4x7HKeYzyZ0bkvL_yAVLF+9AUufBd1eufKRs9U84A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-09-25  6:49     ` Yang, Zhiyong
  0 siblings, 0 replies; 4+ messages in thread
From: Yang, Zhiyong @ 2017-09-25  6:49 UTC (permalink / raw)
  To: Stephen Hemminger, Jan Scheurich
  Cc: dev-VfR2kkLFssw, dev-yBygre7rU0TnMu66kgdUjQ


> -----Original Message-----
> From: dev [mailto:dev-bounces-VfR2kkLFssw@public.gmane.org] On Behalf Of Stephen Hemminger
> Sent: Sunday, September 24, 2017 10:02 PM
> To: Jan Scheurich <jan.scheurich-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
> Cc: dev-VfR2kkLFssw@public.gmane.org; dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org
> Subject: Re: [dpdk-dev] [PATCH] vhost: Expose virtio interrupt requirement on
> rte_vhos API
> 
> I heard Fd.io has a faster vhost driver. Has anyone investigated?
> 

The perf comparison between  DPDK vhost and VPP vhost need a fair apple to apple testing, 
If DPDK vhost driver as plugin works under VPP framework, It seems that converting packet
header or adding VPP header  as overhead is needed. I don't see the apple to apple  testing nums
so far.

Thanks
Zhiyong



 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] vhost: Expose virtio interrupt requirement on rte_vhos API
@ 2017-09-22 10:21 Jan Scheurich
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Scheurich @ 2017-09-22 10:21 UTC (permalink / raw)
  To: dev-VfR2kkLFssw; +Cc: dev-yBygre7rU0TnMu66kgdUjQ

Performance tests with the OVS DPDK datapath have shown that the achievable 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, but 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.

OVS is addressing this issue with 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%.

On the other hand, guests using DPDK 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.

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 this.

Signed-off-by: Jan Scheurich <jan.scheurich-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>

---

 lib/librte_vhost/rte_vhost.h | 12 ++++++++++++
 lib/librte_vhost/vhost.c     | 19 +++++++++++++++++++
 2 files changed, 31 insertions(+)

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 vring_idx,
  */
 uint32_t rte_vhost_rx_queue_count(int vid, uint16_t qid);

+/**
+ * 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..bd1ebf9 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -503,3 +503,22 @@ struct virtio_net *

        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 = get_device(vid);
+    if (dev == NULL)
+        return 0;
+
+    vq = dev->virtqueue[qid];
+    if (vq == NULL)
+        return 0;
+
+    if (unlikely(vq->enabled == 0 || vq->avail == NULL))
+        return 0;
+
+    return !(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
+}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-25  6:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-23 19:16 [PATCH] vhost: Expose virtio interrupt requirement on rte_vhos API Jan Scheurich
2017-09-24 14:02 ` Stephen Hemminger
     [not found]   ` <CAOaVG14gM4x7HKeYzyZ0bkvL_yAVLF+9AUufBd1eufKRs9U84A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-09-25  6:49     ` [dpdk-dev] " Yang, Zhiyong
  -- strict thread matches above, loose matches on Subject: below --
2017-09-22 10:21 Jan Scheurich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.