Thanks for the series. I fixed a warning with gcc-4.8:
../lib/netdev-dpdk.c: In function 'dpdk_init__': ../lib/netdev-dpdk.c:3197:27: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (auto_determine && !err) { ^ cc1: all warnings being treated as errors and pushed this to master 2016-05-19 5:51 GMT-07:00 Kevin Traynor <kevin.tray...@intel.com>: > Prevent pthread_setaffinity_np() being called with a potentially > invalid cpu_set_t and add a default (core 0x1). > > Also, only call pthread_getaffinity_np() if no dpdk-lcore-mask specified. > > Signed-off-by: Kevin Traynor <kevin.tray...@intel.com> > Acked-by: Aaron Conole <acon...@redhat.com> > --- > v3: Rebase and add Ack. > > lib/netdev-dpdk.c | 35 ++++++++++++++++++++--------------- > 1 files changed, 20 insertions(+), 15 deletions(-) > > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c > index 5d5351d..f3faef0 100644 > --- a/lib/netdev-dpdk.c > +++ b/lib/netdev-dpdk.c > @@ -3126,14 +3126,6 @@ dpdk_init__(const struct smap *ovs_other_config) > #endif > } > > - /* 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); > - } > - > argv = grow_argv(&argv, 0, 1); > argc = 1; > argv[0] = xstrdup(ovs_get_program_name()); > @@ -3154,13 +3146,26 @@ dpdk_init__(const struct smap *ovs_other_config) > */ > if (auto_determine) { > int i; > - for (i = 0; i < CPU_SETSIZE; i++) { > - if (CPU_ISSET(i, &cpuset)) { > - argv = grow_argv(&argv, argc, 2); > - argv[argc++] = xstrdup("-c"); > - argv[argc++] = xasprintf("0x%08llX", (1ULL<<i)); > - i = CPU_SETSIZE; > + /* Get the main thread affinity */ > + CPU_ZERO(&cpuset); > + err = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), > + &cpuset); > + if (!err) { > + for (i = 0; i < CPU_SETSIZE; i++) { > + if (CPU_ISSET(i, &cpuset)) { > + argv = grow_argv(&argv, argc, 2); > + argv[argc++] = xstrdup("-c"); > + argv[argc++] = xasprintf("0x%08llX", (1ULL<<i)); > + i = CPU_SETSIZE; > + } > } > + } else { > + VLOG_ERR("Thread getaffinity error %d. Using core 0x1", err); > + /* User did not set dpdk-lcore-mask and unable to get current > + * thread affintity - default to core 0x1 */ > + argv = grow_argv(&argv, argc, 2); > + argv[argc++] = xstrdup("-c"); > + argv[argc++] = xasprintf("0x%X", 1); > } > } > > @@ -3189,7 +3194,7 @@ dpdk_init__(const struct smap *ovs_other_config) > } > > /* Set the main thread affinity back to pre rte_eal_init() value */ > - if (auto_determine) { > + if (auto_determine && !err) { > err = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), > &cpuset); > if (err) { > -- > 1.7.4.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev