History log of /optee_os/lib/libutils/ext/mempool.c (Results 1 – 15 of 15)
Revision Date Author Comments
# a05577ea 23-Nov-2023 Etienne Carriere <etienne.carriere@foss.st.com>

tree wide: clarify PTA ABI

Explicitly describe the statistics PTA ABI using dedicated inline
comments and moving struct pta_stats_ta and struct pta_stats_alloc
from respectively tee_ta_manager.c and

tree wide: clarify PTA ABI

Explicitly describe the statistics PTA ABI using dedicated inline
comments and moving struct pta_stats_ta and struct pta_stats_alloc
from respectively tee_ta_manager.c and malloc.h to pta_stats.h
header file.

For that purpose, define ALLOC_ID_* macros to identify each allocator
one can query information from through the statistics PTA API.

Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 2617f49f 22-Nov-2023 Etienne Carriere <etienne.carriere@foss.st.com>

tree wide: rename struct malloc_stats

Rename struct malloc_stats to struct pta_stats_alloc to prepare
the creation of pta_stats.h header file that will define the
whole statistics PTA API and ABI, l

tree wide: rename struct malloc_stats

Rename struct malloc_stats to struct pta_stats_alloc to prepare
the creation of pta_stats.h header file that will define the
whole statistics PTA API and ABI, located in libutee/include/
as already done for all other PTAs.

Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 7bd4f9b2 01-Sep-2023 Jens Wiklander <jens.wiklander@linaro.org>

libutils: mempool: fix unbalanced put_pool()

Prior to this patch mempool_free() unconditionally called put_pool(),
but if the "ptr" argument is NULL it means that there hasn't been a
corresponding c

libutils: mempool: fix unbalanced put_pool()

Prior to this patch mempool_free() unconditionally called put_pool(),
but if the "ptr" argument is NULL it means that there hasn't been a
corresponding call to get_pool(). Fix this only calling put_pool() for
non-NULL pointers.

Fixes: a51d45b52503 ("libutils: mempool based raw malloc functions")
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

show more ...


# a51d45b5 17-Dec-2021 Jens Wiklander <jens.wiklander@linaro.org>

libutils: mempool based raw malloc functions

Instead of the old stack like internal memory allocator, use the raw
malloc functions instead for more efficient memory usage.

CFG_WITH_STATS is enabled

libutils: mempool based raw malloc functions

Instead of the old stack like internal memory allocator, use the raw
malloc functions instead for more efficient memory usage.

CFG_WITH_STATS is enabled automatically if
CFG_MEMPOOL_REPORT_LAST_OFFSET is enabled to secure a new dependency in
the code.

Acked-by: Sahil Malhotra <sahil.malhotra@nxp.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 52c0b45c 14-Dec-2021 Marouene Boubakri <marouene.boubakri@nxp.com>

lib: libutils: ext: mempool.c: remove unused thread.h

This commit removes thread.h from lib/libutils/ext/mempool.c since it is
not used, but also to eliminate the dependency between generic librarie

lib: libutils: ext: mempool.c: remove unused thread.h

This commit removes thread.h from lib/libutils/ext/mempool.c since it is
not used, but also to eliminate the dependency between generic libraries
code and architecture-specific core functions.

Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 93aade0f 09-Jul-2020 Jerome Forissier <jerome@forissier.org>

core: mempool: use recursive mutex

The mempool code can be simplified by using a recursive mutex.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carri

core: mempool: use recursive mutex

The mempool code can be simplified by using a recursive mutex.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 95d0db1e 15-May-2019 Jens Wiklander <jens.wiklander@linaro.org>

core: add system wide mempool_default

Adds system wide mempool_default for temporary large memory allocations.

Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere

core: add system wide mempool_default

Adds system wide mempool_default for temporary large memory allocations.

Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# b2dd8747 05-Feb-2019 Jens Wiklander <jens.wiklander@linaro.org>

Fix alignment of data for mempool_alloc_pool()

Prior to this patch was _TEE_MathAPI_Init() in
lib/libutee/tee_api_arith_mpi.c supplying a data buffer which was only 4
byte aligned while mempool_allo

Fix alignment of data for mempool_alloc_pool()

Prior to this patch was _TEE_MathAPI_Init() in
lib/libutee/tee_api_arith_mpi.c supplying a data buffer which was only 4
byte aligned while mempool_alloc_pool() requires the alignment of long.
This will work in 32-bit mode, but could lead to alignment problem in
64-bit mode. The same problem can happen with
lib/libutee/tee_api_arith_mpa.c, but so far it has remained hidden.

