[dpdk-dev] [PATCH v5 3/4] devtools: prevent use of rte atomic APIs in future patches

Phil Yang Phil.Yang at arm.com
Mon Jun 29 07:38:54 CEST 2020


> -----Original Message-----
> From: Honnappa Nagarahalli <Honnappa.Nagarahalli at arm.com>
> Sent: Monday, June 29, 2020 12:38 PM
> To: Phil Yang <Phil.Yang at arm.com>; dev at dpdk.org
> Cc: mattias.ronnblom at ericsson.com; mb at smartsharesystems.com;
> stephen at networkplumber.org; thomas at monjalon.net;
> bruce.richardson at intel.com; ferruh.yigit at intel.com;
> hemant.agrawal at nxp.com; jerinj at marvell.com; ktraynor at redhat.com;
> konstantin.ananyev at intel.com; maxime.coquelin at redhat.com;
> olivier.matz at 6wind.com; harry.van.haaren at intel.com;
> erik.g.carrillo at intel.com; drc at linux.vnet.ibm.com;
> david.marchand at redhat.com; zhaoyan.chen at intel.com; Ola Liljedahl
> <Ola.Liljedahl at arm.com>; Ruifeng Wang <Ruifeng.Wang at arm.com>; Phil
> Yang <Phil.Yang at arm.com>; nd <nd at arm.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli at arm.com>; nd <nd at arm.com>
> Subject: RE: [PATCH v5 3/4] devtools: prevent use of rte atomic APIs in future
> patches
> 
> <snip>
> 
> > Subject: [PATCH v5 3/4] devtools: prevent use of rte atomic APIs in future
> > patches
> >
> > In order to deprecate the rte_atomic APIs, prevent the patches from using
> > rte_atomic APIs in the converted modules and compilers __sync built-ins in
> > all modules.
> >
> > The converted modules:
> > lib/librte_distributor
> > lib/librte_hash
> > lib/librte_kni
> > lib/librte_lpm
> > lib/librte_rcu
> > lib/librte_ring
> > lib/librte_stack
> > lib/librte_vhost
> > lib/librte_timer
> > lib/librte_ipsec
> > drivers/event/octeontx
> > drivers/event/octeontx2
> > drivers/event/opdl
> > drivers/net/bnx2x
> > drivers/net/hinic
> > drivers/net/hns3
> > drivers/net/memif
> > drivers/net/thunderx
> > drivers/net/virtio
> > examples/l2fwd-event
> >
> > On x86 the __atomic_thread_fence(__ATOMIC_SEQ_CST) is quite
> expensive
> > for SMP case. Flag the new code which use SEQ_CST memory ordering in
> > __atomic_thread_fence API.
> >
> > Signed-off-by: Phil Yang <phil.yang at arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>
> > Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
> > ---
> >  devtools/checkpatches.sh | 32 ++++++++++++++++++++++++++++++++
> >  1 file changed, 32 insertions(+)
> >
> > diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index
> > 158087f..5983f05 100755
> > --- a/devtools/checkpatches.sh
> > +++ b/devtools/checkpatches.sh
> > @@ -69,6 +69,38 @@ check_forbidden_additions() { # <patch>
> >  		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> >  		"$1" || res=1
> >
> > +	# refrain from new additions of 16/32/64 bits rte_atomic_xxx()
> > +	# multiple folders and expressions are separated by spaces
> > +	awk -v FOLDERS="lib/librte_distributor lib/librte_hash lib/librte_kni
> > +			lib/librte_lpm lib/librte_rcu lib/librte_ring
> > +			lib/librte_stack lib/librte_vhost
> > drivers/event/octeontx
> > +			drivers/event/octeontx2 drivers/event/opdl
> > +			drivers/net/bnx2x drivers/net/hinic drivers/net/hns3
> > +			drivers/net/memif drivers/net/thunderx
> > +			drivers/net/virtio examples/l2fwd-event" \
> > +		-v EXPRESSIONS="rte_atomic[0-9][0-9]_.*\\\(" \
> > +		-v RET_ON_FAIL=1 \
> > +		-v MESSAGE='Use of rte_atomicNN_xxx APIs not allowed,
> use
> > __atomic_xxx APIs' \
> > +		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> > +		"$1" || res=1
> > +
> > +	# refrain from using compiler __sync built-ins
> > +	awk -v FOLDERS="lib drivers app examples" \
> > +		-v EXPRESSIONS="__sync_.*\\\(" \
> > +		-v RET_ON_FAIL=1 \
> > +		-v MESSAGE='Use of __sync_xxx built-ins not allowed, use
> > __atomic_xxx APIs' \
> > +		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> > +		"$1" || res=1
> Can you please add rte_smp_*mb as well?

Sure. Will do.

Thanks,
Phil

> 
> > +
> > +	# refrain from using compiler
> > __atomic_thread_fence(__ATOMIC_SEQ_CST)
> > +	# It should be avoided on x86 for SMP case.
> > +	awk -v FOLDERS="lib drivers app examples" \
> > +		-v
> > EXPRESSIONS="__atomic_thread_fence\\\(__ATOMIC_SEQ_CST" \
> > +		-v RET_ON_FAIL=1 \
> > +		-v MESSAGE='Use of __atomic_thread_fence with SEQ_CST
> > ordering is not allowed, use rte_atomic_thread_fence' \
> > +		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> > +		"$1" || res=1
> > +
> >  	# svg figures must be included with wildcard extension
> >  	# because of png conversion for pdf docs
> >  	awk -v FOLDERS='doc' \
> > --
> > 2.7.4



More information about the dev mailing list