This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, next has been updated
via f53fda91d2919eee33b5a177ef818be1092c890b (commit)
via 46e088c2f56d1463a598b4ac23308e19bf2b9031 (commit)
from 0b1dc8a9a69252ce56d13521284683faff0e3e35 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f53fda91d2919eee33b5a177ef818be1092c890b
Author: Christophe Milard <christophe.milard(a)linaro.org>
Date: Mon Jan 2 10:41:42 2017 +0100
linux-gen: init: avoiding segfault if cleaning files
The call the the cleanup_files() function (which cleans up possible
remaining file(s) from a defunc OPD with same pid) may use ODP_DBG and
ODP_ERR functions, but is (before this patch) placed before these ODP_*
functions are initialized.
This would surely sigfault.
The call the the cleanup_files() function is hence placed after ODP_DBG and
ODP_ERR function initialization to avoid this situation.
Signed-off-by: Christophe Milard <christophe.milard(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index 1b0d8f8..06c6143 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -73,7 +73,6 @@ int odp_init_global(odp_instance_t *instance,
memset(&odp_global_data, 0, sizeof(struct odp_global_data_s));
odp_global_data.main_pid = getpid();
- cleanup_files(_ODP_TMPDIR, odp_global_data.main_pid);
enum init_stage stage = NO_INIT;
odp_global_data.log_fn = odp_override_log;
@@ -86,6 +85,8 @@ int odp_init_global(odp_instance_t *instance,
odp_global_data.abort_fn = params->abort_fn;
}
+ cleanup_files(_ODP_TMPDIR, odp_global_data.main_pid);
+
if (odp_cpumask_init_global(params)) {
ODP_ERR("ODP cpumask init failed.\n");
goto init_failed;
commit 46e088c2f56d1463a598b4ac23308e19bf2b9031
Author: Bill Fischofer <bill.fischofer(a)linaro.org>
Date: Mon Jan 9 09:24:02 2017 -0600
linux-generic: crypto: add openssl locking support for thread safety
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2798 by adding
OpenSSL callbacks for locking that use ticketlocks to provide
thread-safety for OpenSSL calls made by ODP components such as random
number generation.
Signed-off-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Reviewed-by: Christophe Milard <christophe.milard(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 5808d16..4f17fd6 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -64,6 +64,7 @@ typedef struct odp_crypto_global_s odp_crypto_global_t;
struct odp_crypto_global_s {
odp_spinlock_t lock;
+ odp_ticketlock_t **openssl_lock;
odp_crypto_generic_session_t *free;
odp_crypto_generic_session_t sessions[0];
};
@@ -948,16 +949,35 @@ odp_crypto_operation(odp_crypto_op_param_t *param,
return 0;
}
+static unsigned long openssl_thread_id(void)
+{
+ return (unsigned long)odp_thread_id();
+}
+
+static void openssl_lock(int mode, int n,
+ const char *file ODP_UNUSED,
+ int line ODP_UNUSED)
+{
+ if (mode & CRYPTO_LOCK)
+ odp_ticketlock_lock((odp_ticketlock_t *)
+ &global->openssl_lock[n]);
+ else
+ odp_ticketlock_unlock((odp_ticketlock_t *)
+ &global->openssl_lock[n]);
+}
+
int
odp_crypto_init_global(void)
{
size_t mem_size;
odp_shm_t shm;
int idx;
+ int nlocks = CRYPTO_num_locks();
/* Calculate the memory size we need */
mem_size = sizeof(*global);
mem_size += (MAX_SESSIONS * sizeof(odp_crypto_generic_session_t));
+ mem_size += nlocks * sizeof(odp_ticketlock_t);
/* Allocate our globally shared memory */
shm = odp_shm_reserve("crypto_pool", mem_size,
@@ -975,6 +995,18 @@ odp_crypto_init_global(void)
}
odp_spinlock_init(&global->lock);
+ if (nlocks > 0) {
+ global->openssl_lock =
+ (odp_ticketlock_t **)&global->sessions[MAX_SESSIONS];
+
+ for (idx = 0; idx < nlocks; idx++)
+ odp_ticketlock_init((odp_ticketlock_t *)
+ &global->openssl_lock[idx]);
+
+ CRYPTO_set_id_callback(openssl_thread_id);
+ CRYPTO_set_locking_callback(openssl_lock);
+ }
+
return 0;
}
@@ -992,6 +1024,9 @@ int odp_crypto_term_global(void)
rc = -1;
}
+ CRYPTO_set_locking_callback(NULL);
+ CRYPTO_set_id_callback(NULL);
+
ret = odp_shm_free(odp_shm_lookup("crypto_pool"));
if (ret < 0) {
ODP_ERR("shm free failed for crypto_pool\n");
-----------------------------------------------------------------------
Summary of changes:
platform/linux-generic/odp_crypto.c | 35 +++++++++++++++++++++++++++++++++++
platform/linux-generic/odp_init.c | 3 ++-
2 files changed, 37 insertions(+), 1 deletion(-)
hooks/post-receive
--
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, api-next has been updated
via df97183dd71b214df6da679bbaf795a66bae4fdc (commit)
via b7da911ca3a7d3ed172f4e4010912ef920ddcf1f (commit)
from 9d65090ebcf45deb5677ffeb4aa2a26a96235dc5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit df97183dd71b214df6da679bbaf795a66bae4fdc
Author: Christophe Milard <christophe.milard(a)linaro.org>
Date: Mon Jan 2 10:41:42 2017 +0100
linux-gen: init: avoiding segfault if cleaning files
The call the the cleanup_files() function (which cleans up possible
remaining file(s) from a defunc OPD with same pid) may use ODP_DBG and
ODP_ERR functions, but is (before this patch) placed before these ODP_*
functions are initialized.
This would surely sigfault.
The call the the cleanup_files() function is hence placed after ODP_DBG and
ODP_ERR function initialization to avoid this situation.
Signed-off-by: Christophe Milard <christophe.milard(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index 1b0d8f8..06c6143 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -73,7 +73,6 @@ int odp_init_global(odp_instance_t *instance,
memset(&odp_global_data, 0, sizeof(struct odp_global_data_s));
odp_global_data.main_pid = getpid();
- cleanup_files(_ODP_TMPDIR, odp_global_data.main_pid);
enum init_stage stage = NO_INIT;
odp_global_data.log_fn = odp_override_log;
@@ -86,6 +85,8 @@ int odp_init_global(odp_instance_t *instance,
odp_global_data.abort_fn = params->abort_fn;
}
+ cleanup_files(_ODP_TMPDIR, odp_global_data.main_pid);
+
if (odp_cpumask_init_global(params)) {
ODP_ERR("ODP cpumask init failed.\n");
goto init_failed;
commit b7da911ca3a7d3ed172f4e4010912ef920ddcf1f
Author: Bill Fischofer <bill.fischofer(a)linaro.org>
Date: Mon Jan 9 09:24:02 2017 -0600
linux-generic: crypto: add openssl locking support for thread safety
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2798 by adding
OpenSSL callbacks for locking that use ticketlocks to provide
thread-safety for OpenSSL calls made by ODP components such as random
number generation.
Signed-off-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Reviewed-by: Christophe Milard <christophe.milard(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 5808d16..4f17fd6 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -64,6 +64,7 @@ typedef struct odp_crypto_global_s odp_crypto_global_t;
struct odp_crypto_global_s {
odp_spinlock_t lock;
+ odp_ticketlock_t **openssl_lock;
odp_crypto_generic_session_t *free;
odp_crypto_generic_session_t sessions[0];
};
@@ -948,16 +949,35 @@ odp_crypto_operation(odp_crypto_op_param_t *param,
return 0;
}
+static unsigned long openssl_thread_id(void)
+{
+ return (unsigned long)odp_thread_id();
+}
+
+static void openssl_lock(int mode, int n,
+ const char *file ODP_UNUSED,
+ int line ODP_UNUSED)
+{
+ if (mode & CRYPTO_LOCK)
+ odp_ticketlock_lock((odp_ticketlock_t *)
+ &global->openssl_lock[n]);
+ else
+ odp_ticketlock_unlock((odp_ticketlock_t *)
+ &global->openssl_lock[n]);
+}
+
int
odp_crypto_init_global(void)
{
size_t mem_size;
odp_shm_t shm;
int idx;
+ int nlocks = CRYPTO_num_locks();
/* Calculate the memory size we need */
mem_size = sizeof(*global);
mem_size += (MAX_SESSIONS * sizeof(odp_crypto_generic_session_t));
+ mem_size += nlocks * sizeof(odp_ticketlock_t);
/* Allocate our globally shared memory */
shm = odp_shm_reserve("crypto_pool", mem_size,
@@ -975,6 +995,18 @@ odp_crypto_init_global(void)
}
odp_spinlock_init(&global->lock);
+ if (nlocks > 0) {
+ global->openssl_lock =
+ (odp_ticketlock_t **)&global->sessions[MAX_SESSIONS];
+
+ for (idx = 0; idx < nlocks; idx++)
+ odp_ticketlock_init((odp_ticketlock_t *)
+ &global->openssl_lock[idx]);
+
+ CRYPTO_set_id_callback(openssl_thread_id);
+ CRYPTO_set_locking_callback(openssl_lock);
+ }
+
return 0;
}
@@ -992,6 +1024,9 @@ int odp_crypto_term_global(void)
rc = -1;
}
+ CRYPTO_set_locking_callback(NULL);
+ CRYPTO_set_id_callback(NULL);
+
ret = odp_shm_free(odp_shm_lookup("crypto_pool"));
if (ret < 0) {
ODP_ERR("shm free failed for crypto_pool\n");
-----------------------------------------------------------------------
Summary of changes:
platform/linux-generic/odp_crypto.c | 35 +++++++++++++++++++++++++++++++++++
platform/linux-generic/odp_init.c | 3 ++-
2 files changed, 37 insertions(+), 1 deletion(-)
hooks/post-receive
--
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, api-next has been updated
via c28c81745896d433262cc964d341f6e2d448c12f (commit)
from c10a2195b23c5ad230dad2ee252a96d1e418b5c7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c28c81745896d433262cc964d341f6e2d448c12f
Author: Bill Fischofer <bill.fischofer(a)linaro.org>
Date: Thu Jan 12 06:14:19 2017 -0600
linux-generic: packet: remove erroneous assert
odp_packet_set_len() is only called from the classifier on paths for
which a dummy header may be used. Rather than setting a dummy reference
count to validate, it's simpler to just delete the assert. This resolves
Bug https://bugs.linaro.org/show_bug.cgi?id=2814
Signed-off-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Reviewed-by: Christophe Milard <christophe.milard(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index 607560d..c5dc989 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -324,8 +324,6 @@ static inline void packet_ref_count_set(odp_packet_hdr_t *pkt_hdr, uint32_t n)
static inline void packet_set_len(odp_packet_hdr_t *pkt_hdr, uint32_t len)
{
- ODP_ASSERT(packet_ref_count(pkt_hdr) == 1);
-
pkt_hdr->frame_len = len;
pkt_hdr->unshared_len = len;
}
-----------------------------------------------------------------------
Summary of changes:
platform/linux-generic/include/odp_packet_internal.h | 2 --
1 file changed, 2 deletions(-)
hooks/post-receive
--
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, next has been updated
via 23e7745272bd405483da737824af25e2e18c8b21 (commit)
via 4be29b50a3de7fed08d427f0fab38ae61548d3e2 (commit)
from 26e0820a7bc833239a8a66bc15d2eab5fd3edb87 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 23e7745272bd405483da737824af25e2e18c8b21
Author: Bill Fischofer <bill.fischofer(a)linaro.org>
Date: Tue Jan 10 09:59:40 2017 -0600
linux-generic: pool: defer ring allocation until pool creation
To avoid excessive memory overhead for pools, defer the allocation of
the pool ring until odp_pool_create() is called. This keeps pool memory
overhead proportional to the number of pools actually in use rather
than the architected maximum number of pools.
This patch addresses Bug https://bugs.linaro.org/show_bug.cgi?id=2765
Signed-off-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Reviewed-by: Petri Savolainen <petri.savolainen(a)nokia.com>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h
index 5d7b817..4915bda 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -69,7 +69,8 @@ typedef struct pool_t {
pool_cache_t local_cache[ODP_THREAD_COUNT_MAX];
- pool_ring_t ring;
+ odp_shm_t ring_shm;
+ pool_ring_t *ring;
} pool_t;
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index cae2759..932efe3 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -143,7 +143,7 @@ static void flush_cache(pool_cache_t *cache, pool_t *pool)
uint32_t mask;
uint32_t cache_num, i, data;
- ring = &pool->ring.hdr;
+ ring = &pool->ring->hdr;
mask = pool->ring_mask;
cache_num = cache->num;
@@ -172,6 +172,7 @@ static pool_t *reserve_pool(void)
{
int i;
pool_t *pool;
+ char ring_name[ODP_POOL_NAME_LEN];
for (i = 0; i < ODP_CONFIG_POOLS; i++) {
pool = pool_entry(i);
@@ -180,6 +181,19 @@ static pool_t *reserve_pool(void)
if (pool->reserved == 0) {
pool->reserved = 1;
UNLOCK(&pool->lock);
+ sprintf(ring_name, "pool_ring_%d", i);
+ pool->ring_shm =
+ odp_shm_reserve(ring_name,
+ sizeof(pool_ring_t),
+ ODP_CACHE_LINE_SIZE, 0);
+ if (odp_unlikely(pool->ring_shm == ODP_SHM_INVALID)) {
+ ODP_ERR("Unable to alloc pool ring %d\n", i);
+ LOCK(&pool->lock);
+ pool->reserved = 0;
+ UNLOCK(&pool->lock);
+ break;
+ }
+ pool->ring = odp_shm_addr(pool->ring_shm);
return pool;
}
UNLOCK(&pool->lock);
@@ -214,7 +228,7 @@ static void init_buffers(pool_t *pool)
int type;
uint32_t seg_size;
- ring = &pool->ring.hdr;
+ ring = &pool->ring->hdr;
mask = pool->ring_mask;
type = pool->params.type;
@@ -411,7 +425,7 @@ static odp_pool_t pool_create(const char *name, odp_pool_param_t *params,
pool->uarea_base_addr = odp_shm_addr(pool->uarea_shm);
}
- ring_init(&pool->ring.hdr);
+ ring_init(&pool->ring->hdr);
init_buffers(pool);
return pool->pool_hdl;
@@ -536,6 +550,8 @@ int odp_pool_destroy(odp_pool_t pool_hdl)
odp_shm_free(pool->uarea_shm);
pool->reserved = 0;
+ odp_shm_free(pool->ring_shm);
+ pool->ring = NULL;
UNLOCK(&pool->lock);
return 0;
@@ -592,8 +608,6 @@ int buffer_alloc_multi(pool_t *pool, odp_buffer_t buf[],
pool_cache_t *cache;
uint32_t cache_num, num_ch, num_deq, burst;
- ring = &pool->ring.hdr;
- mask = pool->ring_mask;
cache = local.cache[pool->pool_idx];
cache_num = cache->num;
@@ -620,6 +634,8 @@ int buffer_alloc_multi(pool_t *pool, odp_buffer_t buf[],
* and not uint32_t. */
uint32_t data[burst];
+ ring = &pool->ring->hdr;
+ mask = pool->ring_mask;
burst = ring_deq_multi(ring, mask, data, burst);
cache_num = burst - num_deq;
@@ -671,12 +687,12 @@ static inline void buffer_free_to_pool(uint32_t pool_id,
cache = local.cache[pool_id];
pool = pool_entry(pool_id);
- ring = &pool->ring.hdr;
- mask = pool->ring_mask;
/* Special case of a very large free. Move directly to
* the global pool. */
if (odp_unlikely(num > CONFIG_POOL_CACHE_SIZE)) {
+ ring = &pool->ring->hdr;
+ mask = pool->ring_mask;
for (i = 0; i < num; i++)
ring_enq(ring, mask, (uint32_t)(uintptr_t)buf[i]);
@@ -691,6 +707,9 @@ static inline void buffer_free_to_pool(uint32_t pool_id,
uint32_t index;
int burst = CACHE_BURST;
+ ring = &pool->ring->hdr;
+ mask = pool->ring_mask;
+
if (odp_unlikely(num > CACHE_BURST))
burst = num;
commit 4be29b50a3de7fed08d427f0fab38ae61548d3e2
Author: Christophe Milard <christophe.milard(a)linaro.org>
Date: Wed Dec 21 13:55:56 2016 +0100
linux-gen: _ishm: fixing typos
Fixing a set of iritating typos. just in comments.
Signed-off-by: Christophe Milard <christophe.milard(a)linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c
index 8b54be2..f889834 100644
--- a/platform/linux-generic/_ishm.c
+++ b/platform/linux-generic/_ishm.c
@@ -75,7 +75,7 @@
/*
* Maximum number of internal shared memory blocks.
*
- * This the the number of separate ISHM areas that can be reserved concurrently
+ * This is the number of separate ISHM areas that can be reserved concurrently
* (Note that freeing such blocks may take time, or possibly never happen
* if some of the block ownwers never procsync() after free). This number
* should take that into account)
@@ -240,7 +240,7 @@ static void procsync(void);
* Take a piece of the preallocated virtual space to fit "size" bytes.
* (best fit). Size must be rounded up to an integer number of pages size.
* Possibly split the fragment to keep track of remaining space.
- * Returns the allocated fragment (best_fragmnt) and the corresponding address.
+ * Returns the allocated fragment (best_fragment) and the corresponding address.
* External caller must ensure mutex before the call!
*/
static void *alloc_fragment(uintptr_t size, int block_index, intptr_t align,
@@ -286,11 +286,11 @@ static void *alloc_fragment(uintptr_t size, int block_index, intptr_t align,
/*
* if there is room between previous fragment and new one, (due to
- * alignement requirement) then fragment (split) the space between
+ * alignment requirement) then fragment (split) the space between
* the end of the previous fragment and the beginning of the new one:
*/
if (border - (uintptr_t)(*best_fragmnt)->start > 0) {
- /* frangment space, i.e. take a new fragment descriptor... */
+ /* fragment space, i.e. take a new fragment descriptor... */
rem_fragmnt = ishm_ftbl->unused_fragmnts;
if (!rem_fragmnt) {
ODP_ERR("unable to get shmem fragment descriptor!\n.");
@@ -320,7 +320,7 @@ static void *alloc_fragment(uintptr_t size, int block_index, intptr_t align,
if (remainder == 0)
return (*best_fragmnt)->start;
- /* otherwise, frangment space, i.e. take a new fragment descriptor... */
+ /* otherwise, fragment space, i.e. take a new fragment descriptor... */
rem_fragmnt = ishm_ftbl->unused_fragmnts;
if (!rem_fragmnt) {
ODP_ERR("unable to get shmem fragment descriptor!\n.");
@@ -515,7 +515,7 @@ static void delete_file(ishm_block_t *block)
* performs the mapping, possibly allocating a fragment of the pre-reserved
* VA space if the _ODP_ISHM_SINGLE_VA flag was given.
* Sets fd, and returns the mapping address.
- * This funstion will also set the _ODP_ISHM_SINGLE_VA flag if the alignment
+ * This function will also set the _ODP_ISHM_SINGLE_VA flag if the alignment
* requires it
* Mutex must be assured by the caller.
*/
@@ -736,7 +736,7 @@ static void procsync(void)
last = ishm_proctable->nb_entries;
while (i < last) {
- /* if the procecess sequence number doesn't match the main
+ /* if the process sequence number doesn't match the main
* table seq number, this entry is obsolete
*/
block = &ishm_tbl->block[ishm_proctable->entry[i].block_index];
@@ -1065,7 +1065,7 @@ static int block_free(int block_index)
}
/*
- * Free and unmap internal shared memory, intentified by its block number:
+ * Free and unmap internal shared memory, identified by its block number:
* return -1 on error. 0 if OK.
*/
int _odp_ishm_free_by_index(int block_index)
@@ -1081,7 +1081,7 @@ int _odp_ishm_free_by_index(int block_index)
}
/*
- * free and unmap internal shared memory, intentified by its block name:
+ * free and unmap internal shared memory, identified by its block name:
* return -1 on error. 0 if OK.
*/
int _odp_ishm_free_by_name(const char *name)
@@ -1492,8 +1492,8 @@ static int do_odp_ishm_term_local(void)
* Go through the table of visible blocks for this process,
* decreasing the refcnt of each visible blocks, and issuing
* warning for those no longer referenced by any process.
- * Note that non-referenced blocks are nor freeed: this is
- * deliberate as this would imply that the sementic of the
+ * Note that non-referenced blocks are not freed: this is
+ * deliberate as this would imply that the semantic of the
* freeing function would differ depending on whether we run
* with odp_thread as processes or pthreads. With this approach,
* the user should always free the blocks manually, which is
@@ -1699,7 +1699,7 @@ int _odp_ishm_status(const char *title)
fragmnt; fragmnt = fragmnt->next)
nb_unused_frgments++;
- ODP_DBG("ishm: %d fragment used. %d fragements unused. (total=%d)\n",
+ ODP_DBG("ishm: %d fragment used. %d fragments unused. (total=%d)\n",
nb_used_frgments, nb_unused_frgments,
nb_used_frgments + nb_unused_frgments);
-----------------------------------------------------------------------
Summary of changes:
platform/linux-generic/_ishm.c | 24 ++++++++--------
platform/linux-generic/include/odp_pool_internal.h | 3 +-
platform/linux-generic/odp_pool.c | 33 +++++++++++++++++-----
3 files changed, 40 insertions(+), 20 deletions(-)
hooks/post-receive
--
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, api-next has been updated
via ed3cfdeed1a99f024be2538aac31b71c8eddcf07 (commit)
from 29b05df013426838fe166084fed9f1d56c59ebed (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ed3cfdeed1a99f024be2538aac31b71c8eddcf07
Author: Bill Fischofer <bill.fischofer(a)linaro.org>
Date: Tue Jan 10 09:59:40 2017 -0600
linux-generic: pool: defer ring allocation until pool creation
To avoid excessive memory overhead for pools, defer the allocation of
the pool ring until odp_pool_create() is called. This keeps pool memory
overhead proportional to the number of pools actually in use rather
than the architected maximum number of pools.
This patch addresses Bug https://bugs.linaro.org/show_bug.cgi?id=2765
Signed-off-by: Bill Fischofer <bill.fischofer(a)linaro.org>
Reviewed-by: Petri Savolainen <petri.savolainen(a)nokia.com>
Signed-off-by: Maxim Uvarov <maxim.uvarov(a)linaro.org>
diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h
index 5d7b817..4915bda 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -69,7 +69,8 @@ typedef struct pool_t {
pool_cache_t local_cache[ODP_THREAD_COUNT_MAX];
- pool_ring_t ring;
+ odp_shm_t ring_shm;
+ pool_ring_t *ring;
} pool_t;
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index cae2759..932efe3 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -143,7 +143,7 @@ static void flush_cache(pool_cache_t *cache, pool_t *pool)
uint32_t mask;
uint32_t cache_num, i, data;
- ring = &pool->ring.hdr;
+ ring = &pool->ring->hdr;
mask = pool->ring_mask;
cache_num = cache->num;
@@ -172,6 +172,7 @@ static pool_t *reserve_pool(void)
{
int i;
pool_t *pool;
+ char ring_name[ODP_POOL_NAME_LEN];
for (i = 0; i < ODP_CONFIG_POOLS; i++) {
pool = pool_entry(i);
@@ -180,6 +181,19 @@ static pool_t *reserve_pool(void)
if (pool->reserved == 0) {
pool->reserved = 1;
UNLOCK(&pool->lock);
+ sprintf(ring_name, "pool_ring_%d", i);
+ pool->ring_shm =
+ odp_shm_reserve(ring_name,
+ sizeof(pool_ring_t),
+ ODP_CACHE_LINE_SIZE, 0);
+ if (odp_unlikely(pool->ring_shm == ODP_SHM_INVALID)) {
+ ODP_ERR("Unable to alloc pool ring %d\n", i);
+ LOCK(&pool->lock);
+ pool->reserved = 0;
+ UNLOCK(&pool->lock);
+ break;
+ }
+ pool->ring = odp_shm_addr(pool->ring_shm);
return pool;
}
UNLOCK(&pool->lock);
@@ -214,7 +228,7 @@ static void init_buffers(pool_t *pool)
int type;
uint32_t seg_size;
- ring = &pool->ring.hdr;
+ ring = &pool->ring->hdr;
mask = pool->ring_mask;
type = pool->params.type;
@@ -411,7 +425,7 @@ static odp_pool_t pool_create(const char *name, odp_pool_param_t *params,
pool->uarea_base_addr = odp_shm_addr(pool->uarea_shm);
}
- ring_init(&pool->ring.hdr);
+ ring_init(&pool->ring->hdr);
init_buffers(pool);
return pool->pool_hdl;
@@ -536,6 +550,8 @@ int odp_pool_destroy(odp_pool_t pool_hdl)
odp_shm_free(pool->uarea_shm);
pool->reserved = 0;
+ odp_shm_free(pool->ring_shm);
+ pool->ring = NULL;
UNLOCK(&pool->lock);
return 0;
@@ -592,8 +608,6 @@ int buffer_alloc_multi(pool_t *pool, odp_buffer_t buf[],
pool_cache_t *cache;
uint32_t cache_num, num_ch, num_deq, burst;
- ring = &pool->ring.hdr;
- mask = pool->ring_mask;
cache = local.cache[pool->pool_idx];
cache_num = cache->num;
@@ -620,6 +634,8 @@ int buffer_alloc_multi(pool_t *pool, odp_buffer_t buf[],
* and not uint32_t. */
uint32_t data[burst];
+ ring = &pool->ring->hdr;
+ mask = pool->ring_mask;
burst = ring_deq_multi(ring, mask, data, burst);
cache_num = burst - num_deq;
@@ -671,12 +687,12 @@ static inline void buffer_free_to_pool(uint32_t pool_id,
cache = local.cache[pool_id];
pool = pool_entry(pool_id);
- ring = &pool->ring.hdr;
- mask = pool->ring_mask;
/* Special case of a very large free. Move directly to
* the global pool. */
if (odp_unlikely(num > CONFIG_POOL_CACHE_SIZE)) {
+ ring = &pool->ring->hdr;
+ mask = pool->ring_mask;
for (i = 0; i < num; i++)
ring_enq(ring, mask, (uint32_t)(uintptr_t)buf[i]);
@@ -691,6 +707,9 @@ static inline void buffer_free_to_pool(uint32_t pool_id,
uint32_t index;
int burst = CACHE_BURST;
+ ring = &pool->ring->hdr;
+ mask = pool->ring_mask;
+
if (odp_unlikely(num > CACHE_BURST))
burst = num;
-----------------------------------------------------------------------
Summary of changes:
platform/linux-generic/include/odp_pool_internal.h | 3 +-
platform/linux-generic/odp_pool.c | 33 +++++++++++++++++-----
2 files changed, 28 insertions(+), 8 deletions(-)
hooks/post-receive
--