Message ID | 1424723769-8762-8-git-send-email-robking@cisco.com |
---|---|
State | New |
Headers | show |
On 02/23/2015 11:36 PM, Robbie King wrote: > From: Yan Sonming <yan.songming@linaro.org> > > Signed-off-by: Yan Songming <yan.songming@linaro.org> > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > Signed-off-by: Robbie King <robking@cisco.com> > --- > platform/linux-generic/include/odp_internal.h | 1 + > platform/linux-generic/odp_init.c | 5 +++++ > platform/linux-generic/odp_thread.c | 11 +++++++++++ > 3 files changed, 17 insertions(+) > > diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h > index c82012d..dad844f 100644 > --- a/platform/linux-generic/include/odp_internal.h > +++ b/platform/linux-generic/include/odp_internal.h > @@ -34,6 +34,7 @@ int odp_system_info_init(void); > int odp_thread_init_global(void); > int odp_thread_init_local(void); > int odp_thread_term_local(void); > +int odp_thread_term_global(void); > > int odp_shm_init_global(void); > int odp_shm_init_local(void); > diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c > index 82735b0..cdc4565 100644 > --- a/platform/linux-generic/odp_init.c > +++ b/platform/linux-generic/odp_init.c > @@ -108,6 +108,11 @@ int odp_term_global(void) > rc = -1; > } > > + if (odp_thread_term_global()) { > + ODP_ERR("ODP thread term failed.\n"); > + rc = -1; > + } > + > return rc; > } > > diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c > index f6c900b..ead440b 100644 > --- a/platform/linux-generic/odp_thread.c > +++ b/platform/linux-generic/odp_thread.c > @@ -65,6 +65,17 @@ int odp_thread_init_global(void) > return 0; > } > > +int odp_thread_term_global(void) > +{ > + int ret = 0; 0 is not needed. > + > + ret = odp_shm_free(odp_shm_lookup("odp_thread_globals")); > + if (ret < 0) > + ODP_ERR("shm free failed for odp_thread_globals"); > + memset(thread_globals, 0, sizeof(thread_globals_t)); is missing here. Maxim. > + return ret; > +} > + > > static int thread_id(void) > {
On 02/24/2015 06:03 PM, Robbie King (robking) wrote: > Hey Maxim, are you saying we should be setting this memory to zero > immediately before we free it? To my knowledge we're not doing > that any where else. Ah, no no need to do this. Skip that comment. Maxim. >> + >> + ret = odp_shm_free(odp_shm_lookup("odp_thread_globals")); >> + if (ret < 0) >> + ODP_ERR("shm free failed for odp_thread_globals"); >> + > memset(thread_globals, 0, sizeof(thread_globals_t)); > is missing here. > > Maxim. >> + return ret; >> +} >> + >> >> static int thread_id(void) >> { > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp
On 02/24/2015 06:18 PM, Robbie King (robking) wrote: > OK, cool. I removed the unnecessary set to zero. I always forget that we allocate memory for internal data structures with odp_shm_reserve(), which probably is not best way to go. For buffers pools it's ok but for different tables simple malloc() might be better because of platform implementation will not try to allocate memory from dma accessed memory. Maxim. > -----Original Message----- > From: Maxim Uvarov [mailto:maxim.uvarov@linaro.org] > Sent: Tuesday, February 24, 2015 10:16 AM > To: Robbie King (robking); lng-odp@lists.linaro.org > Subject: Re: [lng-odp] [PATCHv3 07/10] linux-generic: thread: add term_global > > On 02/24/2015 06:03 PM, Robbie King (robking) wrote: >> Hey Maxim, are you saying we should be setting this memory to zero >> immediately before we free it? To my knowledge we're not doing >> that any where else. > Ah, no no need to do this. Skip that comment. > > Maxim. > >>> + >>> + ret = odp_shm_free(odp_shm_lookup("odp_thread_globals")); >>> + if (ret < 0) >>> + ODP_ERR("shm free failed for odp_thread_globals"); >>> + >> memset(thread_globals, 0, sizeof(thread_globals_t)); >> is missing here. >> >> Maxim. >>> + return ret; >>> +} >>> + >>> >>> static int thread_id(void) >>> { >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> http://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index c82012d..dad844f 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -34,6 +34,7 @@ int odp_system_info_init(void); int odp_thread_init_global(void); int odp_thread_init_local(void); int odp_thread_term_local(void); +int odp_thread_term_global(void); int odp_shm_init_global(void); int odp_shm_init_local(void); diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 82735b0..cdc4565 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -108,6 +108,11 @@ int odp_term_global(void) rc = -1; } + if (odp_thread_term_global()) { + ODP_ERR("ODP thread term failed.\n"); + rc = -1; + } + return rc; } diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c index f6c900b..ead440b 100644 --- a/platform/linux-generic/odp_thread.c +++ b/platform/linux-generic/odp_thread.c @@ -65,6 +65,17 @@ int odp_thread_init_global(void) return 0; } +int odp_thread_term_global(void) +{ + int ret = 0; + + ret = odp_shm_free(odp_shm_lookup("odp_thread_globals")); + if (ret < 0) + ODP_ERR("shm free failed for odp_thread_globals"); + + return ret; +} + static int thread_id(void) {