[PATCH] trace: force 8 byte alignment when --no-huge is used
David Christensen
drc at linux.ibm.com
Thu Jul 24 02:05:53 CEST 2025
Current code in eal_trace_init() specifies 8 byte alignment for CTF
generation, but fallback code in __rte_trace_mem_per_thread() does
not enforce similar requirements when calling malloc(). Modify fallback
heap requests to use posix_memalign() with proper alignment.
Signed-off-by: David Christensen <drc at linux.ibm.com>
Bugzilla-ID: 1715
---
lib/eal/common/eal_common_trace.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c
index be1f78a68d..3dadd58e3e 100644
--- a/lib/eal/common/eal_common_trace.c
+++ b/lib/eal/common/eal_common_trace.c
@@ -363,8 +363,11 @@ __rte_trace_mem_per_thread_alloc(void)
goto found;
}
- /* Second attempt from heap */
- header = malloc(trace_mem_sz(trace->buff_len));
+ /* Second attempt from heap with proper alignment*/
+ size_t mem_size = trace_mem_sz(trace->buff_len);
+ void *aligned_ptr = NULL;
+ int ret = posix_memalign(&aligned_ptr, 8, mem_size);
+ header = (ret == 0) ? aligned_ptr : NULL;
if (header == NULL) {
trace_crit("trace mem malloc attempt failed");
header = NULL;
--
2.43.5
More information about the dev
mailing list