diff mbox

[API-NEXT,3/4] ODP API: add control/worker cpumasks to init data

Message ID 1456354201-31304-4-git-send-email-gary.robertson@linaro.org
State New
Headers show

Commit Message

gary.robertson@linaro.org Feb. 24, 2016, 10:50 p.m. UTC
Adds pointers to externally supplied cpumasks for
control and worker CPUs to the ODP global init data
which is passed as an argument to odp_init_global.
The intent is to allow an external entity to pass in
lists of the CPU resources available to the current
ODP application.

It is assumed that these pointers would be NULL
unless explicitly populated prior to calling
odp_init_global.

odp_init_global would respond to NULL pointers
here by ensuring that odp_cpumask_default_control and
odp_cpumask_default_worker would return the
platform-specific default CPU configurations.

If these pointers were not NULL when odp_init_global was called,
then the above functions would return cpumasks reflecting the
(possibly amended) contents of the referenced cpumasks
instead of the platform defaults.

Signed-off-by: Gary S. Robertson <gary.robertson@linaro.org>
---
 include/odp/api/spec/init.h | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
diff mbox

Patch

diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h
index 2c98109..c369d7f 100644
--- a/include/odp/api/spec/init.h
+++ b/include/odp/api/spec/init.h
@@ -31,6 +31,7 @@  extern "C" {
 #include <odp/api/std_types.h>
 #include <odp/api/hints.h>
 #include <odp/api/thread.h>
+#include <odp/api/cpumask.h>
 
 /** @defgroup odp_initialization ODP INITIALIZATION
  *  Initialisation operations.
@@ -118,6 +119,44 @@  typedef struct odp_init_t {
 	    Valid range is from 0 to platform specific maximum. Set both
 	    num_worker and num_control to zero for default number of threads. */
 	int num_control;
+	/** Pointer to bit mask mapping CPUs available to this ODP instance
+	    for running worker threads.
+	    Valid range for mask is from 0 to platform specific maximum CPU.
+	    Initialize to a NULL pointer to use default cpu mapping and
+	    default isolation setup (or the lack of isolation) for
+	    worker CPUs.
+	    Validation of the contents of this cpumask is implementation
+	    and installation dependent and outside the scope of ODP definition.
+	    If worker CPUs are expected to provide isolated runtime
+	    environments for worker threads, then the contents of this cpumask
+	    should be unique for each ODP instance running concurrently
+	    on the underlying platform, and should not contain any
+	    control CPUs.
+	    This cpumask is used only to convey externally supplied
+	    information regarding worker CPU resources available to this
+	    ODP instance during initialization.  Applications code must call
+	    odp_cpumask_default_worker() to obtain information as to the
+	    CPU resources available for worker threads. */
+	odp_cpumask_t *worker_cpus;
+	/** Pointer to bit mask mapping CPUs available to this ODP instance
+	    for running control threads.
+	    Valid range for mask is from 0 to platform specific maximum CPU.
+	    Initialize to a NULL pointer to use default cpu mapping for
+	    control CPUs.
+	    Validation of the contents of this cpumask is implementation
+	    and installation dependent and outside the scope of ODP definition.
+	    Control CPUs are expected to provide shared, non-isolated
+	    runtime environments for control threads.
+	    It must therefore be anticipated that this cpumask may be
+	    identical for all ODP instances running concurrently
+	    on the underlying platform and may specify CPU resources
+	    to be shared among all concurrent ODP instances.
+	    This cpumask is used only to convey externally supplied
+	    information regarding control CPU resources available to this
+	    ODP instance during initialization.  Applications code must call
+	    odp_cpumask_default_control() to obtain information as to the
+	    CPU resources available for control threads. */
+	odp_cpumask_t *control_cpus;
 	/** Replacement for the default log fn */
 	odp_log_func_t log_fn;
 	/** Replacement for the default abort fn */