This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, master has been updated via af5205809e3921ea0c4db5771ea1da5d2f0eaaf5 (commit) from 32b94edb4961a3ac1a2e5c90f65ee3f118852151 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit af5205809e3921ea0c4db5771ea1da5d2f0eaaf5 Author: Petri Savolainen petri.savolainen@linaro.org Date: Fri Feb 3 13:23:59 2017 +0200
helper: linux: renamed threads_extn to linux helpers
There's no platform specific helpers. Helpers may depend on Linux and make it easier to do common series of Linux system calls. These kind of helpers are grouped into helper/linux directory.
Use --enable-helper-linux configuration option to enable support for Linux helpers.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Mike Holmes mike.holmes@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/configure.ac b/configure.ac index 6153efd..0280ef1 100644 --- a/configure.ac +++ b/configure.ac @@ -158,18 +158,6 @@ AC_SUBST([with_platform]) AC_SUBST([platform_with_platform], ["platform/${with_platform}"])
########################################################################## -# Determine which helper platform to build for -########################################################################## -AC_ARG_WITH([helper_platform], - [AS_HELP_STRING([--with-helper_platform=platform], - [select helper platform to be used, default linux-generic])], - [], - [with_helper_platform=${with_platform} - ]) - -AC_SUBST([with_helper_platform]) - -########################################################################## # Run platform specific checks and settings ########################################################################## IMPLEMENTATION_NAME="" @@ -234,7 +222,7 @@ AM_CONDITIONAL([test_example], [test x$test_example = xyes ]) AM_CONDITIONAL([HAVE_DOXYGEN], [test "x${DOXYGEN}" = "xdoxygen"]) AM_CONDITIONAL([user_guide], [test "x${user_guides}" = "xyes" ]) AM_CONDITIONAL([HAVE_MSCGEN], [test "x${MSCGEN}" = "xmscgen"]) -AM_CONDITIONAL([helper_extn], [test x$helper_extn = xyes ]) +AM_CONDITIONAL([helper_linux], [test x$helper_linux = xyes ])
########################################################################## # Setup doxygen documentation @@ -367,8 +355,7 @@ AC_MSG_RESULT([ ARCH_DIR ${ARCH_DIR} ARCH_ABI ${ARCH_ABI} with_platform: ${with_platform} - with_helper_platform: ${with_helper_platform} - helper_extn: ${helper_extn} + helper_linux: ${helper_linux} prefix: ${prefix} sysconfdir: ${sysconfdir} libdir: ${libdir} diff --git a/example/Makefile.inc b/example/Makefile.inc index 854e8af..a4f1047 100644 --- a/example/Makefile.inc +++ b/example/Makefile.inc @@ -1,6 +1,6 @@ include $(top_srcdir)/platform/@with_platform@/Makefile.inc LIB = $(top_builddir)/lib -LDADD = $(LIB)/libodp-linux.la $(LIB)/libodphelper-@with_helper_platform@.la +LDADD = $(LIB)/libodp-linux.la $(LIB)/libodphelper.la AM_CFLAGS += \ -I$(srcdir) \ -I$(top_srcdir)/example \ diff --git a/helper/Makefile.am b/helper/Makefile.am index 6b65eb1..5757c7c 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -31,16 +31,18 @@ helperinclude_HEADERS = \ $(srcdir)/include/odp/helper/threads.h \ $(srcdir)/include/odp/helper/udp.h
-if helper_extn -helperinclude_HEADERS += \ - $(srcdir)/include/odp/helper/platform/@with_helper_platform@/threads_extn.h +if helper_linux +helperlinuxincludedir = $(includedir)/odp/helper/linux +helperlinuxinclude_HEADERS = \ + $(srcdir)/include/odp/helper/linux/pthread.h \ + $(srcdir)/include/odp/helper/linux/process.h endif
noinst_HEADERS = \ $(srcdir)/odph_debug.h \ $(srcdir)/odph_list_internal.h
-__LIB__libodphelper_@with_platform@_la_SOURCES = \ +__LIB__libodphelper_la_SOURCES = \ eth.c \ ip.c \ chksum.c \ @@ -50,9 +52,9 @@ __LIB__libodphelper_@with_platform@_la_SOURCES = \ iplookuptable.c \ threads.c
-if helper_extn -__LIB__libodphelper_@with_platform@_la_SOURCES += \ - platform/@with_helper_platform@/thread.c +if helper_linux +__LIB__libodphelper_la_SOURCES += \ + linux/thread.c endif
-lib_LTLIBRARIES = $(LIB)/libodphelper-@with_platform@.la +lib_LTLIBRARIES = $(LIB)/libodphelper.la diff --git a/helper/include/odp/helper/platform/linux-generic/threads_extn.h b/helper/include/odp/helper/linux/process.h similarity index 59% rename from helper/include/odp/helper/platform/linux-generic/threads_extn.h rename to helper/include/odp/helper/linux/process.h index 1d4036d..9d74146 100644 --- a/helper/include/odp/helper/platform/linux-generic/threads_extn.h +++ b/helper/include/odp/helper/linux/process.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016, Linaro Limited +/* Copyright (c) 2017, Linaro Limited * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -7,15 +7,15 @@ /** * @file * - * ODP Linux helper extension API + * ODP Linux helper for processes * - * This file is an optional helper to odp.h APIs. These functions are provided - * to ease common setups in a Linux system. User is free to implement the same - * setups in otherways (not via this API). + * This file is not part of ODP APIs, but can be optionally used to ease common + * setups in a Linux system. User is free to implement the same setups in + * otherways (not via this file). */
-#ifndef ODPH_LINUX_EXT_H_ -#define ODPH_LINUX_EXT_H_ +#ifndef ODPH_LINUX_PROCESS_H_ +#define ODPH_LINUX_PROCESS_H_
#include <odp/helper/threads.h>
@@ -23,39 +23,11 @@ extern "C" { #endif
-/** @addtogroup odph_linux ODPH LINUX +/** @ingroup odph_linux * @{ */
/** - * Creates and launches pthreads - * - * Creates, pins and launches threads to separate CPU's based on the cpumask. - * - * @param[out] pthread_tbl Table of pthread state information records. Table - * must have at least as many entries as there are - * CPUs in the CPU mask. - * @param mask CPU mask - * @param thr_params Linux helper thread parameters - * - * @return Number of threads created - */ -int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl, - const odp_cpumask_t *mask, - const odph_linux_thr_params_t *thr_params); - -/** - * Waits pthreads to exit - * - * Returns when all threads have been exit. - * - * @param thread_tbl Thread table - * @param num Number of threads to create - * - */ -void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num); - -/** * Fork a process * * Forks and sets CPU affinity for the child process. Ignores 'start' and 'arg' diff --git a/helper/include/odp/helper/linux/pthread.h b/helper/include/odp/helper/linux/pthread.h new file mode 100644 index 0000000..feeda5e --- /dev/null +++ b/helper/include/odp/helper/linux/pthread.h @@ -0,0 +1,66 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP Linux helper for pthreads + * + * This file is not part of ODP APIs, but can be optionally used to ease common + * setups in a Linux system. User is free to implement the same setups in + * otherways (not via this file). + */ + +#ifndef ODPH_LINUX_PTHREAD_H_ +#define ODPH_LINUX_PTHREAD_H_ + +#include <odp/helper/threads.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup odph_linux + * @{ + */ + +/** + * Creates and launches pthreads + * + * Creates, pins and launches threads to separate CPU's based on the cpumask. + * + * @param[out] pthread_tbl Table of pthread state information records. Table + * must have at least as many entries as there are + * CPUs in the CPU mask. + * @param mask CPU mask + * @param thr_params Linux helper thread parameters + * + * @return Number of threads created + */ +int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl, + const odp_cpumask_t *mask, + const odph_linux_thr_params_t *thr_params); + +/** + * Waits pthreads to exit + * + * Returns when all threads have been exit. + * + * @param thread_tbl Thread table + * @param num Number of threads to create + * + */ +void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/helper/platform/linux-generic/thread.c b/helper/linux/thread.c similarity index 70% rename from helper/platform/linux-generic/thread.c rename to helper/linux/thread.c index 90fa42a..52d4efc 100644 --- a/helper/platform/linux-generic/thread.c +++ b/helper/linux/thread.c @@ -20,7 +20,8 @@ #include <stdbool.h>
#include <odp_api.h> -#include <odp/helper/platform/linux-generic/threads_extn.h> +#include <odp/helper/linux/pthread.h> +#include <odp/helper/linux/process.h> #include "odph_debug.h"
static void *_odph_run_start_routine(void *arg) @@ -42,45 +43,6 @@ static void *_odph_run_start_routine(void *arg) return ret_ptr; }
-static void *_odph_thread_run_start_routine(void *arg) -{ - int status; - int ret; - odph_odpthread_params_t *thr_params; - - odph_odpthread_start_args_t *start_args = arg; - - thr_params = &start_args->thr_params; - - /* ODP thread local init */ - if (odp_init_local(thr_params->instance, thr_params->thr_type)) { - ODPH_ERR("Local init failed\n"); - if (start_args->linuxtype == ODPTHREAD_PROCESS) - _exit(EXIT_FAILURE); - return (void *)-1; - } - - ODPH_DBG("helper: ODP %s thread started as linux %s. (pid=%d)\n", - thr_params->thr_type == ODP_THREAD_WORKER ? - "worker" : "control", - (start_args->linuxtype == ODPTHREAD_PTHREAD) ? - "pthread" : "process", - (int)getpid()); - - status = thr_params->start(thr_params->arg); - ret = odp_term_local(); - - if (ret < 0) - ODPH_ERR("Local term failed\n"); - - /* for process implementation of odp threads, just return status... */ - if (start_args->linuxtype == ODPTHREAD_PROCESS) - _exit(status); - - /* threads implementation return void* pointers: cast status to that. */ - return (void *)(intptr_t)status; -} - int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl, const odp_cpumask_t *mask, const odph_linux_thr_params_t *thr_params) @@ -275,39 +237,3 @@ int odph_linux_process_wait_n(odph_linux_process_t *proc_tbl, int num)
return 0; } - -/* - * Create a single ODPthread as a linux thread - */ -static int odph_linux_thread_create(odph_odpthread_t *thread_tbl, - int cpu, - const odph_odpthread_params_t *thr_params) -{ - int ret; - cpu_set_t cpu_set; - - CPU_ZERO(&cpu_set); - CPU_SET(cpu, &cpu_set); - - pthread_attr_init(&thread_tbl->thread.attr); - - thread_tbl->cpu = cpu; - - pthread_attr_setaffinity_np(&thread_tbl->thread.attr, - sizeof(cpu_set_t), &cpu_set); - - thread_tbl->start_args.thr_params = *thr_params; /* copy */ - thread_tbl->start_args.linuxtype = ODPTHREAD_PTHREAD; - - ret = pthread_create(&thread_tbl->thread.thread_id, - &thread_tbl->thread.attr, - _odph_thread_run_start_routine, - &thread_tbl->start_args); - if (ret != 0) { - ODPH_ERR("Failed to start thread on cpu #%d\n", cpu); - thread_tbl->start_args.linuxtype = ODPTHREAD_NOT_STARTED; - return ret; - } - - return 0; -} diff --git a/helper/m4/configure.m4 b/helper/m4/configure.m4 index 38c95d9..343f5e3 100644 --- a/helper/m4/configure.m4 +++ b/helper/m4/configure.m4 @@ -12,11 +12,11 @@ AC_ARG_ENABLE([test-helper], # Enable/disable helper-ext # platform specific non portable extensions ########################################################################## -helper_extn=no -AC_ARG_ENABLE([helper-extn], - [ --enable-helper-extn build helper platform extensions (not portable)], +helper_linux=no +AC_ARG_ENABLE([helper-linux], + [ --enable-helper-linux build helper platform extensions (not portable)], [if test "x$enableval" = "xyes"; then - helper_extn=yes + helper_linux=yes fi])
AC_CONFIG_FILES([helper/Makefile diff --git a/helper/test/.gitignore b/helper/test/.gitignore index e5b6a0f..1a81e00 100644 --- a/helper/test/.gitignore +++ b/helper/test/.gitignore @@ -8,3 +8,4 @@ parse process table thread +pthread diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am index 1337657..beef919 100644 --- a/helper/test/Makefile.am +++ b/helper/test/Makefile.am @@ -5,12 +5,11 @@ LIB = $(top_builddir)/lib #in the following line, the libs using the symbols should come before #the libs containing them! The includer is given a chance to add things #before libodp by setting PRE_LDADD before the inclusion. -LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la +LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp-linux.la
INCFLAGS = \ -I$(top_builddir)/platform/@with_platform@/include \ -I$(top_srcdir)/helper/include \ - -I$(top_srcdir)/helper/platform/@with_helper_platform@/include \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \ -I$(top_srcdir)/platform/@with_platform@/include \ @@ -32,9 +31,9 @@ EXECUTABLES = chksum$(EXEEXT) \ #They are a convenience to app writers who have chosen to #restrict their application to Linux.
-if helper_extn -EXECUTABLES += @with_helper_platform@/thread$(EXEEXT) \ - @with_helper_platform@/process$(EXEEXT) +if helper_linux +EXECUTABLES += linux/pthread$(EXEEXT) \ + linux/process$(EXEEXT) endif
COMPILE_ONLY = odpthreads diff --git a/helper/test/linux-generic/Makefile.am b/helper/test/linux-generic/Makefile.am deleted file mode 100644 index 28d54a8..0000000 --- a/helper/test/linux-generic/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ - -thread_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la -dist_thread_SOURCES = thread.c -dist_process_SOURCES = process.c -process_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la diff --git a/helper/test/linux/Makefile.am b/helper/test/linux/Makefile.am new file mode 100644 index 0000000..f95e04d --- /dev/null +++ b/helper/test/linux/Makefile.am @@ -0,0 +1,5 @@ + +thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp-linux.la +dist_thread_SOURCES = pthread.c +dist_process_SOURCES = process.c +process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp-linux.la diff --git a/helper/test/linux-generic/process.c b/helper/test/linux/process.c similarity index 96% rename from helper/test/linux-generic/process.c rename to helper/test/linux/process.c index f9bdc3e..e08ef86 100644 --- a/helper/test/linux-generic/process.c +++ b/helper/test/linux/process.c @@ -6,7 +6,8 @@
#include <odph_debug.h> #include <odp_api.h> -#include <odp/helper/platform/linux-generic/threads_extn.h> +#include <odp/helper/linux/pthread.h> +#include <odp/helper/linux/process.h>
#define NUMBER_WORKERS 16 /* 0 = max */
diff --git a/helper/test/linux-generic/thread.c b/helper/test/linux/pthread.c similarity index 97% rename from helper/test/linux-generic/thread.c rename to helper/test/linux/pthread.c index 919f00e..2bec0d1 100644 --- a/helper/test/linux-generic/thread.c +++ b/helper/test/linux/pthread.c @@ -6,7 +6,7 @@
#include <odph_debug.h> #include <odp_api.h> -#include <odp/helper/platform/linux-generic/threads_extn.h> +#include <odp/helper/linux/pthread.h>
#define NUMBER_WORKERS 16 static void *worker_fn(void *arg ODPH_UNUSED) diff --git a/test/Makefile.inc b/test/Makefile.inc index 898249d..1ef2a92 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -4,7 +4,7 @@ LIB = $(top_builddir)/lib #in the following line, the libs using the symbols should come before #the libs containing them! The includer is given a chance to add things #before libodp by setting PRE_LDADD before the inclusion. -LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la +LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp-linux.la
INCFLAGS = \ -I$(top_builddir)/platform/@with_platform@/include \ diff --git a/test/common_plat/validation/api/Makefile.inc b/test/common_plat/validation/api/Makefile.inc index a0afd26..dda18ad 100644 --- a/test/common_plat/validation/api/Makefile.inc +++ b/test/common_plat/validation/api/Makefile.inc @@ -13,4 +13,4 @@ AM_LDFLAGS += -static LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la -LIBODP = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la +LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp-linux.la diff --git a/test/linux-generic/Makefile.inc b/test/linux-generic/Makefile.inc index 373157b..198087f 100644 --- a/test/linux-generic/Makefile.inc +++ b/test/linux-generic/Makefile.inc @@ -6,7 +6,7 @@ AM_LDFLAGS += -static
LIBCUNIT_COMMON = $(top_builddir)/test/common_plat/common/libcunit_common.la LIB = $(top_builddir)/lib -LIBODP = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la +LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp-linux.la
INCCUNIT_COMMON = -I$(top_srcdir)/test/common_plat/common INCODP = \
-----------------------------------------------------------------------
Summary of changes: configure.ac | 17 +---- example/Makefile.inc | 2 +- helper/Makefile.am | 18 ++--- .../threads_extn.h => linux/process.h} | 44 +++--------- helper/include/odp/helper/linux/pthread.h | 66 ++++++++++++++++++ helper/{platform/linux-generic => linux}/thread.c | 78 +--------------------- helper/m4/configure.m4 | 8 +-- helper/test/.gitignore | 1 + helper/test/Makefile.am | 9 ++- helper/test/linux-generic/Makefile.am | 5 -- helper/test/linux/Makefile.am | 5 ++ helper/test/{linux-generic => linux}/process.c | 3 +- .../{linux-generic/thread.c => linux/pthread.c} | 2 +- test/Makefile.inc | 2 +- test/common_plat/validation/api/Makefile.inc | 2 +- test/linux-generic/Makefile.inc | 2 +- 16 files changed, 109 insertions(+), 155 deletions(-) rename helper/include/odp/helper/{platform/linux-generic/threads_extn.h => linux/process.h} (59%) create mode 100644 helper/include/odp/helper/linux/pthread.h rename helper/{platform/linux-generic => linux}/thread.c (70%) delete mode 100644 helper/test/linux-generic/Makefile.am create mode 100644 helper/test/linux/Makefile.am rename helper/test/{linux-generic => linux}/process.c (96%) rename helper/test/{linux-generic/thread.c => linux/pthread.c} (97%)
hooks/post-receive