All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Christensen <drc@linux.ibm.com>
To: dev@dpdk.org
Cc: David Christensen <drc@linux.ibm.com>,
	Jerin Jacob <jerinj@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH] trace: force 8 byte alignment when --no-huge is used
Date: Wed, 23 Jul 2025 20:05:53 -0400	[thread overview]
Message-ID: <20250724000554.114087-1-drc@linux.ibm.com> (raw)

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


             reply	other threads:[~2025-07-24  0:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24  0:05 David Christensen [this message]
2025-07-24 11:05 ` [EXTERNAL] [PATCH] trace: force 8 byte alignment when --no-huge is used Jerin Jacob
2025-09-24 14:54   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250724000554.114087-1-drc@linux.ibm.com \
    --to=drc@linux.ibm.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=roretzla@linux.microsoft.com \
    --cc=skori@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.