DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinj@marvell.com>
To: David Christensen <drc@linux.ibm.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Sunil Kumar Kori <skori@marvell.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: RE: [EXTERNAL] [PATCH] trace: force 8 byte alignment when --no-huge is used
Date: Thu, 24 Jul 2025 11:05:11 +0000	[thread overview]
Message-ID: <BY3PR18MB47852312E4B66F4EC22851DCC85EA@BY3PR18MB4785.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20250724000554.114087-1-drc@linux.ibm.com>



> -----Original Message-----
> From: David Christensen <drc@linux.ibm.com>
> Sent: Thursday, July 24, 2025 5:36 AM
> 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: [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 <drc@linux.ibm.com>


Acked-by: Jerin Jacob <jerinj@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


      reply	other threads:[~2025-07-24 11:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24  0:05 David Christensen
2025-07-24 11:05 ` Jerin Jacob [this message]

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=BY3PR18MB47852312E4B66F4EC22851DCC85EA@BY3PR18MB4785.namprd18.prod.outlook.com \
    --to=jerinj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.ibm.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 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).