trace: force 8 byte alignment when --no-huge is used
PATCH 1/1 trace: force 8 byte alignment when --no-huge is used
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.
Bugzilla-ID: 1715
--- lib/eal/common/eal_common_trace.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_trace.c +5 -2
@@ -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
Quoted 21 lines
-----Original Message-----
From: David Christensen <[email protected]>
Sent: Thursday, July 24, 2025 5:36 AM
To: [email protected]
Cc: David Christensen <[email protected]>; Jerin Jacob <[email protected]>; Sunil Kumar Kori <[email protected]>; Tyler Retzlaff <[email protected]>
Subject: [EXTERNAL] [PATCH] trace: force 8 byte alignment when --no-huge is usedCurrent 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 callingmalloc(). Modify fallback heap requests to useposix_memalign()
Current code ineal_trace_init()specifies 8 byte alignment for CTF generation, but fallback code in__rte_trace_mem_per_thread()does not enforce similar requirements when callingmalloc(). Modify fallback heap requests to useposix_memalign()with proper alignment.
Quoted 1 line
Signed-off-by David Christensen <[email protected]>
Quoted 26 lines
Bugzilla-ID: 1715
--- lib/eal/common/eal_common_trace.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)lib/eal/common/eal_common_trace.c +5
-3@@ -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
Thomas Monjalon
Applied24/07/2025 13:05, Jerin Jacob:
Quoted 11 lines
From: David Christensen <[email protected]>
Quoted 10 lines
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 callingmalloc(). Modify fallback heap requests to useposix_memalign()
Current code ineal_trace_init()specifies 8 byte alignment for CTF generation, but fallback code in__rte_trace_mem_per_thread()does not enforce similar requirements when callingmalloc(). Modify fallback heap requests to useposix_memalign()with proper alignment.
Quoted 6 lines
Quoted 1 line
Signed-off-by David Christensen <[email protected]>Acked-by Jerin Jacob <[email protected]>Quoted 1 line
Bugzilla-ID: 1715
Applied, thanks.
Note: seems unrelated to --no-huge, so dropped from the title.