diff mbox

[API_NEXT,RFC,01/01] ODP API: add control/worker cpumasks to init data

Message ID 1452715239-15255-2-git-send-email-gary.robertson@linaro.org
State New
Headers show

Commit Message

gary.robertson@linaro.org Jan. 13, 2016, 8 p.m. UTC
Adds cpumasks for control and worker cores 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 masks would by default be initialized to zeros
and would thus be empty unless explicitly populated prior to calling
odp_init_global.  odp_init_global would respond to empty cpumasks here
by ensuring that odp_cpumask_default_control and
odp_cpumask_default_worker would return the platform-specific default
CPU configurations... but
if the initial cpumasks were not empty when odp_init_global was called,
then the above functions would return cpumasks reflecting the
(possibly amended) contents of the initially specified cpumasks
instead of the platform defaults.

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

Patch

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index e667d25..324081b 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -31,6 +31,7 @@  extern "C" {
 #include <odp/std_types.h>
 #include <odp/hints.h>
 #include <odp/thread.h>
+#include <odp/cpumask.h>
 
 /** @defgroup odp_initialization ODP INITIALIZATION
  *  Initialisation operations.
@@ -118,6 +119,32 @@  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;
+	/** Mask mapping CPUs available to this ODP instance for running
+	    worker threads.
+	    Valid range is from 0 to platform specific maximum CPU.
+	    Initialize to an empty set to use default cpu mapping and
+	    default isolation setup (or the lack of isolation) for
+	    worker CPUs.
+	    Explicit population of this cpumask implies that the platform
+	    implementation should (optionally) provide isolation support
+	    for the CPUs designated by that population, to whatever extent
+	    such isolation is supportable on the platform.
+	    Any CPU isolation support provided by the underlying platform
+	    implementation will be disabled if a range is specified
+	    which overlaps the control CPU map. */
+	odp_cpumask_t worker_cpus;
+	/** Mask mapping CPUs available to this ODP instance for running
+	    control threads.
+	    Valid range is from 0 to platform specific maximum CPU.
+	    Initialize to an empty set to use default cpu mapping for
+	    control CPUs.
+	    Control CPUs are expected to provide shared, non-isolated
+	    runtime environments for control threads.
+	    It is therefore expected that - if this cpumask is explicitly
+	    populated - this cpumask will be identical for all ODP instances
+	    running concurrently on the underlying platform and will specify
+	    CPU resources to be shared among all concurrent ODP instances. */
+	odp_cpumask_t control_cpus;
 	/** Replacement for the default log fn */
 	odp_log_func_t log_fn;
 	/** Replacement for the default abort fn */