Incorrect alignment can result in errors like:
E/TA: assertion '!((vaddr_t)data & (POOL_ALIGN - 1))' failed at lib/libutils/ext/mempool.c:134 in mempool_alloc_pool()

This fix introduces MEMPOOL_ALIGN which specifies required alignment of
data supplied to mempool_alloc_pool().

Fixes: 062e3d01c039 ("ta: switch to to mbedtls for bignum")
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Joakim Bech <joakim.bech@linaro.org> (QEMU v8)
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 60b39904 16-Jan-2019 Jens Wiklander <jens.wiklander@linaro.org>

mempool: fix race in get_pool()

Fixes a race in get_pool() which could leave the pool with zero refences
but still owned by the last thread using the pool.

Some performance number on Hikey with def

mempool: fix race in get_pool()

Fixes a race in get_pool() which could leave the pool with zero refences
but still owned by the last thread using the pool.

Some performance number on Hikey with default configuration:
github/master (edbb89f, before this commit):

4006 real 1m 41.11s
4007 real 1m 14.51s
4008 real 0m 0.13s
4009 real 1m 5.68s

Revert "mempool: optimize reference counting", before this commit:
4006 real 3m 27.78s
4007 real 0m 50.03s
4008 real 0m 0.13s
4009 real 2m 24.07s

With this commit, two runs:
4006 real 1m 37.51s
4007 real 0m 56.67s
4008 real 0m 0.09s
4009 real 1m 3.18s

4006 real 1m 37.61s
4007 real 0m 35.32s
4008 real 0m 0.13s
4009 real 1m 3.15s

Numbers are gathered with this script:
for a in 4006 4007 4008 4009 ; do \
echo -n $a " " >> time.txt ;\
time -o time.txt.tmp xtest -l 15 $a || break ;\
grep real time.txt.tmp >> time.txt
done
cat time.txt

Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# e7d51f42 12-Nov-2018 Jens Wiklander <jens.wiklander@linaro.org>

mempool: add mempool_calloc()

Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>


# b69b86b6 08-Nov-2018 Jens Wiklander <jens.wiklander@linaro.org>

mempool: report max memory usage

Adds CFG_MEMPOOL_REPORT_LAST_OFFSET which if set to y causes mempool to
report each time the maximum amount of memory has increased. This helps
to determine required

mempool: report max memory usage

Adds CFG_MEMPOOL_REPORT_LAST_OFFSET which if set to y causes mempool to
report each time the maximum amount of memory has increased. This helps
to determine required size of a mempool.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# d4f909c0 08-Nov-2018 Jens Wiklander <jens.wiklander@linaro.org>

mempool: optimize reference counting

Optimizes reference counting in mempool by using refcount_inc() and
refcount_dec() in order to be able to avoid using the mutex in the quick
case.

Reviewed-by:

mempool: optimize reference counting

Optimizes reference counting in mempool by using refcount_inc() and
refcount_dec() in order to be able to avoid using the mutex in the quick
case.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# b54b9a98 09-Nov-2018 Jens Wiklander <jens.wiklander@linaro.org>

mempool: add out of memory message

Adds a helpful message when a memory allocation with mempool_alloc()
fails. If this occurs it's because the memory pool size isn't tuned
properly with regards to t

mempool: add out of memory message

Adds a helpful message when a memory allocation with mempool_alloc()
fails. If this occurs it's because the memory pool size isn't tuned
properly with regards to the user of the pool.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# dc0f4ec2 16-May-2018 Etienne Carriere <etienne.carriere@st.com>

Remove license notice from STMicroelectronics files

Since a while the source files license info are defined by SPDX
identifiers. We can safely remove the verbose license text from the
files that are

Remove license notice from STMicroelectronics files

Since a while the source files license info are defined by SPDX
identifiers. We can safely remove the verbose license text from the
files that are owned by either only STMicroelectronics or only both
Linaro and STMicroelectronics.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# a2eb5b55 18-Apr-2018 Jens Wiklander <jens.wiklander@linaro.org>

libutils: add mempool API

Adds mempool.h with an API suitable for allocating short-lived object.
Based on the internal counterpart in libmpa. This is needed to integrate
other bignum implementations

libutils: add mempool API

Adds mempool.h with an API suitable for allocating short-lived object.
Based on the internal counterpart in libmpa. This is needed to integrate
other bignum implementations.

Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...