Reviewed-by: Petri Savolainen <[email protected]>
> -----Original Message----- > From: lng-odp [mailto:[email protected]] On Behalf Of EXT > Bill Fischofer > Sent: Thursday, March 31, 2016 4:08 PM > To: [email protected] > Subject: [lng-odp] [API-NEXT PATCHv7 4/5] api: init: add control/worker > cpumasks to init data > > From: "Gary S. Robertson" <[email protected]> > > 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 <[email protected]> > Signed-off-by: Bill Fischofer <[email protected]> > --- > include/odp/api/spec/init.h | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h > index 47ebd54..8560663 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. > @@ -123,6 +124,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; > + /** Pointer to bit mask mapping CPUs available to this ODP instance > + for running worker threads. > + Initialize to a NULL pointer to use default CPU mapping. > + When the mask is defined, odp_cpumask_default_worker() > + uses it instead of returning a default mask. > + Applications code should not access this cpumask directly. > + Valid range of CPUs and optimal CPU selection > + are platform specific, but generally it is recommended that: > + * worker CPUs are dedicated to run only ODP worker threads > + (one thread per CPU) > + * worker and control masks do not overlap > + * different ODP instances do not specify overlapping > + worker masks > + */ > + const odp_cpumask_t *worker_cpus; > + /** Pointer to bit mask mapping CPUs available to this ODP instance > + for running control threads. > + Initialize to a NULL pointer to use default CPU mapping. > + When the mask is defined, odp_cpumask_default_control() > + uses it instead of returning a default mask. > + Applications code should not access this cpumask directly. > + Valid range of CPUs and optimal CPU selection > + are platform specific, but generally it is recommended that > + worker and control masks do not overlap. > + */ > + const odp_cpumask_t *control_cpus; > /** Replacement for the default log fn */ > odp_log_func_t log_fn; > /** Replacement for the default abort fn */ > -- > 2.5.0 > > _______________________________________________ > lng-odp mailing list > [email protected] > https://lists.linaro.org/mailman/listinfo/lng-odp _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
