-
Notifications
You must be signed in to change notification settings - Fork 735
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patch: dpdk eal memory debug patch for dpdk-stable-18.11.2
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
patch/dpdk-stable-18.11.2/0006-enable-dpdk-eal-memory-debug.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
From 19652889ed74b09aba6f22dfa96b19c009a7309a Mon Sep 17 00:00:00 2001 | ||
From: ywc <[email protected]> | ||
Date: Mon, 25 Jan 2021 10:27:52 +0800 | ||
Subject: [PATCH] enable dpdk eal memory debug | ||
|
||
--- | ||
config/common_base | 2 +- | ||
lib/librte_eal/common/include/rte_malloc.h | 15 +++++++++++++++ | ||
lib/librte_eal/common/rte_malloc.c | 4 ++++ | ||
3 files changed, 20 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/config/common_base b/config/common_base | ||
index d12ae98..765ae2e 100644 | ||
--- a/config/common_base | ||
+++ b/config/common_base | ||
@@ -94,7 +94,7 @@ 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_MALLOC_DEBUG=y | ||
CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n | ||
CONFIG_RTE_USE_LIBBSD=n | ||
|
||
diff --git a/lib/librte_eal/common/include/rte_malloc.h b/lib/librte_eal/common/include/rte_malloc.h | ||
index e0be13c..f3bcdc6 100644 | ||
--- a/lib/librte_eal/common/include/rte_malloc.h | ||
+++ b/lib/librte_eal/common/include/rte_malloc.h | ||
@@ -214,6 +214,21 @@ struct rte_malloc_socket_stats { | ||
rte_calloc_socket(const char *type, size_t num, size_t size, unsigned align, int socket); | ||
|
||
/** | ||
+ * Check the header/tailer cookies of memory pointed to by the provided pointer. | ||
+ * | ||
+ * This pointer must have been returned by a previous call to | ||
+ * rte_malloc(), rte_zmalloc(), rte_calloc() or rte_realloc(). | ||
+ * | ||
+ * @param ptr | ||
+ * The pointer to memory to be checked. | ||
+ * @return | ||
+ * - true if the header/tailer cookies are OK. | ||
+ * - Otherwise, false. | ||
+ */ | ||
+int | ||
+rte_memmory_ok(void *ptr); | ||
+ | ||
+/** | ||
* Frees the memory space pointed to by the provided pointer. | ||
* | ||
* This pointer must have been returned by a previous call to | ||
diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c | ||
index 47c2bec..1fab27c 100644 | ||
--- a/lib/librte_eal/common/rte_malloc.c | ||
+++ b/lib/librte_eal/common/rte_malloc.c | ||
@@ -26,6 +26,10 @@ | ||
#include "malloc_heap.h" | ||
#include "eal_memalloc.h" | ||
|
||
+int rte_memmory_ok(void *addr) | ||
+{ | ||
+ return malloc_elem_cookies_ok(RTE_PTR_SUB(addr, MALLOC_ELEM_HEADER_LEN)); | ||
+} | ||
|
||
/* Free the memory space back to heap */ | ||
void rte_free(void *addr) | ||
-- | ||
1.8.3.1 | ||
|