diff mbox series

[ovs-dev] netdev-dpdk: Track vhost tx contention.

Message ID 1566829997-6221-1-git-send-email-david.marchand@redhat.com
State Accepted
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev] netdev-dpdk: Track vhost tx contention. | expand

Commit Message

David Marchand Aug. 26, 2019, 2:33 p.m. UTC
Add a coverage counter to help diagnose contention on the vhost txqs.
This is seen as dropped packets on the physical ports for rates that
are usually handled fine by OVS.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/netdev-dpdk.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

David Marchand Sept. 9, 2019, 11:23 a.m. UTC | #1
On Mon, Aug 26, 2019 at 4:36 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> Add a coverage counter to help diagnose contention on the vhost txqs.
> This is seen as dropped packets on the physical ports for rates that
> are usually handled fine by OVS.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Hey guys, can somebody look at this approach and tell me if something
is wrong with it?
Thanks.
Eelco Chaudron Sept. 10, 2019, 2:28 p.m. UTC | #2
On 26 Aug 2019, at 16:33, David Marchand wrote:

> Add a coverage counter to help diagnose contention on the vhost txqs.
> This is seen as dropped packets on the physical ports for rates that
> are usually handled fine by OVS.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>

LGTM, Acked-by: Eelco Chaudron <echaudro@redhat.com>
Ilya Maximets Nov. 8, 2019, 11:06 p.m. UTC | #3
On 26.08.2019 16:33, David Marchand wrote:
> Add a coverage counter to help diagnose contention on the vhost txqs.
> This is seen as dropped packets on the physical ports for rates that
> are usually handled fine by OVS.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

Thanks! I changed 'unlikely' to 'OVS_UNLIKELY' and applied to master.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 4805783..ea8599b 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -41,6 +41,7 @@ 
 #include <rte_vhost.h>
 
 #include "cmap.h"
+#include "coverage.h"
 #include "dirs.h"
 #include "dp-packet.h"
 #include "dpdk.h"
@@ -72,6 +73,8 @@  enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM};
 VLOG_DEFINE_THIS_MODULE(netdev_dpdk);
 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
 
+COVERAGE_DEFINE(vhost_tx_contention);
+
 #define DPDK_PORT_WATCHDOG_INTERVAL 5
 
 #define OVS_CACHE_LINE_SIZE CACHE_LINE_SIZE
@@ -2387,7 +2390,10 @@  __netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
         goto out;
     }
 
-    rte_spinlock_lock(&dev->tx_q[qid].tx_lock);
+    if (unlikely(!rte_spinlock_trylock(&dev->tx_q[qid].tx_lock))) {
+        COVERAGE_INC(vhost_tx_contention);
+        rte_spinlock_lock(&dev->tx_q[qid].tx_lock);
+    }
 
     cnt = netdev_dpdk_filter_packet_len(dev, cur_pkts, cnt);
     /* Check has QoS has been configured for the netdev */