[v5,3/4] devtools: prevent use of rte atomic APIs in future patches
Checks
Commit Message
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@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
devtools/checkpatches.sh | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
Comments
<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@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@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?
> +
> + # 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
> -----Original Message-----
> From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Sent: Monday, June 29, 2020 12:38 PM
> To: Phil Yang <Phil.Yang@arm.com>; dev@dpdk.org
> Cc: mattias.ronnblom@ericsson.com; mb@smartsharesystems.com;
> stephen@networkplumber.org; thomas@monjalon.net;
> bruce.richardson@intel.com; ferruh.yigit@intel.com;
> hemant.agrawal@nxp.com; jerinj@marvell.com; ktraynor@redhat.com;
> konstantin.ananyev@intel.com; maxime.coquelin@redhat.com;
> olivier.matz@6wind.com; harry.van.haaren@intel.com;
> erik.g.carrillo@intel.com; drc@linux.vnet.ibm.com;
> david.marchand@redhat.com; zhaoyan.chen@intel.com; Ola Liljedahl
> <Ola.Liljedahl@arm.com>; Ruifeng Wang <Ruifeng.Wang@arm.com>; Phil
> Yang <Phil.Yang@arm.com>; nd <nd@arm.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; nd <nd@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@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@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
@@ -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
+
+ # 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' \