Signed-off-by: Daniele Di Proietto <diproiet...@vmware.com>
---
 lib/netdev-dummy.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 54a1152..aa244b6 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -19,6 +19,7 @@
 #include "dummy.h"
 
 #include <errno.h>
+#include <unistd.h>
 
 #include "dp-packet.h"
 #include "dpif-netdev.h"
@@ -971,6 +972,20 @@ netdev_dummy_rxq_recv(struct netdev_rxq *rxq_, struct 
dp_packet **arr,
     ovs_mutex_unlock(&netdev->mutex);
 
     if (!packet) {
+        if (netdev_is_pmd(&netdev->up)) {
+            /* If 'netdev' is a PMD device, this is called as part of the PMD
+             * thread busy loop.  We yield here (without quiescing) for two
+             * reasons:
+             *
+             * - To reduce the CPU utilization during the testsuite
+             * - To give valgrind a chance to switch thread. According
+             *   to the valgrind documentation, there's a big lock that
+             *   prevents multiple thread from being executed at the same
+             *   time.  On my system, without this sleep, the pmd threads
+             *   testcases fail under valgrind, because ovs-vswitchd becomes
+             *   unresponsive. */
+            sched_yield();
+        }
         return EAGAIN;
     }
     ovs_mutex_lock(&netdev->mutex);
-- 
2.8.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to