Message ID | 1438178940-13557-1-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | Accepted |
Commit | c06a2258226b9b13a110c76b4c295895c147857c |
Headers | show |
Please review. That patch is needed for dpdk. Maxim. On 07/29/15 17:09, Maxim Uvarov wrote: > Use number of workers to not deadlock on barrier. > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > --- > test/validation/synchronizers/synchronizers.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/test/validation/synchronizers/synchronizers.c b/test/validation/synchronizers/synchronizers.c > index 6b354b6..7c521ca 100644 > --- a/test/validation/synchronizers/synchronizers.c > +++ b/test/validation/synchronizers/synchronizers.c > @@ -1054,8 +1054,9 @@ int synchronizers_suite_init(void) > > int synchronizers_init(void) > { > - uint32_t core_count, max_threads; > + uint32_t workers_count, max_threads; > int ret = 0; > + odp_cpumask_t mask; > > if (0 != odp_init_global(NULL, NULL)) { > fprintf(stderr, "error: odp_init_global() failed.\n"); > @@ -1081,9 +1082,10 @@ int synchronizers_init(void) > global_mem->g_iterations = MAX_ITERATIONS; > global_mem->g_verbose = VERBOSE; > > - core_count = odp_cpu_count(); > + workers_count = odp_cpumask_def_worker(&mask, 0); > > - max_threads = (core_count >= MAX_WORKERS) ? MAX_WORKERS : core_count; > + max_threads = (workers_count >= MAX_WORKERS) ? > + MAX_WORKERS : workers_count; > > if (max_threads < global_mem->g_num_threads) { > printf("Requested num of threads is too large\n");
I'm not sure I get the entire context of why it deadlocks on barrier, but otherwise it seems OK, and it fixes the problem in the ODP-DPDK unit tests. Tested-by: Zoltan Kiss <zoltan.kiss@linaro.org> Let me know when it gets applied so I can pull it. On 29/07/15 15:09, Maxim Uvarov wrote: > Use number of workers to not deadlock on barrier. > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > --- > test/validation/synchronizers/synchronizers.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/test/validation/synchronizers/synchronizers.c b/test/validation/synchronizers/synchronizers.c > index 6b354b6..7c521ca 100644 > --- a/test/validation/synchronizers/synchronizers.c > +++ b/test/validation/synchronizers/synchronizers.c > @@ -1054,8 +1054,9 @@ int synchronizers_suite_init(void) > > int synchronizers_init(void) > { > - uint32_t core_count, max_threads; > + uint32_t workers_count, max_threads; > int ret = 0; > + odp_cpumask_t mask; > > if (0 != odp_init_global(NULL, NULL)) { > fprintf(stderr, "error: odp_init_global() failed.\n"); > @@ -1081,9 +1082,10 @@ int synchronizers_init(void) > global_mem->g_iterations = MAX_ITERATIONS; > global_mem->g_verbose = VERBOSE; > > - core_count = odp_cpu_count(); > + workers_count = odp_cpumask_def_worker(&mask, 0); > > - max_threads = (core_count >= MAX_WORKERS) ? MAX_WORKERS : core_count; > + max_threads = (workers_count >= MAX_WORKERS) ? > + MAX_WORKERS : workers_count; > > if (max_threads < global_mem->g_num_threads) { > printf("Requested num of threads is too large\n"); >
Merged as. commit c06a2258226b9b13a110c76b4c295895c147857c On 08/03/15 20:13, Zoltan Kiss wrote: > I'm not sure I get the entire context of why it deadlocks on barrier, > but otherwise it seems OK, and it fixes the problem in the ODP-DPDK > unit tests. > The idea is that if you have X cpu, and one thread is control thread then odp_barrier() initialized to X but actually X-1 threads started and all of them locked on barrier, waiting for last thread. So that barrier should be initialized only for number of active workers, not to the total number of cpus. Maxim. > Tested-by: Zoltan Kiss <zoltan.kiss@linaro.org> > > Let me know when it gets applied so I can pull it. > > On 29/07/15 15:09, Maxim Uvarov wrote: >> Use number of workers to not deadlock on barrier. >> >> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> >> --- >> test/validation/synchronizers/synchronizers.c | 8 +++++--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/test/validation/synchronizers/synchronizers.c >> b/test/validation/synchronizers/synchronizers.c >> index 6b354b6..7c521ca 100644 >> --- a/test/validation/synchronizers/synchronizers.c >> +++ b/test/validation/synchronizers/synchronizers.c >> @@ -1054,8 +1054,9 @@ int synchronizers_suite_init(void) >> >> int synchronizers_init(void) >> { >> - uint32_t core_count, max_threads; >> + uint32_t workers_count, max_threads; >> int ret = 0; >> + odp_cpumask_t mask; >> >> if (0 != odp_init_global(NULL, NULL)) { >> fprintf(stderr, "error: odp_init_global() failed.\n"); >> @@ -1081,9 +1082,10 @@ int synchronizers_init(void) >> global_mem->g_iterations = MAX_ITERATIONS; >> global_mem->g_verbose = VERBOSE; >> >> - core_count = odp_cpu_count(); >> + workers_count = odp_cpumask_def_worker(&mask, 0); >> >> - max_threads = (core_count >= MAX_WORKERS) ? MAX_WORKERS : >> core_count; >> + max_threads = (workers_count >= MAX_WORKERS) ? >> + MAX_WORKERS : workers_count; >> >> if (max_threads < global_mem->g_num_threads) { >> printf("Requested num of threads is too large\n"); >>
diff --git a/test/validation/synchronizers/synchronizers.c b/test/validation/synchronizers/synchronizers.c index 6b354b6..7c521ca 100644 --- a/test/validation/synchronizers/synchronizers.c +++ b/test/validation/synchronizers/synchronizers.c @@ -1054,8 +1054,9 @@ int synchronizers_suite_init(void) int synchronizers_init(void) { - uint32_t core_count, max_threads; + uint32_t workers_count, max_threads; int ret = 0; + odp_cpumask_t mask; if (0 != odp_init_global(NULL, NULL)) { fprintf(stderr, "error: odp_init_global() failed.\n"); @@ -1081,9 +1082,10 @@ int synchronizers_init(void) global_mem->g_iterations = MAX_ITERATIONS; global_mem->g_verbose = VERBOSE; - core_count = odp_cpu_count(); + workers_count = odp_cpumask_def_worker(&mask, 0); - max_threads = (core_count >= MAX_WORKERS) ? MAX_WORKERS : core_count; + max_threads = (workers_count >= MAX_WORKERS) ? + MAX_WORKERS : workers_count; if (max_threads < global_mem->g_num_threads) { printf("Requested num of threads is too large\n");
Use number of workers to not deadlock on barrier. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- test/validation/synchronizers/synchronizers.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)