Message ID | 1418828448-1327-1-git-send-email-taras.kondratiuk@linaro.org |
---|---|
State | New |
Headers | show |
This patch doesn't apply to the current tip. Bill On Wed, Dec 17, 2014 at 9:00 AM, Taras Kondratiuk < taras.kondratiuk@linaro.org> wrote: > > Buffer pool terminate throws an error in case of any pool still exist > at ODP global termination stage. > > Based on "api: init: add a way to determine a last ODP thread termination" > patch. > > Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> > --- > platform/linux-generic/include/odp_internal.h | 2 ++ > platform/linux-generic/odp_buffer_pool.c | 37 > +++++++++++++++++++++++++-- > platform/linux-generic/odp_init.c | 10 +++++++- > platform/linux-generic/odp_linux.c | 1 - > 4 files changed, 46 insertions(+), 4 deletions(-) > > diff --git a/platform/linux-generic/include/odp_internal.h > b/platform/linux-generic/include/odp_internal.h > index 549d406..4fc8a5e 100644 > --- a/platform/linux-generic/include/odp_internal.h > +++ b/platform/linux-generic/include/odp_internal.h > @@ -29,6 +29,8 @@ int odp_shm_init_global(void); > int odp_shm_init_local(void); > > int odp_buffer_pool_init_global(void); > +int odp_buffer_pool_term_global(void); > +int odp_buffer_pool_term_local(void); > > int odp_pktio_init_global(void); > int odp_pktio_init_local(void); > diff --git a/platform/linux-generic/odp_buffer_pool.c > b/platform/linux-generic/odp_buffer_pool.c > index e947dde..c19e980 100644 > --- a/platform/linux-generic/odp_buffer_pool.c > +++ b/platform/linux-generic/odp_buffer_pool.c > @@ -52,6 +52,7 @@ typedef struct pool_table_t { > > /* The pool table */ > static pool_table_t *pool_tbl; > +static const char shm_name[] = "odp_buffer_pools"; > > /* Pool entry pointers (for inlining) */ > void *pool_entry_ptr[ODP_CONFIG_BUFFER_POOLS]; > @@ -64,7 +65,7 @@ int odp_buffer_pool_init_global(void) > uint32_t i; > odp_shm_t shm; > > - shm = odp_shm_reserve("odp_buffer_pools", > + shm = odp_shm_reserve(shm_name, > sizeof(pool_table_t), > sizeof(pool_entry_t), 0); > > @@ -92,10 +93,42 @@ int odp_buffer_pool_init_global(void) > return 0; > } > > +int odp_buffer_pool_term_global(void) > +{ > + odp_shm_t shm; > + int i; > + pool_entry_t *pool; > + int ret = 0; > + > + for (i = 0; i < ODP_CONFIG_BUFFER_POOLS; i++) { > + pool = get_pool_entry(i); > + > + POOL_LOCK(&pool->s.lock); > + if (pool->s.pool_shm != ODP_SHM_INVALID) { > + ODP_ERR("Not destroyed pool: %s\n", pool->s.name); > + ret = -1; > + } > + POOL_UNLOCK(&pool->s.lock); > + } > + if (ret) > + return ret; > + > + shm = odp_shm_lookup(shm_name); > + if (shm == ODP_SHM_INVALID) > + return -1; > + ret = odp_shm_free(shm); > + > + return ret; > +} > + > +int odp_buffer_pool_term_local(void) > +{ > + _odp_flush_caches(); > + return 0; > +} > /** > * Buffer pool creation > */ > - > odp_buffer_pool_t odp_buffer_pool_create(const char *name, > odp_shm_t shm, > odp_buffer_pool_param_t *params) > diff --git a/platform/linux-generic/odp_init.c > b/platform/linux-generic/odp_init.c > index 6c2fc8c..193cc52 100644 > --- a/platform/linux-generic/odp_init.c > +++ b/platform/linux-generic/odp_init.c > @@ -64,7 +64,10 @@ int odp_init_global(odp_init_t *params ODP_UNUSED, > > int odp_term_global(void) > { > - ODP_UNIMPLEMENTED(); > + if (odp_buffer_pool_term_global()) { > + ODP_ERR("ODP buffer pool term failed.\n"); > + return -1; > + } > return 0; > } > > @@ -90,6 +93,11 @@ int odp_init_local(void) > > int odp_term_local(void) > { > + if (odp_buffer_pool_term_local()) { > + ODP_ERR("ODP buffer pool local term failed.\n"); > + return -1; > + } > + > if (odp_thread_term_local() == 0) > return 1; > > diff --git a/platform/linux-generic/odp_linux.c > b/platform/linux-generic/odp_linux.c > index 229d24e..92b8d53 100644 > --- a/platform/linux-generic/odp_linux.c > +++ b/platform/linux-generic/odp_linux.c > @@ -44,7 +44,6 @@ static void *odp_run_start_routine(void *arg) > } > > void *ret_ptr = start_args->start_routine(start_args->arg); > - _odp_flush_caches(); > int ret = odp_term_local(); > if (ret < 0) > ODP_ERR("Local term failed\n"); > -- > 1.9.1 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
On 12/18/2014 04:43 AM, Bill Fischofer wrote: > This patch doesn't apply to the current tip. Yes. As noted in the commit message it is based on another patch in ML. > > Bill > > On Wed, Dec 17, 2014 at 9:00 AM, Taras Kondratiuk > <taras.kondratiuk@linaro.org <mailto:taras.kondratiuk@linaro.org>> wrote: > > Buffer pool terminate throws an error in case of any pool still exist > at ODP global termination stage. > > Based on "api: init: add a way to determine a last ODP thread > termination" > patch. > > Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org > <mailto:taras.kondratiuk@linaro.org>>
Ok, I hadn't noticed that. As an aside, is there a standard for specifying pre-reqs / co-reqs for patches? With so many patches "in flight" it can be confusing to know what all the dependency chains are. On Thu, Dec 18, 2014 at 3:22 AM, Taras Kondratiuk < taras.kondratiuk@linaro.org> wrote: > > On 12/18/2014 04:43 AM, Bill Fischofer wrote: > >> This patch doesn't apply to the current tip. >> > > Yes. As noted in the commit message it is based on another patch in ML. > > >> Bill >> >> On Wed, Dec 17, 2014 at 9:00 AM, Taras Kondratiuk >> <taras.kondratiuk@linaro.org <mailto:taras.kondratiuk@linaro.org>> wrote: >> >> Buffer pool terminate throws an error in case of any pool still exist >> at ODP global termination stage. >> >> Based on "api: init: add a way to determine a last ODP thread >> termination" >> patch. >> >> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org >> <mailto:taras.kondratiuk@linaro.org>> >> > >
On 12/18/2014 01:31 PM, Bill Fischofer wrote: > Ok, I hadn't noticed that. As an aside, is there a standard for > specifying pre-reqs / co-reqs for patches? With so many patches "in > flight" it can be confusing to know what all the dependency chains are. Usually dependency or other important notes that should not be a part of git history are specified: 1. In a cover letter if a series has it. 2. Under '---' in case of a single patch. 3. Directly in a commit message if it is RFC patch.
I was thinking of something that git itself (or one of its support tools) might understand, but thanks. On Thu, Dec 18, 2014 at 5:40 AM, Taras Kondratiuk < taras.kondratiuk@linaro.org> wrote: > > On 12/18/2014 01:31 PM, Bill Fischofer wrote: > >> Ok, I hadn't noticed that. As an aside, is there a standard for >> specifying pre-reqs / co-reqs for patches? With so many patches "in >> flight" it can be confusing to know what all the dependency chains are. >> > > Usually dependency or other important notes that should not be a part > of git history are specified: > > 1. In a cover letter if a series has it. > 2. Under '---' in case of a single patch. > 3. Directly in a commit message if it is RFC patch. >
On 12/18/2014 01:52 PM, Bill Fischofer wrote: > I was thinking of something that git itself (or one of its support > tools) might understand, but thanks. Gerrit handles dependencies nicely, but we are not using it.
diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 549d406..4fc8a5e 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -29,6 +29,8 @@ int odp_shm_init_global(void); int odp_shm_init_local(void); int odp_buffer_pool_init_global(void); +int odp_buffer_pool_term_global(void); +int odp_buffer_pool_term_local(void); int odp_pktio_init_global(void); int odp_pktio_init_local(void); diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index e947dde..c19e980 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -52,6 +52,7 @@ typedef struct pool_table_t { /* The pool table */ static pool_table_t *pool_tbl; +static const char shm_name[] = "odp_buffer_pools"; /* Pool entry pointers (for inlining) */ void *pool_entry_ptr[ODP_CONFIG_BUFFER_POOLS]; @@ -64,7 +65,7 @@ int odp_buffer_pool_init_global(void) uint32_t i; odp_shm_t shm; - shm = odp_shm_reserve("odp_buffer_pools", + shm = odp_shm_reserve(shm_name, sizeof(pool_table_t), sizeof(pool_entry_t), 0); @@ -92,10 +93,42 @@ int odp_buffer_pool_init_global(void) return 0; } +int odp_buffer_pool_term_global(void) +{ + odp_shm_t shm; + int i; + pool_entry_t *pool; + int ret = 0; + + for (i = 0; i < ODP_CONFIG_BUFFER_POOLS; i++) { + pool = get_pool_entry(i); + + POOL_LOCK(&pool->s.lock); + if (pool->s.pool_shm != ODP_SHM_INVALID) { + ODP_ERR("Not destroyed pool: %s\n", pool->s.name); + ret = -1; + } + POOL_UNLOCK(&pool->s.lock); + } + if (ret) + return ret; + + shm = odp_shm_lookup(shm_name); + if (shm == ODP_SHM_INVALID) + return -1; + ret = odp_shm_free(shm); + + return ret; +} + +int odp_buffer_pool_term_local(void) +{ + _odp_flush_caches(); + return 0; +} /** * Buffer pool creation */ - odp_buffer_pool_t odp_buffer_pool_create(const char *name, odp_shm_t shm, odp_buffer_pool_param_t *params) diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 6c2fc8c..193cc52 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -64,7 +64,10 @@ int odp_init_global(odp_init_t *params ODP_UNUSED, int odp_term_global(void) { - ODP_UNIMPLEMENTED(); + if (odp_buffer_pool_term_global()) { + ODP_ERR("ODP buffer pool term failed.\n"); + return -1; + } return 0; } @@ -90,6 +93,11 @@ int odp_init_local(void) int odp_term_local(void) { + if (odp_buffer_pool_term_local()) { + ODP_ERR("ODP buffer pool local term failed.\n"); + return -1; + } + if (odp_thread_term_local() == 0) return 1; diff --git a/platform/linux-generic/odp_linux.c b/platform/linux-generic/odp_linux.c index 229d24e..92b8d53 100644 --- a/platform/linux-generic/odp_linux.c +++ b/platform/linux-generic/odp_linux.c @@ -44,7 +44,6 @@ static void *odp_run_start_routine(void *arg) } void *ret_ptr = start_args->start_routine(start_args->arg); - _odp_flush_caches(); int ret = odp_term_local(); if (ret < 0) ODP_ERR("Local term failed\n");
Buffer pool terminate throws an error in case of any pool still exist at ODP global termination stage. Based on "api: init: add a way to determine a last ODP thread termination" patch. Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> --- platform/linux-generic/include/odp_internal.h | 2 ++ platform/linux-generic/odp_buffer_pool.c | 37 +++++++++++++++++++++++++-- platform/linux-generic/odp_init.c | 10 +++++++- platform/linux-generic/odp_linux.c | 1 - 4 files changed, 46 insertions(+), 4 deletions(-)