Use global debug flag RTE_DEBUG instead of RTE_MALLOC_DEBUG. The old define is completely removed from source code and config. Tests and documentation were also updated.
Signed-off-by: Lukasz Wojciechowski <l.wojciec...@partner.samsung.com> --- app/test/test_malloc.c | 4 ++-- config/common_base | 1 - doc/guides/prog_guide/env_abstraction_layer.rst | 5 +++-- lib/librte_eal/common/malloc_elem.c | 2 +- lib/librte_eal/common/malloc_elem.h | 4 ++-- lib/librte_eal/common/rte_malloc.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c index 232d3186d..61b89d0c1 100644 --- a/app/test/test_malloc.c +++ b/app/test/test_malloc.c @@ -641,7 +641,7 @@ test_rte_malloc_validate(void) const size_t request_size = 1024; size_t allocated_size; char *data_ptr = rte_malloc(NULL, request_size, RTE_CACHE_LINE_SIZE); -#ifdef RTE_MALLOC_DEBUG +#ifdef RTE_DEBUG int retval; char *over_write_vals = NULL; #endif @@ -663,7 +663,7 @@ test_rte_malloc_validate(void) if (allocated_size < request_size) err_return(); -#ifdef RTE_MALLOC_DEBUG +#ifdef RTE_DEBUG /****** change the header to be bad */ char save_buf[64]; diff --git a/config/common_base b/config/common_base index 1f7be1219..ae6db0adb 100644 --- a/config/common_base +++ b/config/common_base @@ -107,7 +107,6 @@ CONFIG_RTE_EAL_IGB_UIO=n CONFIG_RTE_EAL_VFIO=n CONFIG_RTE_MAX_VFIO_GROUPS=64 CONFIG_RTE_MAX_VFIO_CONTAINERS=64 -CONFIG_RTE_MALLOC_DEBUG=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n CONFIG_RTE_USE_LIBBSD=n # Use WFE instructions to implement the rte_wait_for_equal_xxx APIs, diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst index 48a2fec06..a8d2ef1a3 100644 --- a/doc/guides/prog_guide/env_abstraction_layer.rst +++ b/doc/guides/prog_guide/env_abstraction_layer.rst @@ -714,8 +714,9 @@ manual for more information. Cookies ~~~~~~~ -When CONFIG_RTE_MALLOC_DEBUG is enabled, the allocated memory contains -overwrite protection fields to help identify buffer overflows. +When RTE_DEBUG is enabled (e.g. by enabling "debug" option in meson setup, +the allocated memory contains overwrite protection fields to help identify +buffer overflows. Alignment and NUMA Constraints ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c index 885d00424..662adb6b9 100644 --- a/lib/librte_eal/common/malloc_elem.c +++ b/lib/librte_eal/common/malloc_elem.c @@ -28,7 +28,7 @@ * to catch buggy programs. Otherwise, freed memory is set to zero * to avoid having to zero in zmalloc */ -#ifdef RTE_MALLOC_DEBUG +#ifdef RTE_DEBUG #define MALLOC_POISON 0x6b #else #define MALLOC_POISON 0 diff --git a/lib/librte_eal/common/malloc_elem.h b/lib/librte_eal/common/malloc_elem.h index a1e5f7f02..e5286415e 100644 --- a/lib/librte_eal/common/malloc_elem.h +++ b/lib/librte_eal/common/malloc_elem.h @@ -32,13 +32,13 @@ struct malloc_elem { size_t size; struct malloc_elem *orig_elem; size_t orig_size; -#ifdef RTE_MALLOC_DEBUG +#ifdef RTE_DEBUG uint64_t header_cookie; /* Cookie marking start of data */ /* trailer cookie at start + size */ #endif } __rte_cache_aligned; -#ifndef RTE_MALLOC_DEBUG +#ifndef RTE_DEBUG static const unsigned MALLOC_ELEM_TRAILER_LEN = 0; /* dummy function - just check if pointer is non-null */ diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c index d6026a2b1..912bfeb9b 100644 --- a/lib/librte_eal/common/rte_malloc.c +++ b/lib/librte_eal/common/rte_malloc.c @@ -78,7 +78,7 @@ rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket) { void *ptr = rte_malloc_socket(type, size, align, socket); -#ifdef RTE_MALLOC_DEBUG +#ifdef RTE_DEBUG /* * If DEBUG is enabled, then freed memory is marked with poison * value and set to zero on allocation. -- 2.17.1