Re: [lng-odp] [PATCH v4] helper: linux: add thread type in pthread_create
Hi, On 18/12/15 14:13, Zoltan Kiss wrote: On 18/12/15 13:52, David Nystrom wrote: Borked nothbound API once again. So why is this needed at all?, does one need to create control threads via ODP ?, why ? This is not ODP, but the helper functions used by unit tests and example apps to create threads. It's worth to add that although thread creation is the application's job, but it should call odp_init_local() from each thread, with the parameter marking whether it's a control or worker thread. Zoltan Br, David On Wed, Dec 16, 2015 at 1:18 PM, Maxim Uvarov mailto:maxim.uva...@linaro.org>> wrote: Merged, Maxim. On 12/16/2015 12:44, Hemant Agrawal wrote: The exisiting helper routine only create the worker threads. However there is a need to use the same for creating the control thread as well. e.g. CLI thread. Signed-off-by: Hemant Agrawal mailto:hem...@freescale.com>> --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 9 ++--- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c| 3 ++- example/timer/odp_timer_test.c| 2 +- helper/include/odp/helper/linux.h | 5 - helper/linux.c| 6 -- helper/test/odp_thread.c | 3 ++- test/api_test/odp_common.c| 2 +- test/performance/odp_atomic.c | 2 +- test/performance/odp_l2fwd.c | 3 ++- test/performance/odp_pktio_perf.c | 4 ++-- test/performance/odp_scheduling.c | 2 +- test/validation/common/odp_cunit_common.c | 2 +- 14 files changed, 29 insertions(+), 18 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 0da07e7..00da68a 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -593,7 +593,7 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, pktio_receive_thread, - args); + args, ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 2de530d..93eefe9 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -784,7 +784,8 @@ int main(int argc, char *argv[]) abort(); args->thread[1].mode = args->appl.mode; odph_linux_pthread_create(&thread_tbl[1], &cpu_mask, - gen_recv_thread, &args->thread[1]); + gen_recv_thread, &args->thread[1], + ODP_THREAD_WORKER); tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL); if (tq == ODP_QUEUE_INVALID) @@ -804,7 +805,8 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); odp_cpumask_set(&cpu_mask, cpu_next); odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, - gen_send_thread, &args->thread[0]); + gen_send_thread, &args->thread[0], + ODP_THREAD_WORKER); } else { int cpu = odp_cpumask_first(&cpumask); @@ -849,7 +851,8 @@ int main(int argc, char *argv[]) odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index d784c31..88e73ff 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1333,7 +1333,7 @@ main(int argc, char *argv[]) * Create and init worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - pktio_thre
Re: [lng-odp] [PATCH v4] helper: linux: add thread type in pthread_create
Hi, Workers are the majority, but not all threads using the ODP API process packets at max rate. For example, one thread could be used to create/monitor/command worker threads, or another one could run once per second to collect statistics, etc. For example, worker vs. non-worker (== control) thread selection may tell the ODP implementation (in thread initialization phase) if the thread is going to need direct and dedicated access to various HW accelerators (== worker), or if it is OK to share those accesses with other slow path threads (==control). -Petri From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT David Nystrom Sent: Friday, December 18, 2015 3:52 PM To: Maxim Uvarov Cc: lng-odp-forward Subject: Re: [lng-odp] [PATCH v4] helper: linux: add thread type in pthread_create Borked nothbound API once again. So why is this needed at all?, does one need to create control threads via ODP ?, why ? Br, David On Wed, Dec 16, 2015 at 1:18 PM, Maxim Uvarov mailto:maxim.uva...@linaro.org>> wrote: Merged, Maxim. On 12/16/2015 12:44, Hemant Agrawal wrote: The exisiting helper routine only create the worker threads. However there is a need to use the same for creating the control thread as well. e.g. CLI thread. Signed-off-by: Hemant Agrawal mailto:hem...@freescale.com>> ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
Re: [lng-odp] [PATCH v4] helper: linux: add thread type in pthread_create
On 18/12/15 13:52, David Nystrom wrote: Borked nothbound API once again. So why is this needed at all?, does one need to create control threads via ODP ?, why ? This is not ODP, but the helper functions used by unit tests and example apps to create threads. Zoltan Br, David On Wed, Dec 16, 2015 at 1:18 PM, Maxim Uvarov mailto:maxim.uva...@linaro.org>> wrote: Merged, Maxim. On 12/16/2015 12:44, Hemant Agrawal wrote: The exisiting helper routine only create the worker threads. However there is a need to use the same for creating the control thread as well. e.g. CLI thread. Signed-off-by: Hemant Agrawal mailto:hem...@freescale.com>> --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 9 ++--- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c| 3 ++- example/timer/odp_timer_test.c| 2 +- helper/include/odp/helper/linux.h | 5 - helper/linux.c| 6 -- helper/test/odp_thread.c | 3 ++- test/api_test/odp_common.c| 2 +- test/performance/odp_atomic.c | 2 +- test/performance/odp_l2fwd.c | 3 ++- test/performance/odp_pktio_perf.c | 4 ++-- test/performance/odp_scheduling.c | 2 +- test/validation/common/odp_cunit_common.c | 2 +- 14 files changed, 29 insertions(+), 18 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 0da07e7..00da68a 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -593,7 +593,7 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, pktio_receive_thread, - args); + args, ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 2de530d..93eefe9 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -784,7 +784,8 @@ int main(int argc, char *argv[]) abort(); args->thread[1].mode = args->appl.mode; odph_linux_pthread_create(&thread_tbl[1], &cpu_mask, - gen_recv_thread, &args->thread[1]); + gen_recv_thread, &args->thread[1], + ODP_THREAD_WORKER); tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL); if (tq == ODP_QUEUE_INVALID) @@ -804,7 +805,8 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); odp_cpumask_set(&cpu_mask, cpu_next); odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, - gen_send_thread, &args->thread[0]); + gen_send_thread, &args->thread[0], + ODP_THREAD_WORKER); } else { int cpu = odp_cpumask_first(&cpumask); @@ -849,7 +851,8 @@ int main(int argc, char *argv[]) odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index d784c31..88e73ff 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1333,7 +1333,7 @@ main(int argc, char *argv[]) * Create and init worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - pktio_thread, NULL); + pktio_thread, NULL, ODP_THREAD_WORKER);
Re: [lng-odp] [PATCH v4] helper: linux: add thread type in pthread_create
Borked nothbound API once again. So why is this needed at all?, does one need to create control threads via ODP ?, why ? Br, David On Wed, Dec 16, 2015 at 1:18 PM, Maxim Uvarov wrote: > Merged, > Maxim. > > > On 12/16/2015 12:44, Hemant Agrawal wrote: > >> The exisiting helper routine only create the worker threads. >> However there is a need to use the same for creating the control >> thread as well. e.g. CLI thread. >> >> Signed-off-by: Hemant Agrawal >> --- >> example/classifier/odp_classifier.c | 2 +- >> example/generator/odp_generator.c | 9 ++--- >> example/ipsec/odp_ipsec.c | 2 +- >> example/packet/odp_pktio.c| 3 ++- >> example/timer/odp_timer_test.c| 2 +- >> helper/include/odp/helper/linux.h | 5 - >> helper/linux.c| 6 -- >> helper/test/odp_thread.c | 3 ++- >> test/api_test/odp_common.c| 2 +- >> test/performance/odp_atomic.c | 2 +- >> test/performance/odp_l2fwd.c | 3 ++- >> test/performance/odp_pktio_perf.c | 4 ++-- >> test/performance/odp_scheduling.c | 2 +- >> test/validation/common/odp_cunit_common.c | 2 +- >> 14 files changed, 29 insertions(+), 18 deletions(-) >> >> diff --git a/example/classifier/odp_classifier.c >> b/example/classifier/odp_classifier.c >> index 0da07e7..00da68a 100644 >> --- a/example/classifier/odp_classifier.c >> +++ b/example/classifier/odp_classifier.c >> @@ -593,7 +593,7 @@ int main(int argc, char *argv[]) >> odp_cpumask_set(&thd_mask, cpu); >> odph_linux_pthread_create(&thread_tbl[i], &thd_mask, >> pktio_receive_thread, >> - args); >> + args, ODP_THREAD_WORKER); >> cpu = odp_cpumask_next(&cpumask, cpu); >> } >> diff --git a/example/generator/odp_generator.c >> b/example/generator/odp_generator.c >> index 2de530d..93eefe9 100644 >> --- a/example/generator/odp_generator.c >> +++ b/example/generator/odp_generator.c >> @@ -784,7 +784,8 @@ int main(int argc, char *argv[]) >> abort(); >> args->thread[1].mode = args->appl.mode; >> odph_linux_pthread_create(&thread_tbl[1], &cpu_mask, >> - gen_recv_thread, >> &args->thread[1]); >> + gen_recv_thread, >> &args->thread[1], >> + ODP_THREAD_WORKER); >> tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL); >> if (tq == ODP_QUEUE_INVALID) >> @@ -804,7 +805,8 @@ int main(int argc, char *argv[]) >> odp_cpumask_zero(&cpu_mask); >> odp_cpumask_set(&cpu_mask, cpu_next); >> odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, >> - gen_send_thread, >> &args->thread[0]); >> + gen_send_thread, >> &args->thread[0], >> + ODP_THREAD_WORKER); >> } else { >> int cpu = odp_cpumask_first(&cpumask); >> @@ -849,7 +851,8 @@ int main(int argc, char *argv[]) >> odph_linux_pthread_create(&thread_tbl[i], >> &thd_mask, >> thr_run_func, >> - &args->thread[i]); >> + &args->thread[i], >> + ODP_THREAD_WORKER); >> cpu = odp_cpumask_next(&cpumask, cpu); >> } >> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c >> index d784c31..88e73ff 100644 >> --- a/example/ipsec/odp_ipsec.c >> +++ b/example/ipsec/odp_ipsec.c >> @@ -1333,7 +1333,7 @@ main(int argc, char *argv[]) >> * Create and init worker threads >> */ >> odph_linux_pthread_create(thread_tbl, &cpumask, >> - pktio_thread, NULL); >> + pktio_thread, NULL, ODP_THREAD_WORKER); >> /* >> * If there are streams attempt to verify them else >> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c >> index 93c38f5..75e92ac 100644 >> --- a/example/packet/odp_pktio.c >> +++ b/example/packet/odp_pktio.c >> @@ -442,7 +442,8 @@ int main(int argc, char *argv[]) >> odp_cpumask_set(&thd_mask, cpu); >> odph_linux_pthread_create(&thread_tbl[i], &thd_mask, >> thr_run_func, >> - &args->thread[i]); >> + &args->thread[i], >> + ODP
Re: [lng-odp] [PATCH v4] helper: linux: add thread type in pthread_create
Merged, Maxim. On 12/16/2015 12:44, Hemant Agrawal wrote: The exisiting helper routine only create the worker threads. However there is a need to use the same for creating the control thread as well. e.g. CLI thread. Signed-off-by: Hemant Agrawal --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 9 ++--- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c| 3 ++- example/timer/odp_timer_test.c| 2 +- helper/include/odp/helper/linux.h | 5 - helper/linux.c| 6 -- helper/test/odp_thread.c | 3 ++- test/api_test/odp_common.c| 2 +- test/performance/odp_atomic.c | 2 +- test/performance/odp_l2fwd.c | 3 ++- test/performance/odp_pktio_perf.c | 4 ++-- test/performance/odp_scheduling.c | 2 +- test/validation/common/odp_cunit_common.c | 2 +- 14 files changed, 29 insertions(+), 18 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 0da07e7..00da68a 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -593,7 +593,7 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, pktio_receive_thread, - args); + args, ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 2de530d..93eefe9 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -784,7 +784,8 @@ int main(int argc, char *argv[]) abort(); args->thread[1].mode = args->appl.mode; odph_linux_pthread_create(&thread_tbl[1], &cpu_mask, - gen_recv_thread, &args->thread[1]); + gen_recv_thread, &args->thread[1], + ODP_THREAD_WORKER); tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL); if (tq == ODP_QUEUE_INVALID) @@ -804,7 +805,8 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); odp_cpumask_set(&cpu_mask, cpu_next); odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, - gen_send_thread, &args->thread[0]); + gen_send_thread, &args->thread[0], + ODP_THREAD_WORKER); } else { int cpu = odp_cpumask_first(&cpumask); @@ -849,7 +851,8 @@ int main(int argc, char *argv[]) odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index d784c31..88e73ff 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1333,7 +1333,7 @@ main(int argc, char *argv[]) * Create and init worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - pktio_thread, NULL); + pktio_thread, NULL, ODP_THREAD_WORKER); /* * If there are streams attempt to verify them else diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 93c38f5..75e92ac 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -442,7 +442,8 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 0ec73b1..bd05ce4 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -479,7 +479,7 @@ int main(int argc, char *argv[]) /* Create and launch worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - run_thread, gbls); +
[lng-odp] [PATCH v4] helper: linux: add thread type in pthread_create
The exisiting helper routine only create the worker threads. However there is a need to use the same for creating the control thread as well. e.g. CLI thread. Signed-off-by: Hemant Agrawal --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 9 ++--- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c| 3 ++- example/timer/odp_timer_test.c| 2 +- helper/include/odp/helper/linux.h | 5 - helper/linux.c| 6 -- helper/test/odp_thread.c | 3 ++- test/api_test/odp_common.c| 2 +- test/performance/odp_atomic.c | 2 +- test/performance/odp_l2fwd.c | 3 ++- test/performance/odp_pktio_perf.c | 4 ++-- test/performance/odp_scheduling.c | 2 +- test/validation/common/odp_cunit_common.c | 2 +- 14 files changed, 29 insertions(+), 18 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 0da07e7..00da68a 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -593,7 +593,7 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, pktio_receive_thread, - args); + args, ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 2de530d..93eefe9 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -784,7 +784,8 @@ int main(int argc, char *argv[]) abort(); args->thread[1].mode = args->appl.mode; odph_linux_pthread_create(&thread_tbl[1], &cpu_mask, - gen_recv_thread, &args->thread[1]); + gen_recv_thread, &args->thread[1], + ODP_THREAD_WORKER); tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL); if (tq == ODP_QUEUE_INVALID) @@ -804,7 +805,8 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); odp_cpumask_set(&cpu_mask, cpu_next); odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, - gen_send_thread, &args->thread[0]); + gen_send_thread, &args->thread[0], + ODP_THREAD_WORKER); } else { int cpu = odp_cpumask_first(&cpumask); @@ -849,7 +851,8 @@ int main(int argc, char *argv[]) odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index d784c31..88e73ff 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1333,7 +1333,7 @@ main(int argc, char *argv[]) * Create and init worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - pktio_thread, NULL); + pktio_thread, NULL, ODP_THREAD_WORKER); /* * If there are streams attempt to verify them else diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 93c38f5..75e92ac 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -442,7 +442,8 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 0ec73b1..bd05ce4 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -479,7 +479,7 @@ int main(int argc, char *argv[]) /* Create and launch worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - run_thread, gbls); + run_thread, gbls, ODP_THREAD_WORK