From: Jerin Jacob <jerinjacobk@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Marat Khalili <marat.khalili@huawei.com>,
Jerin Jacob <jerinj@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
Zhirun Yan <yanzhirun_163@163.com>,
dev@dpdk.org
Subject: Re: [PATCH 2/2] lib/graph: rte_malloc for cache-aligned structs
Date: Tue, 17 Jun 2025 19:46:11 +0530 [thread overview]
Message-ID: <CALBAE1MCqfhVvcfEY2R+m=FiBXpeznoktHnkGKkOVf4G+onjtA@mail.gmail.com> (raw)
In-Reply-To: <20250617062716.17e6b86e@hermes.local>
On Tue, Jun 17, 2025 at 7:07 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> On Tue, 17 Jun 2025 11:52:08 +0100
> Marat Khalili <marat.khalili@huawei.com> wrote:
>
> > This was flagged by undefined behaviour sanitizer: struct
> > rte_graph_cluster_stats is declared as `__rte_cache_aligned` but was
> > allocated using stdlib realloc which caused misaligned allocation. More
> > than one test needs to be executed in series in order to reproduce the
> > problem using graph_autotest, e.g:
> >
> > app/dpdk-test --no-huge --no-pci -m128 graph_autotest graph_autotest
> >
> > First sanitizer message (similar ones follow):
> >
> > lib/graph/graph_stats.c:209:13: runtime error: member access within
> > misaligned address 0x606000008ea0 for type 'struct
> > rte_graph_cluster_stats', which requires 64 byte alignment
> >
> > To fix the issue replace realloc calls with rte_malloc and rte_realloc
> > specifying correct alignment, use rte_free to free the result.
> >
> > Signed-off-by: Marat Khalili <marat.khalili@huawei.com>
>
> There is a way to get aligned memory,
>
> #include <stdlib.h>
>
> int posix_memalign(void **memptr, size_t alignment, size_t size);
> void *aligned_alloc(size_t alignment, size_t size);
There is a need for aligned realloc. I think it is not there in
standard libraries.
>
next prev parent reply other threads:[~2025-06-17 14:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 10:52 [PATCH 1/2] lib/graph: avoid memset(NULL, 0, 0) Marat Khalili
2025-06-17 10:52 ` [PATCH 2/2] lib/graph: rte_malloc for cache-aligned structs Marat Khalili
2025-06-17 12:46 ` Jerin Jacob
2025-06-17 13:27 ` Stephen Hemminger
2025-06-17 14:16 ` Jerin Jacob [this message]
2025-06-17 12:41 ` [PATCH 1/2] lib/graph: avoid memset(NULL, 0, 0) Jerin Jacob
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='CALBAE1MCqfhVvcfEY2R+m=FiBXpeznoktHnkGKkOVf4G+onjtA@mail.gmail.com' \
--to=jerinjacobk@gmail.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=marat.khalili@huawei.com \
--cc=ndabilpuram@marvell.com \
--cc=stephen@networkplumber.org \
--cc=yanzhirun_163@163.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).