From f36139ea56706df2534a269039b3effca7169234 Mon Sep 17 00:00:00 2001 From: Matias Elo Date: Fri, 12 Oct 2018 11:08:34 +0300 Subject: api: init: add new mem_model member to odp_init_t Add new odp_mem_model_t enum for configuring application memory model. This enables an application to operate in process mode without the need to modify ODP configuration file. Signed-off-by: Matias Elo Reviewed-by: Bill Fischofer Reviewed-by: Petri Savolainen Signed-off-by: Maxim Uvarov --- include/odp/api/spec/init.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h index ee33e7cd4..c37af464d 100644 --- a/include/odp/api/spec/init.h +++ b/include/odp/api/spec/init.h @@ -106,6 +106,32 @@ typedef int (*odp_log_func_t)(odp_log_level_t level, const char *fmt, ...); /** Replaceable abort function */ typedef void (*odp_abort_func_t)(void) ODP_NORETURN; +/** + * Application memory model + */ +typedef enum { + /** Thread memory model: by default all memory is shareable between + * threads. + * + * Within a single ODP instance all ODP handles and pointers to ODP + * allocated data may be shared amongst threads independent of data + * allocation time (e.g. before or after thread creation). */ + ODP_MEM_MODEL_THREAD = 0, + + /** Process memory model: by default all memory is not shareable between + * processes. + * + * Within a single ODP instance all ODP handles and pointers to ODP + * allocated data (excluding non-single VA SHM blocks) may be shared + * amongst processes independent of data allocation time (e.g. before + * or after fork). + * + * @see ODP_SHM_SINGLE_VA + */ + ODP_MEM_MODEL_PROCESS + +} odp_mem_model_t; + /** * Global initialization parameters * @@ -172,6 +198,12 @@ typedef struct odp_init_t { */ odp_feature_t not_used; + /** Application memory model. The main application thread has to call + * odp_init_global() and odp_init_local() before creating threads that + * share ODP data. The default value is ODP_MEM_MODEL_THREAD. + */ + odp_mem_model_t mem_model; + /** Shared memory parameters */ struct { /** Maximum memory usage in bytes. This is the maximum -- cgit v1.2.3