[PATCH v2] app/dma-perf: fix physical address seg-fault

Jerin Jacob jerinjacobk at gmail.com
Wed Oct 4 15:00:21 CEST 2023


On Wed, Oct 4, 2023 at 3:46 PM Varghese, Vipin <Vipin.Varghese at amd.com> wrote:
>
> [AMD Official Use Only - General]
>
> Hi Jerrin,
>
> Apologies for the delay, I missed on the comment
>
> ```
> >                 for (i = 0; i < nr_buf; i++) {
> > +                       void *src = rte_pktmbuf_mtod(dsts[i], void *);
> > +                       void *dst = rte_pktmbuf_mtod(srcs[i], void *);
>
> Use _const_ in fast path if src and dst in not changing as better optimization hint to compiler.
> ```
>
> Thanks for the suggestion, but may I ask this differently `rte_memcpy` is defined with `always_inline` and all places where src used is with `const *`. Hence I have different view there as `setting const * for always_inline definition has the same effect too`.

Yeah, most likely. However, Is the above behavior is documented in
gcc/clang? if not, the compiler is free to change as it deemed to fit
based on the register allocation and optimization flags etc.


More information about the dev mailing list