[dpdk-dev] [PATCH v2] Fix rte_is_power_of_2

Zhang, Helin helin.zhang at intel.com
Mon Jan 19 03:45:05 CET 2015


Hi Kerur

It seems that your fix result in cannot launching applications.
I don't suspect the correction of your fix, but somewhere else needs to be corrected together with your fix.

Logs:
/************************************************************
RING: Cannot reserve memory for tailq
EAL: rte_eal_common_log_init(): cannot create log_history mempool
PANIC in rte_eal_init():
Cannot init logs
6: [./l3fwd() [0x41d7c5]]
5: [/lib64/libc.so.6(__libc_start_main+0xf5) [0x3d8a221d65]]
4: [./l3fwd(main+0x23) [0x41c493]]
3: [./l3fwd(rte_eal_init+0x108d) [0x466f7d]]
2: [./l3fwd(__rte_panic+0xc9) [0x41c358]]
1: [./l3fwd(rte_dump_stack+0x18) [0x46e258]]

Regards,
Helin

> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Neil Horman
> Sent: Sunday, December 28, 2014 4:49 AM
> To: Ravi Kerur
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] Fix rte_is_power_of_2
> 
> On Sat, Dec 27, 2014 at 10:30:44AM -0500, Ravi Kerur wrote:
> > rte_is_power_of_2 returns true for 0 and 0 is not power_of_2. Fix by
> > checking for n.
> >
> > Signed-off-by: Ravi Kerur <rkerur at gmail.com>
> > ---
> >  lib/librte_eal/common/include/rte_common.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/common/include/rte_common.h
> > b/lib/librte_eal/common/include/rte_common.h
> > index 921b91f..8ac940c 100644
> > --- a/lib/librte_eal/common/include/rte_common.h
> > +++ b/lib/librte_eal/common/include/rte_common.h
> > @@ -203,7 +203,7 @@ extern int RTE_BUILD_BUG_ON_detected_error;
> > static inline int  rte_is_power_of_2(uint32_t n)  {
> > -	return ((n-1) & n) == 0;
> > +	return n && !(n & (n - 1));
> >  }
> >
> >  /**
> > --
> > 1.9.1
> >
> >
> Acked-by: Neil Horman <nhorman at tuxdriver.com>



More information about the dev mailing list