[dpdk-dev] [PATCH] eal: avoid side effects in RTE_ALIGN_MUL_NEAR(v, mul) for v and mul

Tyler Retzlaff roretzla at linux.microsoft.com
Fri Mar 12 19:49:13 CET 2021


On Fri, Mar 12, 2021 at 09:07:22AM +0100, David Marchand wrote:
> On Thu, Mar 11, 2021 at 10:08 PM Tyler Retzlaff
> <roretzla at linux.microsoft.com> wrote:
> >
> > Avoid expanding v and mul parameters multiple times in the macro. based
> > on usage of the macro it seems like side effects were not intended.
> >
> > For example:
> >   ``return RTE_ALIGN_MUL_NEAR(rte_rdtsc() - start, CYC_PER_10MHZ);''
> 
> That's the beauty of macros.
> How about updating the unit tests so that this kind of issue is not
> reintroduced?

i would like to. if i can find time i will but i can't promise.

> 
> 
> Are other RTE_ALIGN_* macro affected with similar issues?
> Like mul expression passed to RTE_ALIGN_MUL_FLOOR and RTE_ALIGN_MUL_CEIL.

it is possible. i did look at a number of these macros while evaluating
something else but until i ran into this looking for side effects wasn't
on my radar.

> 
> 
> -- 
> David Marchand


More information about the dev mailing list