DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] trace: force 8 byte alignment when --no-huge is used
@ 2025-07-24  0:05 David Christensen
  2025-07-24 11:05 ` [EXTERNAL] " Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: David Christensen @ 2025-07-24  0:05 UTC (permalink / raw)
  To: dev; +Cc: David Christensen, Jerin Jacob, Sunil Kumar Kori, Tyler Retzlaff

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@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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-24 11:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-24  0:05 [PATCH] trace: force 8 byte alignment when --no-huge is used David Christensen
2025-07-24 11:05 ` [EXTERNAL] " Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).