[ovs-dev] [PATCH] INSTALL.DPDK.md: Clarify DPDK arguments.
Traynor, Kevin
kevin.traynor at intel.com
Tue Dec 15 14:50:21 UTC 2015
> -----Original Message-----
> From: Zoltan Kiss [mailto:zoltan.kiss at linaro.org]
> Sent: Monday, December 14, 2015 6:32 PM
> To: Traynor, Kevin; Aaron Conole
> Cc: dev at openvswitch.org
> Subject: Re: [ovs-dev] [PATCH] INSTALL.DPDK.md: Clarify DPDK arguments.
>
>
>
> On 14/12/15 17:35, Traynor, Kevin wrote:
> > How about letting the control threads just float on the non-isolcpu'd
> cores.
> > We could then potentially remove the -c argument which would simplify
> > setup as the user would only need to think about one mask - pmd-cpu-mask
> > (which of course we could also default).
> >
> > Strawman for it would be something like this...
>
> Seems good, assuming that the thread affinity at the time dpdk_init()
> was called reflects what cores are allowed for non-PMD threads. And what
> if the user wants to change that later?
Hi - not sure what you mean by "allowed for non-PMD threads". Is there an example?
I still have some testing to do and it may be there is a case for keeping the -c
for some scenarios but at least below may be a good default.
>
> >
> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> > index e3a0771..031f405 100644
> > --- a/lib/netdev-dpdk.c
> > +++ b/lib/netdev-dpdk.c
> > @@ -2135,12 +2135,15 @@ process_vhost_flags(char *flag, char *default_val,
> int size,
> > int
> > 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;
> >
> > /* Remove the --dpdk argument from arg list.*/
> > argc--;
> > @@ -2176,23 +2179,51 @@ dpdk_init(int argc, char **argv)
> > */
> > argc -= 2;
> > argv += 2; /* Increment by two to bypass the vhost flag
> arguments */
> > base = 2;
> > }
> >
> > + /*NOTE: Assumes -c option removed from cmdline/db etc. */
> > +
> > + /* 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;
> > + }
> > +
> > + /* Extract lowest core affinity and set the -c */
> > + for (i = 0; i < CPU_SETSIZE; i++) {
> > + isset = CPU_ISSET(i, &cpuset);
> > + if (isset) {
> > + /* TODO: check for any numa inconsistencies with memory and
> embedded -c
> > + * option in argv for rte_eal_init() */
> > + break;
> > + }
> > + }
> > +
> > /* Keep the program name argument as this is needed for call to
> > * rte_eal_init()
> > */
> > argv[0] = pragram_name;
> >
> > /* Make sure things are initialized ... */
> > result = rte_eal_init(argc, argv);
> > if (result < 0) {
> > 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;
> > + }
More information about the dev
mailing list