> -----Original Message-----
> From: David Christensen <d...@linux.ibm.com>
> Sent: Thursday, July 24, 2025 5:36 AM
> To: dev@dpdk.org
> Cc: David Christensen <d...@linux.ibm.com>; Jerin Jacob <jer...@marvell.com>;
> Sunil Kumar Kori <sk...@marvell.com>; Tyler Retzlaff
> <roret...@linux.microsoft.com>
> Subject: [EXTERNAL] [PATCH] 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()
> 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 <d...@linux.ibm.com>
Acked-by: Jerin Jacob <jer...@marvell.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