On Fri, Oct 4, 2024 at 4:28 PM David Marchand <david.march...@redhat.com> wrote:
>
> On Wed, Oct 2, 2024 at 8:39 PM Stephen Hemminger
> <step...@networkplumber.org> wrote:
> >
> > Recent versions of GCC have some additional function attributes that can
> > help with DPDK performance and stability.
> >
> > The alloc_align attribute tells the compiler what the alignment
> > of the allocation will be, and the optimizer can use this to produce
> > better code (especially memcpy and structure copies).
> >
> > The malloc attribute tells compiler that object is not overlapping
> > and potentially aliasing. It also as an additional variant in GCC 11
> > or later that allows for detecting all sorts of common errors like
> > calling free() on memory allocated with rte_malloc().
> >
> > In order to use the malloc attribute the free function prototype
> > needs to be moved before the allocator/create function prototype
> > so that the malloc attribute can refer to it.
> >
> > This uncovered at least 16 pre-existing bugs in DPDK, these
> > should go to stable.  This patch set is structured with:
> >   - fix any new warnings that were discovered
> >   - add macros for enable the macros
> >   - enable the attributes
>
> It seems v7 lost the last patch that was introducing and using the
> annotations in rte_malloc.
> Was there an issue with this patch, or is it just a series submission issue?

Btw, reading gcc documentation, it seems the check is only enabled
with -fanalyzer.
Can we add this in the CI?

If we can't enable all of -fanalyzer checks, maybe go with a subset of
it, like -Wanalyzer-allocation-size
-Wanalyzer-mismatching-deallocation ?

-- 
David Marchand

Reply via email to