[ovs-dev] [PATCH v10 1/6] netdev-dpdk: Restore thread affinity after DPDK init

Daniele Di Proietto diproiettod at vmware.com
Mon Mar 28 21:59:06 UTC 2016


I'm ok with the idea and the implementation and I'm willing to apply
this patch despite the issue depicted below.

I just want to mention that with just this patch applied I experience
a lower throughput for the single flow phy test on my system (~14 Mpps
instead of 14.88 Mpps).

I thought that this was related to some weird scheduling condition, but
even booting with isocpus didn't help.

After some time I found that depending on the scheduling of the
revalidator threads, my CPU managed to reach different clock frequencies
(~2.8 Ghz when the throughput was low, ~2.4 Ghz when the throughput was
low).

I'm not an expert in this area, but I've been told that this may happen
because the CPU decides not to use TurboBoost.

We may want to consider this in the future, when we reconsider how
to pin/spawn non pmd threads.

Thanks,

Daniele

On 09/03/2016 09:38, "Aaron Conole" <aconole at redhat.com> wrote:

>When the DPDK init function is called, it changes the executing thread's
>CPU affinity to a single core specified in -c. This will result in the
>userspace bridge configuration thread being rebound, even if that is not
>the intent.
>
>This change fixes that behavior by rebinding to the original thread
>affinity after calling dpdk_init().
>
>Signed-off-by: Kevin Traynor <kevin.traynor at intel.com>
>Signed-off-by: Aaron Conole <aconole at redhat.com>
>Tested-by: RobertX Wojciechowicz <robertx.wojciechowicz at intel.com>
>Tested-by: Sean K Mooney <sean.k.mooney at intel.com>
>Acked-by: Panu Matilainen <pmatilai at redhat.com>
>Acked-by: Flavio Leitner <fbl at sysclose.org>
>---
>v2:
>* Removed trailing whitespace
>
>v3->v10:
>* No change
>
> lib/netdev-dpdk.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
>diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>index 0233b3c..d44cf46 100644
>--- a/lib/netdev-dpdk.c
>+++ b/lib/netdev-dpdk.c
>@@ -2739,6 +2739,9 @@ dpdk_init(int argc, char **argv)
>     int result;
>     int base = 0;
>     char *pragram_name = argv[0];
>+    int err;
>+    int isset;
>+    cpu_set_t cpuset;
> 
>     if (argc < 2 || strcmp(argv[1], "--dpdk"))
>         return 0;
>@@ -2780,6 +2783,14 @@ dpdk_init(int argc, char **argv)
>         base = 2;
>     }
> 
>+    /* Get the main thread affinity */
>+    CPU_ZERO(&cpuset);
>+    err = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
>&cpuset);
>+    if (err) {
>+        VLOG_ERR("Thread getaffinity error %d.", err);
>+        return err;
>+    }
>+
>     /* Keep the program name argument as this is needed for call to
>      * rte_eal_init()
>      */
>@@ -2791,6 +2802,13 @@ dpdk_init(int argc, char **argv)
>         ovs_abort(result, "Cannot init EAL");
>     }
> 
>+    /* Set the main thread affinity back to pre rte_eal_init() value */
>+    err = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t),
>&cpuset);
>+    if (err) {
>+        VLOG_ERR("Thread setaffinity error %d", err);
>+        return err;
>+    }
>+
>     rte_memzone_dump(stdout);
>     rte_eal_init_ret = 0;
> 
>-- 
>2.5.0




More information about the dev mailing list