ring clean up
cover ring clean up
Do some work for ring refactoring, which includes:
1. remove experimental tags
2. use element APIs to implement legacy APIs
Feifei Wang (3):
ring: remove experimental tag for ring reset API
ring: remove experimental tag for ring element APIs
ring: use element APIs to implement legacy APIs
lib/librte_ring/rte_ring.h | 292 +++------------------------ lib/librte_ring/rte_ring_elem.h | 8 - lib/librte_ring/rte_ring_version.map | 13 +- 3 files changed, 34 insertions(+), 279 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/3 ring: remove experimental tag for ring reset API
Remove the experimental tag for rte_ring_reset API that have been around for 4 releases.
--- lib/librte_ring/rte_ring.h | 3 --- lib/librte_ring/rte_ring_version.map | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-)
lib/librte_ring/rte_ring.h +0 -3
@@ -663,15 +663,12 @@ rte_ring_dequeue(struct rte_ring *r, void **obj_p)* * This function flush all the elements in a ring * -* @b EXPERIMENTAL: this API may change without prior notice -* * @warning * Make sure the ring is not in use while calling this function. * * @param r * A pointer to the ring structure. */ -__rte_experimental void rte_ring_reset (struct rte_ring *r);
lib/librte_ring/rte_ring_version.map +1 -3
@@ -8,6 +8,7 @@ DPDK_20.0 { rte_ring_init; rte_ring_list_dump; rte_ring_lookup; + rte_ring_reset; local: *; };
@@ -15,9 +16,6 @@ DPDK_20.0 { EXPERIMENTAL { global: - # added in 19.08 - rte_ring_reset; - # added in 20.02 rte_ring_create_elem; rte_ring_get_memsize_elem;
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 1/3] ring: remove experimental tag for ring reset API
Quoted 44 lines · Feifei Wang
Remove the experimental tag for
rte_ring_resetAPI that have been around for 4 releases.Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 3 --- lib/librte_ring/rte_ring_version.map | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-)lib/librte_ring/rte_ring.h +0
-3@@ -663,15 +663,12 @@ rte_ring_dequeue(struct rte_ring *r, void **obj_p)* * This function flush all the elements in a ring * -* @b EXPERIMENTAL: this API may change without prior notice -* * @warning * Make sure the ring is not in use while calling this function. * * @param r * A pointer to the ring structure. */ -__rte_experimental void rte_ring_reset (struct rte_ring *r);lib/librte_ring/rte_ring_version.map +1
-0@@ -8,6 +8,7 @@ DPDK_20.0 { rte_ring_init; rte_ring_list_dump; rte_ring_lookup; + rte_ring_reset; local: *; };
lib/librte_ring/rte_ring_version.map DPDK_20.0 { · line 21
Quoted 9 lines
lib/librte_ring/rte_ring_version.map +0
-3@@ -15,9 +16,6 @@ DPDK_20.0 { EXPERIMENTAL { global: - # added in 19.08 - rte_ring_reset; - # added in 20.02 rte_ring_create_elem; rte_ring_get_memsize_elem;
So strictly speaking, rte_ring_reset is part of the DPDK_21 ABI, not the v20.0 ABI.
The way to solve is to add it the DPDK_21 ABI in the map file.
And then use the VERSION_SYMBOL_EXPERIMENTAL to alias to experimental if necessary.
https://doc.dpdk.org/guides/contributing/abi_versioning.html#versioning-macros
Re: [dpdk-dev] [PATCH 1/3] ring: remove experimental tag for ring reset API
<snip>
Quoted 50 lines · Feifei Wang
Quoted 48 lines
Remove the experimental tag for
rte_ring_resetAPI that have been around for 4 releases.Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 3 --- lib/librte_ring/rte_ring_version.map | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-)lib/librte_ring/rte_ring.h +0
-3@@ -663,15 +663,12 @@ rte_ring_dequeue(struct rte_ring *r, void **obj_p)* * This function flush all the elements in a ring * -* @b EXPERIMENTAL: this API may change without prior notice -* * @warning * Make sure the ring is not in use while calling this function. * * @param r * A pointer to the ring structure. */ -__rte_experimental void rte_ring_reset (struct rte_ring *r);lib/librte_ring/rte_ring_version.map +1
-0@@ -8,6 +8,7 @@ DPDK_20.0 { rte_ring_init; rte_ring_list_dump; rte_ring_lookup; + rte_ring_reset; local: *; };@@ -15,9 +16,6 @@ DPDK_20.0 { EXPERIMENTAL { global:
Quoted 9 lines
lib/librte_ring/rte_ring_version.map DPDK_20.0 { · line 21
Quoted 6 lines
lib/librte_ring/rte_ring_version.map +0
-3- # added in 19.08 - rte_ring_reset; - # added in 20.02 rte_ring_create_elem; rte_ring_get_memsize_elem;So strictly speaking,
rte_ring_resetis part of theDPDK_21ABI, not the v20.0 ABI.
Thanks Ray for clarifying this.
Quoted 4 lines
The way to solve is to add it the
DPDK_21ABI in the map file. And then use theVERSION_SYMBOL_EXPERIMENTALto alias to experimental if necessary.
Is using VERSION_SYMBOL_EXPERIMENTAL a must? The documentation also seems to be vague. It says " The macro is used when a symbol matures to become part of the stable ABI, to provide an alias to experimental for some time". What does 'some time' mean?
Quoted 3 lines
https://doc.dpdk.org/guides/contributing/abi_versioning.html#versioning-
macros
Re: [dpdk-dev] [PATCH 1/3] ring: remove experimental tag for ring reset API
Quoted 61 lines · Honnappa Nagarahalli
<snip>
Quoted 50 lines · Feifei Wang
Quoted 48 lines
Remove the experimental tag for
rte_ring_resetAPI that have been around for 4 releases.Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 3 --- lib/librte_ring/rte_ring_version.map | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-)lib/librte_ring/rte_ring.h +0
-3@@ -663,15 +663,12 @@ rte_ring_dequeue(struct rte_ring *r, void **obj_p)* * This function flush all the elements in a ring * -* @b EXPERIMENTAL: this API may change without prior notice -* * @warning * Make sure the ring is not in use while calling this function. * * @param r * A pointer to the ring structure. */ -__rte_experimental void rte_ring_reset (struct rte_ring *r);lib/librte_ring/rte_ring_version.map +1
-0@@ -8,6 +8,7 @@ DPDK_20.0 { rte_ring_init; rte_ring_list_dump; rte_ring_lookup; + rte_ring_reset; local: *; };@@ -15,9 +16,6 @@ DPDK_20.0 { EXPERIMENTAL { global:Quoted 9 lines
lib/librte_ring/rte_ring_version.map DPDK_20.0 { · line 21
Quoted 6 lines
lib/librte_ring/rte_ring_version.map +0
-3- # added in 19.08 - rte_ring_reset; - # added in 20.02 rte_ring_create_elem; rte_ring_get_memsize_elem;So strictly speaking,
rte_ring_resetis part of theDPDK_21ABI, not the v20.0 ABI.
Quoted 7 lines
Thanks Ray for clarifying this.
Quoted 4 lines
The way to solve is to add it the
DPDK_21ABI in the map file. And then use theVERSION_SYMBOL_EXPERIMENTALto alias to experimental if necessary.Is using
VERSION_SYMBOL_EXPERIMENTALa must?
Purely at the discretion of the contributor and maintainer.
If it has been around for a while, applications are using it and changing the symbol will break them.
You may choose to provide the alias or not.
Quoted 1 line
The documentation also seems to be vague. It says " The macro is used when a symbol matures to become part of the stable ABI, to provide an alias to experimental for some time". What does 'some time' mean?
"Some time" is a bit vague alright, should be "until the next major ABI version" - I will fix.
Quoted 4 lines
Quoted 4 lines
https://doc.dpdk.org/guides/contributing/abi_versioning.html#versioning-
macros
Re: [dpdk-dev] [PATCH 1/3] ring: remove experimental tag for ring reset API
Quoted 29 lines
-----Original Message-----
From: Kinsella, Ray <[email protected]>
Sent: 2020年7月6日 14:23
To: Honnappa Nagarahalli <[email protected]>; Feifei Wang <[email protected]>; Konstantin Ananyev <[email protected]>; Neil Horman <[email protected]>
Cc: [email protected]; nd <[email protected]>
Subject: Re: [PATCH 1/3] ring: remove experimental tag for ring reset APIQuoted 15 lines · Honnappa Nagarahalli
<snip>
Quoted 13 lines · Feifei Wang
Quoted 11 lines
Remove the experimental tag for
rte_ring_resetAPI that have been around for 4 releases.Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 3 --- lib/librte_ring/rte_ring_version.map | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-)
Quoted 49 lines
Quoted 5 lines
Quoted 5 lines
lib/librte_ring/rte_ring.h rte_ring_dequeue(struct rte_ring *r, void
Quoted 5 lines
lib/librte_ring/rte_ring.h +0
-0@@ -663,15 +663,12 @@ rte_ring_dequeue(struct rte_ring *r, void**obj_p)
Quoted 43 lines
Quoted 32 lines
Quoted 32 lines
lib/librte_ring/rte_ring.h +0
-3* * This function flush all the elements in a ring * -* @b EXPERIMENTAL: this API may change without prior notice -* * @warning * Make sure the ring is not in use while calling this function. * * @param r * A pointer to the ring structure. */ -__rte_experimental void rte_ring_reset (struct rte_ring *r);lib/librte_ring/rte_ring_version.map +1
-0@@ -8,6 +8,7 @@ DPDK_20.0 { rte_ring_init; rte_ring_list_dump; rte_ring_lookup; + rte_ring_reset; local: *; };@@ -15,9 +16,6 @@ DPDK_20.0 { EXPERIMENTAL { global:Quoted 9 lines
lib/librte_ring/rte_ring_version.map DPDK_20.0 { · line 21
Quoted 6 lines
lib/librte_ring/rte_ring_version.map +0
-3- # added in 19.08 - rte_ring_reset; - # added in 20.02 rte_ring_create_elem; rte_ring_get_memsize_elem;So strictly speaking,
rte_ring_resetis part of theDPDK_21ABI, not the v20.0 ABI.Thanks Ray for clarifying this.
Thanks very much for pointing this.
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
The way to solve is to add it the
DPDK_21ABI in the map file. And then use theVERSION_SYMBOL_EXPERIMENTALto alias toexperimental
Quoted 8 lines
Quoted 2 lines
Quoted 1 line
if necessary.
Is using
VERSION_SYMBOL_EXPERIMENTALa must?Purely at the discretion of the contributor and maintainer.
If it has been around for a while, applications are using it and changing the symbol will break them.You may choose to provide the alias or not.
Ok, in the new patch version, I will add it into the DPDK_21 ABI but the VERSION_SYMBOL_EXPERIMENTAL will not be added, because if it is added in this version, it is still needed to be removed in the near future.
Thanks very much for your review.
Quoted 13 lines
Quoted 2 lines
The documentation also seems to be vague. It says " The macro is used
when a symbol matures to become part of the stable ABI, to provide an alias to experimental for some time". What does 'some time' mean?
"Some time" is a bit vague alright, should be "until the next major ABI version" - I will fix.
Quoted 5 lines
Quoted 5 lines
https://doc.dpdk.org/guides/contributing/abi_versioning.html#versioni
ng-
macros
Re: [dpdk-dev] [PATCH 1/3] ring: remove experimental tag for ring reset API
Quoted 90 lines · Feifei Wang
Quoted 29 lines
-----Original Message-----
From: Kinsella, Ray <[email protected]>
Sent: 2020年7月6日 14:23
To: Honnappa Nagarahalli <[email protected]>; Feifei Wang <[email protected]>; Konstantin Ananyev <[email protected]>; Neil Horman <[email protected]>
Cc: [email protected]; nd <[email protected]>
Subject: Re: [PATCH 1/3] ring: remove experimental tag for ring reset APIQuoted 15 lines · Honnappa Nagarahalli
<snip>
Quoted 13 lines · Feifei Wang
Quoted 11 lines
Remove the experimental tag for
rte_ring_resetAPI that have been around for 4 releases.Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 3 --- lib/librte_ring/rte_ring_version.map | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-)Quoted 49 lines
Quoted 5 lines
Quoted 5 lines
lib/librte_ring/rte_ring.h rte_ring_dequeue(struct rte_ring *r, void
Quoted 5 lines
lib/librte_ring/rte_ring.h +0
-0@@ -663,15 +663,12 @@ rte_ring_dequeue(struct rte_ring *r, void**obj_p)
Quoted 43 lines
Quoted 32 lines
Quoted 32 lines
lib/librte_ring/rte_ring.h +0
-3* * This function flush all the elements in a ring * -* @b EXPERIMENTAL: this API may change without prior notice -* * @warning * Make sure the ring is not in use while calling this function. * * @param r * A pointer to the ring structure. */ -__rte_experimental void rte_ring_reset (struct rte_ring *r);lib/librte_ring/rte_ring_version.map +1
-0@@ -8,6 +8,7 @@ DPDK_20.0 { rte_ring_init; rte_ring_list_dump; rte_ring_lookup; + rte_ring_reset; local: *; };@@ -15,9 +16,6 @@ DPDK_20.0 { EXPERIMENTAL { global:Quoted 9 lines
lib/librte_ring/rte_ring_version.map DPDK_20.0 { · line 21
Quoted 6 lines
lib/librte_ring/rte_ring_version.map +0
-3- # added in 19.08 - rte_ring_reset; - # added in 20.02 rte_ring_create_elem; rte_ring_get_memsize_elem;So strictly speaking,
rte_ring_resetis part of theDPDK_21ABI, not the v20.0 ABI.Thanks Ray for clarifying this.
Thanks very much for pointing this.
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
The way to solve is to add it the
DPDK_21ABI in the map file. And then use theVERSION_SYMBOL_EXPERIMENTALto alias toexperimental
Quoted 2 lines
Quoted 1 line
if necessary.
Is using
VERSION_SYMBOL_EXPERIMENTALa must?Purely at the discretion of the contributor and maintainer.
If it has been around for a while, applications are using it and changing the symbol will break them.
Quoted 6 lines
Quoted 1 line
You may choose to provide the alias or not.
Ok, in the new patch version, I will add it into the
DPDK_21ABI but theVERSION_SYMBOL_EXPERIMENTALwill not be added, because if it is added in this version, it is still needed to be removed in the near future.Thanks very much for your review.
That is 100%
Quoted 13 lines
Quoted 13 lines
Quoted 2 lines
The documentation also seems to be vague. It says " The macro is used
when a symbol matures to become part of the stable ABI, to provide an alias to experimental for some time". What does 'some time' mean?
"Some time" is a bit vague alright, should be "until the next major ABI version" - I will fix.
Quoted 5 lines
Quoted 5 lines
https://doc.dpdk.org/guides/contributing/abi_versioning.html#versioni
ng-
macros
PATCH 2/3 ring: remove experimental tag for ring element APIs
In reply to Feifei WangRemove the experimental tag for rte_ring_xxx_elem APIs that have been around for 2 releases.
--- lib/librte_ring/rte_ring.h | 5 +---- lib/librte_ring/rte_ring_elem.h | 8 -------- lib/librte_ring/rte_ring_version.map | 9 ++------- 3 files changed, 3 insertions(+), 19 deletions(-)
lib/librte_ring/rte_ring.h +1 -4
@@ -40,6 +40,7 @@ extern "C" {#endif #include <rte_ring_core.h> +#include <rte_ring_elem.h> /** * Calculate the memory size needed for a ring
@@ -401,10 +402,6 @@ rte_ring_sp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, RTE_RING_SYNC_ST, free_space); } -#ifdef ALLOW_EXPERIMENTAL_API -#include <rte_ring_elem.h> -#endif -/** * Enqueue several objects on a ring. *
lib/librte_ring/rte_ring_elem.h +0 -8
@@ -23,9 +23,6 @@ extern "C" {#include <rte_ring_core.h> /** -* @warning -* @b EXPERIMENTAL: this API may change without prior notice -* * Calculate the memory size needed for a ring with given element size * * This function returns the number of bytes needed for a ring, given
@@ -43,13 +40,9 @@ extern "C" {* - -EINVAL - esize is not a multiple of 4 or count provided is not a * power of 2. */ -__rte_experimental ssize_t rte_ring_get_memsize_elem (unsigned int esize,unsigned int count);/** -* @warning -* @b EXPERIMENTAL: this API may change without prior notice -* * Create a new ring named *name* that stores elements with given size. * * This function uses ``memzone_reserve()`` to allocate memory. Then it
@@ -109,7 +102,6 @@ ssize_t rte_ring_get_memsize_elem(unsigned int esize, unsigned int count);* - EEXIST - a memzone with the same name already exists * - ENOMEM - no appropriate memory area found in which to create memzone */ -__rte_experimental struct rte_ring *rte_ring_create_elem (const char *name,unsigned int esize,unsigned int count,int socket_id,unsigned int flags);
lib/librte_ring/rte_ring_version.map +2 -7
@@ -2,9 +2,11 @@ DPDK_20.0 { global: rte_ring_create; + rte_ring_create_elem; rte_ring_dump; rte_ring_free; rte_ring_get_memsize; + rte_ring_get_memsize_elem; rte_ring_init; rte_ring_list_dump; rte_ring_lookup;
@@ -13,10 +15,3 @@ DPDK_20.0 { local: *; }; -EXPERIMENTAL { - global: - - # added in 20.02 - rte_ring_create_elem; - rte_ring_get_memsize_elem; -};
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 2/3] ring: remove experimental tag for ring element APIs
Quoted 89 lines · Feifei Wang
Remove the experimental tag for
rte_ring_xxx_elemAPIs that have been around for 2 releases.Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 5 +---- lib/librte_ring/rte_ring_elem.h | 8 -------- lib/librte_ring/rte_ring_version.map | 9 ++------- 3 files changed, 3 insertions(+), 19 deletions(-)lib/librte_ring/rte_ring.h +1
-4@@ -40,6 +40,7 @@ extern "C" {#endif #include <rte_ring_core.h> +#include <rte_ring_elem.h> /** * Calculate the memory size needed for a ring @@ -401,10 +402,6 @@ rte_ring_sp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, RTE_RING_SYNC_ST, free_space); } -#ifdef ALLOW_EXPERIMENTAL_API -#include <rte_ring_elem.h> -#endif -/** * Enqueue several objects on a ring. * lib/librte_ring/rte_ring_elem.h +0
-8@@ -23,9 +23,6 @@ extern "C" {#include <rte_ring_core.h> /** -* @warning -* @b EXPERIMENTAL: this API may change without prior notice -* * Calculate the memory size needed for a ring with given element size * * This function returns the number of bytes needed for a ring, given @@ -43,13 +40,9 @@ extern "C" {* - -EINVAL - esize is not a multiple of 4 or count provided is not a * power of 2. */ -__rte_experimental ssize_t rte_ring_get_memsize_elem (unsigned int esize,unsigned int count);/** -* @warning -* @b EXPERIMENTAL: this API may change without prior notice -* * Create a new ring named *name* that stores elements with given size. * * This function uses ``memzone_reserve()`` to allocate memory. Then it @@ -109,7 +102,6 @@ ssize_t rte_ring_get_memsize_elem(unsigned int esize, unsigned int count);* - EEXIST - a memzone with the same name already exists * - ENOMEM - no appropriate memory area found in which to create memzone */ -__rte_experimental struct rte_ring *rte_ring_create_elem (const char *name,unsigned int esize,unsigned int count,int socket_id,unsigned int flags);lib/librte_ring/rte_ring_version.map +2
-0@@ -2,9 +2,11 @@ DPDK_20.0 { global: rte_ring_create; + rte_ring_create_elem; rte_ring_dump; rte_ring_free; rte_ring_get_memsize; + rte_ring_get_memsize_elem; rte_ring_init; rte_ring_list_dump; rte_ring_lookup;
lib/librte_ring/rte_ring_version.map DPDK_20.0 { · line 22
Quoted 10 lines
lib/librte_ring/rte_ring_version.map +0
-7@@ -13,10 +15,3 @@ DPDK_20.0 { local: *; }; -EXPERIMENTAL { - global: - - # added in 20.02 - rte_ring_create_elem; - rte_ring_get_memsize_elem; -};
Same as the last comment.Rte_ring_get_memsize_elem and rte_ring_create_elem are part of the DPDK_21 ABI.
Ray K
Re: [dpdk-dev] [PATCH 2/3] ring: remove experimental tag for ring element APIs
In reply to Feifei WangQuoted 8 lines
Remove the experimental tag for
rte_ring_xxx_elemAPIs that have been around for 2 releases.Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>---
Quoted 1 line
2.17.1
PATCH 3/3 ring: use element APIs to implement legacy APIs
In reply to Feifei WangUse rte_ring_xxx_elem_xxx APIs to replace legacy API implementation. This reduces code duplication and improves code maintenance.
aarch64:
HW:N1sdp, 1 socket, 4 cores, 1 thread/core, 2.6GHz OS:Ubuntu 18.04.1 LTS, Kernel: 5.4.0+
DPDK: 20.05-rc3, Configuration: arm64-n1sdp-linux-gcc gcc:9.2.1
$sudo ./arm64-n1sdp-linux-gcc/app/test -l 1-2
RTE>>ring_perf_autotest
test results on aarch64 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 1.11 1.10
legacy APIs: SP/SC: burst (size: 32): 1.95 1.97
legacy APIs: MP/MC: burst (size: 8): 1.86 1.94
legacy APIs: MP/MC: burst (size: 32): 2.65 2.69
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 1.08 1.09
legacy APIs: SP/SC: bulk (size: 32): 1.89 1.90
legacy APIs: MP/MC: bulk (size: 8): 1.85 1.98
legacy APIs: MP/MC: bulk (size: 32): 2.65 2.69
x86:
HW: dell, CPU Intel(R) Xeon(R) Gold 6240, 2 sockets, 18 cores/socket, 1 thread/core, 3.3GHz
OS: Ubuntu 20.04 LTS, Kernel: 5.4.0-37-generic
DPDK: 20.05-rc3, Configuration: x86_64-native-linuxapp-gcc
gcc: 9.3.0
$sudo ./x86_64-native-linuxapp-gcc/app/test -l 14,16 RTE>>ring_perf_autotest
test results on x86 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 29.35 27.78
legacy APIs: SP/SC: burst (size: 32): 73.11 73.39
legacy APIs: MP/MC: burst (size: 8): 62.36 62.37
legacy APIs: MP/MC: burst (size: 32): 101.01 101.03
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 25.94 29.55
legacy APIs: SP/SC: bulk (size: 32): 70.00 78.87
legacy APIs: MP/MC: bulk (size: 8): 63.41 62.48
legacy APIs: MP/MC: bulk (size: 32): 105.86 103.84
Summary:
In aarch64 server with this patch, there is almost no performance difference.
In x86 server with this patch, in some cases, the performance slightly improve, in other cases, the performance slightly drop.
--- lib/librte_ring/rte_ring.h | 284 ++++--------------------------------- 1 file changed, 30 insertions(+), 254 deletions(-)
lib/librte_ring/rte_ring.h +30 -254
@@ -191,168 +191,6 @@ void rte_ring_free(struct rte_ring *r);*/ void rte_ring_dump (FILE *f,const struct rte_ring *r); -/* the actual enqueue of pointers on the ring. -* Placed here since identical code needed in both -* single and multi producer enqueue functions */ -#define ENQUEUE_PTRS (r, ring_start, prod_head, obj_table, n, obj_type) do { \ - unsigned int i; \ - const uint32_t size = (r)->size; \ - uint32_t idx = prod_head & (r)->mask; \ - obj_type *ring = (obj_type *)ring_start; \ - if (likely(idx + n < size)) { \ - for (i = 0; i < (n & ~0x3); i += 4, idx += 4) { \ - ring[idx] = obj_table[i]; \ - ring[idx + 1] = obj_table[i + 1]; \ - ring[idx + 2] = obj_table[i + 2]; \ - ring[idx + 3] = obj_table[i + 3]; \ - } \ - switch (n & 0x3) { \ - case 3: \ - ring[idx++] = obj_table[i++];/* fallthrough */ \ -case 2 : \ - ring[idx++] = obj_table[i++];/* fallthrough */ \ -case 1 : \ - ring[idx++] = obj_table[i++]; \ - } \ - } else { \ -for (i =0 ; idx < size; i++, idx++)\ - ring[idx] = obj_table[i]; \ -for (idx =0 ; i < n; i++, idx++) \ - ring[idx] = obj_table[i]; \ - } \ -} while (0) - -/* the actual copy of pointers on the ring to obj_table. -* Placed here since identical code needed in both - * single and multi consumer dequeue functions */ -#define DEQUEUE_PTRS (r, ring_start, cons_head, obj_table, n, obj_type) do { \ - unsigned int i; \ - uint32_t idx = cons_head & (r)->mask; \ - const uint32_t size = (r)->size; \ - obj_type *ring = (obj_type *)ring_start; \ - if (likely(idx + n < size)) { \ - for (i = 0; i < (n & ~0x3); i += 4, idx += 4) {\ - obj_table[i] = ring[idx]; \ - obj_table[i + 1] = ring[idx + 1]; \ - obj_table[i + 2] = ring[idx + 2]; \ - obj_table[i + 3] = ring[idx + 3]; \ - } \ - switch (n & 0x3) { \ - case 3: \ - obj_table[i++] = ring[idx++];/* fallthrough */ \ -case 2 : \ - obj_table[i++] = ring[idx++];/* fallthrough */ \ -case 1 : \ - obj_table[i++] = ring[idx++]; \ - } \ - } else { \ -for (i =0 ; idx < size; i++, idx++) \ - obj_table[i] = ring[idx]; \ -for (idx =0 ; i < n; i++, idx++) \ - obj_table[i] = ring[idx]; \ - } \ -} while (0) - -/* Between load and load. there might be cpu reorder in weak model -* (powerpc/arm). -* There are 2 choices for the users -* 1.use rmb() memory barrier -* 2.use one-direction load_acquire/store_release barrier,defined by -* CONFIG_RTE_USE_C11_MEM_MODEL=y -* It depends on performance test results. -* By default, move common functions to rte_ring_generic.h - */ -#ifdef RTE_USE_C11_MEM_MODEL -#include "rte_ring_c11_mem.h" -#else -#include "rte_ring_generic.h" -#endif - -/** -* @internal Enqueue several objects on the ring -* -* @param r -* A pointer to the ring structure. -* @param obj_table -* A pointer to a table of void * pointers (objects). -* @param n -* The number of objects to add in the ring from the obj_table. -* @param behavior -* RTE_RING_QUEUE_FIXED: Enqueue a fixed number of items from a ring -* RTE_RING_QUEUE_VARIABLE: Enqueue as many items as possible from ring -* @param is_sp -* Indicates whether to use single producer or multi-producer head update -* @param free_space -* returns the amount of space after the enqueue operation has finished -* @return -* Actual number of objects enqueued. -* If behavior == RTE_RING_QUEUE_FIXED, this will be 0 or n only. -*/ -static __rte_always_inline unsigned int -__rte_ring_do_enqueue (struct rte_ring *r,void *const *obj_table, -unsigned int n,enum rte_ring_queue_behavior behavior, -unsigned int is_sp,unsigned int *free_space) -{ -uint32_t prod_head, prod_next; -uint32_t free_entries; - - n =__rte_ring_move_prod_head (r, is_sp, n, behavior, - &prod_head, &prod_next, &free_entries); -if (n ==0 ) - goto end; - - ENQUEUE_PTRS(r, &r[1], prod_head, obj_table, n, void *); - -update_tail (&r->prod, prod_head, prod_next, is_sp,1 ); -end: -if (free_space !=NULL ) - *free_space = free_entries - n; -return n; -} - -/** -* @internal Dequeue several objects from the ring -* -* @param r -* A pointer to the ring structure. -* @param obj_table -* A pointer to a table of void * pointers (objects). -* @param n -* The number of objects to pull from the ring. -* @param behavior -* RTE_RING_QUEUE_FIXED: Dequeue a fixed number of items from a ring -* RTE_RING_QUEUE_VARIABLE: Dequeue as many items as possible from ring -* @param is_sc -* Indicates whether to use single consumer or multi-consumer head update -* @param available -* returns the number of remaining ring entries after the dequeue has finished -* @return -* - Actual number of objects dequeued. -* If behavior == RTE_RING_QUEUE_FIXED, this will be 0 or n only. -*/ -static __rte_always_inline unsigned int -__rte_ring_do_dequeue (struct rte_ring *r,void **obj_table, -unsigned int n,enum rte_ring_queue_behavior behavior, -unsigned int is_sc,unsigned int *available) -{ -uint32_t cons_head, cons_next; -uint32_t entries; - - n =__rte_ring_move_cons_head (r, (int )is_sc, n, behavior, - &cons_head, &cons_next, &entries); -if (n ==0 ) - goto end; - - DEQUEUE_PTRS(r, &r[1], cons_head, obj_table, n, void *); - -update_tail (&r->cons, cons_head, cons_next, is_sc,0 ); - -end: -if (available !=NULL ) - *available = entries - n; -return n; -} -/** * Enqueue several objects on the ring (multi-producers safe). *
@@ -375,8 +213,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, RTE_RING_QUEUE_FIXED, - RTE_RING_SYNC_MT, free_space); + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/**
@@ -398,8 +236,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, RTE_RING_QUEUE_FIXED, - RTE_RING_SYNC_ST, free_space); + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/**
@@ -425,24 +263,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - switch (r->prod.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_bulk (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mp_rts_enqueue_bulk (r, obj_table, n, - free_space); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mp_hts_enqueue_bulk (r, obj_table, n, - free_space); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; + return rte_ring_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/**
@@ -462,7 +284,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table, static __rte_always_inline intrte_ring_mp_enqueue (struct rte_ring *r,void *obj) { -return rte_ring_mp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_mp_enqueue_elem (r, obj,sizeof (void *)); }/**
@@ -479,7 +301,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline intrte_ring_sp_enqueue (struct rte_ring *r,void *obj) { -return rte_ring_sp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_sp_enqueue_elem (r, obj,sizeof (void *)); }/**
@@ -500,7 +322,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline intrte_ring_enqueue (struct rte_ring *r,void *obj) { -return rte_ring_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_enqueue_elem (r, obj,sizeof (void *)); }/**
@@ -525,8 +347,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, RTE_RING_QUEUE_FIXED, - RTE_RING_SYNC_MT, available); + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }/**
@@ -549,8 +371,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, RTE_RING_QUEUE_FIXED, - RTE_RING_SYNC_ST, available); + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }/**
@@ -576,22 +398,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - switch (r->cons.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_bulk (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mc_rts_dequeue_bulk (r, obj_table, n, available); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mc_hts_dequeue_bulk (r, obj_table, n, available); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; + return rte_ring_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }/**
@@ -612,7 +420,7 @@ rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, static __rte_always_inline intrte_ring_mc_dequeue (struct rte_ring *r,void **obj_p) { -return rte_ring_mc_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_mc_dequeue_elem (r, obj_p,sizeof (void *)); }/**
@@ -630,7 +438,7 @@ rte_ring_mc_dequeue(struct rte_ring *r, void **obj_p) static __rte_always_inline intrte_ring_sc_dequeue (struct rte_ring *r,void **obj_p) { -return rte_ring_sc_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_sc_dequeue_elem (r, obj_p,sizeof (void *)); }/**
@@ -652,7 +460,7 @@ rte_ring_sc_dequeue(struct rte_ring *r, void **obj_p) static __rte_always_inline intrte_ring_dequeue (struct rte_ring *r,void **obj_p) { -return rte_ring_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_dequeue_elem (r, obj_p,sizeof (void *)); }/**
@@ -860,8 +668,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, free_space); + return rte_ring_mp_enqueue_burst_elem(r, obj_table, sizeof(void *), + n, free_space); }/**
@@ -883,8 +691,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, free_space); + return rte_ring_sp_enqueue_burst_elem(r, obj_table, sizeof(void *), + n, free_space); }/**
@@ -910,24 +718,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - switch (r->prod.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_burst (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mp_rts_enqueue_burst (r, obj_table, n, - free_space); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mp_hts_enqueue_burst (r, obj_table, n, - free_space); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; + return rte_ring_enqueue_burst_elem(r, obj_table, sizeof(void *), + n, free_space); }/**
@@ -954,8 +746,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, available); + return rte_ring_mc_dequeue_burst_elem(r, obj_table, sizeof(void *), + n, available); }/**
@@ -979,8 +771,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, available); + return rte_ring_sc_dequeue_burst_elem(r, obj_table, sizeof(void *), + n, available); }/**
@@ -1006,24 +798,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - switch (r->cons.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mc_dequeue_burst(r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_burst (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mc_rts_dequeue_burst (r, obj_table, n, - available); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mc_hts_dequeue_burst (r, obj_table, n, - available); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; + return rte_ring_dequeue_burst_elem(r, obj_table, sizeof(void *), + n, available); }#ifdef __cplusplus
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 3/3] ring: use element APIs to implement legacy APIs
Hi, Konstantin, David
I'm Feifei Wang from Arm. Sorry to make the following request:
Would you please do some ring performance tests of this patch in your platforms at the time you are free? And I want to know whether this patch has a significant impact on other platforms except ARM.
Thanks very much.
Feifei
Quoted 500 lines
-----Original Message-----
From: Feifei Wang <[email protected]>
Sent: 2020年7月3日 18:27
To: Honnappa Nagarahalli <[email protected]>; Konstantin Ananyev <[email protected]>
Cc: [email protected]; nd <[email protected]>; Feifei Wang <[email protected]>
Subject: [PATCH 3/3] ring: use element APIs to implement legacy APIsUse
rte_ring_xxx_elem_xxxAPIs to replace legacy API implementation. This reduces code duplication and improves code maintenance.aarch64:
HW:N1sdp, 1 socket, 4 cores, 1 thread/core, 2.6GHz OS:Ubuntu 18.04.1 LTS,
Kernel: 5.4.0+
DPDK: 20.05-rc3, Configuration: arm64-n1sdp-linux-gcc gcc:9.2.1$sudo ./arm64-n1sdp-linux-gcc/app/test -l 1-2
RTE>>ring_perf_autotesttest results on aarch64 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 1.11 1.10
legacy APIs: SP/SC: burst (size: 32): 1.95 1.97
legacy APIs: MP/MC: burst (size: 8): 1.86 1.94
legacy APIs: MP/MC: burst (size: 32): 2.65 2.69
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 1.08 1.09
legacy APIs: SP/SC: bulk (size: 32): 1.89 1.90
legacy APIs: MP/MC: bulk (size: 8): 1.85 1.98
legacy APIs: MP/MC: bulk (size: 32): 2.65 2.69x86:
HW: dell, CPU Intel(R) Xeon(R) Gold 6240, 2 sockets, 18 cores/socket, 1 thread/core, 3.3GHz
OS: Ubuntu 20.04 LTS, Kernel: 5.4.0-37-generic
DPDK: 20.05-rc3, Configuration: x86_64-native-linuxapp-gcc
gcc: 9.3.0$sudo ./x86_64-native-linuxapp-gcc/app/test -l 14,16 RTE>>ring_perf_autotest
test results on x86 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 29.35 27.78
legacy APIs: SP/SC: burst (size: 32): 73.11 73.39
legacy APIs: MP/MC: burst (size: 8): 62.36 62.37
legacy APIs: MP/MC: burst (size: 32): 101.01 101.03
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 25.94 29.55
legacy APIs: SP/SC: bulk (size: 32): 70.00 78.87
legacy APIs: MP/MC: bulk (size: 8): 63.41 62.48
legacy APIs: MP/MC: bulk (size: 32): 105.86 103.84Summary:
In aarch64 server with this patch, there is almost no performance difference. In x86 server with this patch, in some cases, the performance slightly improve, in other cases, the performance slightly drop.Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 284 ++++--------------------------------- 1 file changed, 30 insertions(+), 254 deletions(-)lib/librte_ring/rte_ring.h index renamed from lib/librte_ring/rte_ring.h +0
-0
35f3f8c42..2a2190bfc100644lib/librte_ring/rte_ring.h +0
-86@@ -191,168 +191,6 @@ void rte_ring_free(struct rte_ring *r);*/ void rte_ring_dump (FILE *f,const struct rte_ring *r); -/* the actual enqueue of pointers on the ring. -* Placed here since identical code needed in both - * single and multi producer enqueue functions */ -#define ENQUEUE_PTRS(r, ring_start, prod_head, obj_table, n, obj_type) do { \ - unsigned int i; \ - const uint32_t size = (r)->size; \ - uint32_t idx = prod_head & (r)->mask; \ - obj_type *ring = (obj_type *)ring_start; \ - if (likely(idx + n < size)) { \ - for (i = 0; i < (n & ~0x3); i += 4, idx += 4) { \ - ring[idx] = obj_table[i]; \ - ring[idx + 1] = obj_table[i + 1]; \ - ring[idx + 2] = obj_table[i + 2]; \ - ring[idx + 3] = obj_table[i + 3]; \ - } \ - switch (n & 0x3) { \ - case 3: \ - ring[idx++] = obj_table[i++];/* fallthrough */ \ -case 2 : \ - ring[idx++] = obj_table[i++];/* fallthrough */ \ -case 1 : \ - ring[idx++] = obj_table[i++]; \ - } \ - } else { \ -for (i =0 ; idx < size; i++, idx++)\ - ring[idx] = obj_table[i]; \ -for (idx =0 ; i < n; i++, idx++) \ - ring[idx] = obj_table[i]; \ - } \ -} while (0) - -/* the actual copy of pointers on the ring to obj_table. - * Placed here since identical code needed in both - * single and multi consumer dequeue functions */ -#define DEQUEUE_PTRS(r, ring_start, cons_head, obj_table, n, obj_type) do { \ - unsigned int i; \ - uint32_t idx = cons_head & (r)->mask; \ - const uint32_t size = (r)->size; \ - obj_type *ring = (obj_type *)ring_start; \ - if (likely(idx + n < size)) { \ - for (i = 0; i < (n & ~0x3); i += 4, idx += 4) {\ - obj_table[i] = ring[idx]; \ - obj_table[i + 1] = ring[idx + 1]; \ - obj_table[i + 2] = ring[idx + 2]; \ - obj_table[i + 3] = ring[idx + 3]; \ - } \ - switch (n & 0x3) { \ - case 3: \ - obj_table[i++] = ring[idx++];/* fallthrough */ \ -case 2 : \ - obj_table[i++] = ring[idx++];/* fallthrough */ \ -case 1 : \ - obj_table[i++] = ring[idx++]; \ - } \ - } else { \ -for (i =0 ; idx < size; i++, idx++) \ - obj_table[i] = ring[idx]; \ -for (idx =0 ; i < n; i++, idx++) \ - obj_table[i] = ring[idx]; \ - } \ -} while (0) - -/* Between load and load. there might be cpu reorder in weak model -* (powerpc/arm). -* There are 2 choices for the users -* 1.use rmb() memory barrier -* 2.use one-direction load_acquire/store_release barrier,defined by -* CONFIG_RTE_USE_C11_MEM_MODEL=y -* It depends on performance test results. -* By default, move common functions to rte_ring_generic.h - */ -#ifdef RTE_USE_C11_MEM_MODEL -#include "rte_ring_c11_mem.h" -#else -#include "rte_ring_generic.h" -#endif - -/** -* @internal Enqueue several objects on the ring -* -* @param r -* A pointer to the ring structure. -* @param obj_table -* A pointer to a table of void * pointers (objects). -* @param n -* The number of objects to add in the ring from the obj_table. -* @param behavior -* RTE_RING_QUEUE_FIXED: Enqueue a fixed number of items from a ring
- *RTE_RING_QUEUE_VARIABLE: Enqueue as many items as possible from
ring
- * @paramis_sp
- * Indicates whether to use single producer or multi-producer head update
- * @paramfree_space
- * returns the amount of space after the enqueue operation has finished
- * @return
- * Actual number of objects enqueued.
- * If behavior ==RTE_RING_QUEUE_FIXED, this will be 0 or n only.
- */
-static__rte_always_inlineunsigned int -__rte_ring_do_enqueue(structrte_ring*r, void * const*obj_table,lib/librte_ring/rte_ring.h +0
-31- unsigned int n, enum rte_ring_queue_behavior behavior, - unsigned int is_sp, unsigned int *free_space) -{ - uint32_t prod_head, prod_next; -uint32_t free_entries; - - n =__rte_ring_move_prod_head (r, is_sp, n, behavior, - &prod_head, &prod_next, &free_entries); -if (n ==0 ) - goto end; - - ENQUEUE_PTRS(r, &r[1], prod_head, obj_table, n, void *); - -update_tail (&r->prod, prod_head, prod_next, is_sp,1 ); -end: -if (free_space !=NULL ) - *free_space = free_entries - n; -return n; -} - -/** -* @internal Dequeue several objects from the ring -* -* @param r -* A pointer to the ring structure. -* @param obj_table -* A pointer to a table of void * pointers (objects). -* @param n -* The number of objects to pull from the ring. -* @param behavior -* RTE_RING_QUEUE_FIXED: Dequeue a fixed number of items from a ring
- *RTE_RING_QUEUE_VARIABLE: Dequeue as many items as possible from
ring
- * @paramis_sc
- * Indicates whether to use single consumer or multi-consumer head
update
- * @param available
- * returns the number of remaining ring entries after the dequeue has
finished
- * @return
- * - Actual number of objects dequeued.
- * If behavior ==RTE_RING_QUEUE_FIXED, this will be 0 or n only.
- */
-static__rte_always_inlineunsigned int -__rte_ring_do_dequeue(structrte_ring*r, void **obj_table,lib/librte_ring/rte_ring.h +6
-43- unsigned int n, enum rte_ring_queue_behavior behavior, - unsigned int is_sc, unsigned int *available) -{ - uint32_t cons_head, cons_next; -uint32_t entries; - - n =__rte_ring_move_cons_head (r, (int )is_sc, n, behavior, - &cons_head, &cons_next, &entries); -if (n ==0 ) - goto end; - - DEQUEUE_PTRS(r, &r[1], cons_head, obj_table, n, void *); - -update_tail (&r->cons, cons_head, cons_next, is_sc,0 ); - -end: -if (available !=NULL ) - *available = entries - n; -return n; -} -/** * Enqueue several objects on the ring (multi-producers safe). * @@ -375,8 +213,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_MT, free_space); + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/** @@ -398,8 +236,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_ST, free_space); + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/** @@ -425,24 +263,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - switch (r->prod.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_bulk (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mp_rts_enqueue_bulk (r, obj_table, n, - free_space); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mp_hts_enqueue_bulk (r, obj_table, n, - free_space); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_enqueue_bulk_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +0
-0@@ -462,7 +284,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void *const
*obj_table, static__rte_always_inlineintrte_ring_mp_enqueue(struct rte_ring *r, void *obj){lib/librte_ring/rte_ring.h +1
-1-return rte_ring_mp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_mp_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -479,7 +301,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj)static
__rte_always_inlineintrte_ring_sp_enqueue(struct rte_ring *r, void *obj){lib/librte_ring/rte_ring.h +8
-22-return rte_ring_sp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_sp_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -500,7 +322,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline int rte_ring_enqueue(struct rte_ring *r, void *obj) { -return rte_ring_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -525,8 +347,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_MT, available); + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }/** @@ -549,8 +371,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_ST, available); + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }/** @@ -576,22 +398,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - switch (r->cons.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_bulk (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mc_rts_dequeue_bulk (r, obj_table, n, available); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mc_hts_dequeue_bulk (r, obj_table, n, available); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_dequeue_bulk_elem (r, obj_table,sizeof (void *), + n, available); }/**
lib/librte_ring/rte_ring.h +2
-2@@ -612,7 +420,7 @@ rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, static __rte_always_inline intrte_ring_mc_dequeue (struct rte_ring *r,void **obj_p) { -return rte_ring_mc_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_mc_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -630,7 +438,7 @@ rte_ring_mc_dequeue(struct rte_ring *r, void **obj_p) static __rte_always_inline int rte_ring_sc_dequeue(structrte_ring *r,void **obj_p) { -return rte_ring_sc_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_sc_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -652,7 +460,7 @@ rte_ring_sc_dequeue(struct rte_ring *r, void **obj_p)static
__rte_always_inlineintrte_ring_dequeue(struct rte_ring *r, void **obj_p){lib/librte_ring/rte_ring.h +3
-3-return rte_ring_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -860,8 +668,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, free_space); +return rte_ring_mp_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +4
-20@@ -883,8 +691,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, free_space); +return rte_ring_sp_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/** @@ -910,24 +718,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - switch (r->prod.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_burst (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mp_rts_enqueue_burst (r, obj_table, n, - free_space); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mp_hts_enqueue_burst (r, obj_table, n, - free_space); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +2
-2@@ -954,8 +746,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, available); +return rte_ring_mc_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }/**
lib/librte_ring/rte_ring.h +4
-21@@ -979,8 +771,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, available); +return rte_ring_sc_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }/** @@ -1006,24 +798,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - switch (r->cons.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mc_dequeue_burst(r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_burst (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mc_rts_dequeue_burst (r, obj_table, n, - available); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mc_hts_dequeue_burst (r, obj_table, n, - available); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }#ifdef __cplusplus --2.17.1
Re: [dpdk-dev] [PATCH 3/3] ring: use element APIs to implement legacy APIs
Hi Feifei,
Quoted 5 lines
Hi, Konstantin, David
I'm Feifei Wang from Arm. Sorry to make the following request:
Would you please do some ring performance tests of this patch in your platforms at the time you are free? And I want to know whether this patch has a significant impact on other platforms except ARM.
I run few tests on SKX box and so far didn’t notice any real perf difference. Konstantin
Quoted 503 lines
Thanks very much.
FeifeiQuoted 500 lines
-----Original Message-----
From: Feifei Wang <[email protected]>
Sent: 2020年7月3日 18:27
To: Honnappa Nagarahalli <[email protected]>; Konstantin Ananyev <[email protected]>
Cc: [email protected]; nd <[email protected]>; Feifei Wang <[email protected]>
Subject: [PATCH 3/3] ring: use element APIs to implement legacy APIsUse
rte_ring_xxx_elem_xxxAPIs to replace legacy API implementation. This reduces code duplication and improves code maintenance.aarch64:
HW:N1sdp, 1 socket, 4 cores, 1 thread/core, 2.6GHz OS:Ubuntu 18.04.1 LTS,
Kernel: 5.4.0+
DPDK: 20.05-rc3, Configuration: arm64-n1sdp-linux-gcc gcc:9.2.1$sudo ./arm64-n1sdp-linux-gcc/app/test -l 1-2
RTE>>ring_perf_autotesttest results on aarch64 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 1.11 1.10
legacy APIs: SP/SC: burst (size: 32): 1.95 1.97
legacy APIs: MP/MC: burst (size: 8): 1.86 1.94
legacy APIs: MP/MC: burst (size: 32): 2.65 2.69
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 1.08 1.09
legacy APIs: SP/SC: bulk (size: 32): 1.89 1.90
legacy APIs: MP/MC: bulk (size: 8): 1.85 1.98
legacy APIs: MP/MC: bulk (size: 32): 2.65 2.69x86:
HW: dell, CPU Intel(R) Xeon(R) Gold 6240, 2 sockets, 18 cores/socket, 1 thread/core, 3.3GHz
OS: Ubuntu 20.04 LTS, Kernel: 5.4.0-37-generic
DPDK: 20.05-rc3, Configuration: x86_64-native-linuxapp-gcc
gcc: 9.3.0$sudo ./x86_64-native-linuxapp-gcc/app/test -l 14,16 RTE>>ring_perf_autotest
test results on x86 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 29.35 27.78
legacy APIs: SP/SC: burst (size: 32): 73.11 73.39
legacy APIs: MP/MC: burst (size: 8): 62.36 62.37
legacy APIs: MP/MC: burst (size: 32): 101.01 101.03
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 25.94 29.55
legacy APIs: SP/SC: bulk (size: 32): 70.00 78.87
legacy APIs: MP/MC: bulk (size: 8): 63.41 62.48
legacy APIs: MP/MC: bulk (size: 32): 105.86 103.84Summary:
In aarch64 server with this patch, there is almost no performance difference. In x86 server with this patch, in some cases, the performance slightly improve, in other cases, the performance slightly drop.Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 284 ++++--------------------------------- 1 file changed, 30 insertions(+), 254 deletions(-)lib/librte_ring/rte_ring.h index renamed from lib/librte_ring/rte_ring.h +0
-0
35f3f8c42..2a2190bfc100644lib/librte_ring/rte_ring.h +0
-86@@ -191,168 +191,6 @@ void rte_ring_free(struct rte_ring *r);*/ void rte_ring_dump (FILE *f,const struct rte_ring *r); -/* the actual enqueue of pointers on the ring. -* Placed here since identical code needed in both - * single and multi producer enqueue functions */ -#define ENQUEUE_PTRS(r, ring_start, prod_head, obj_table, n, obj_type) do { \ - unsigned int i; \ - const uint32_t size = (r)->size; \ - uint32_t idx = prod_head & (r)->mask; \ - obj_type *ring = (obj_type *)ring_start; \ - if (likely(idx + n < size)) { \ - for (i = 0; i < (n & ~0x3); i += 4, idx += 4) { \ - ring[idx] = obj_table[i]; \ - ring[idx + 1] = obj_table[i + 1]; \ - ring[idx + 2] = obj_table[i + 2]; \ - ring[idx + 3] = obj_table[i + 3]; \ - } \ - switch (n & 0x3) { \ - case 3: \ - ring[idx++] = obj_table[i++];/* fallthrough */ \ -case 2 : \ - ring[idx++] = obj_table[i++];/* fallthrough */ \ -case 1 : \ - ring[idx++] = obj_table[i++]; \ - } \ - } else { \ -for (i =0 ; idx < size; i++, idx++)\ - ring[idx] = obj_table[i]; \ -for (idx =0 ; i < n; i++, idx++) \ - ring[idx] = obj_table[i]; \ - } \ -} while (0) - -/* the actual copy of pointers on the ring to obj_table. - * Placed here since identical code needed in both - * single and multi consumer dequeue functions */ -#define DEQUEUE_PTRS(r, ring_start, cons_head, obj_table, n, obj_type) do { \ - unsigned int i; \ - uint32_t idx = cons_head & (r)->mask; \ - const uint32_t size = (r)->size; \ - obj_type *ring = (obj_type *)ring_start; \ - if (likely(idx + n < size)) { \ - for (i = 0; i < (n & ~0x3); i += 4, idx += 4) {\ - obj_table[i] = ring[idx]; \ - obj_table[i + 1] = ring[idx + 1]; \ - obj_table[i + 2] = ring[idx + 2]; \ - obj_table[i + 3] = ring[idx + 3]; \ - } \ - switch (n & 0x3) { \ - case 3: \ - obj_table[i++] = ring[idx++];/* fallthrough */ \ -case 2 : \ - obj_table[i++] = ring[idx++];/* fallthrough */ \ -case 1 : \ - obj_table[i++] = ring[idx++]; \ - } \ - } else { \ -for (i =0 ; idx < size; i++, idx++) \ - obj_table[i] = ring[idx]; \ -for (idx =0 ; i < n; i++, idx++) \ - obj_table[i] = ring[idx]; \ - } \ -} while (0) - -/* Between load and load. there might be cpu reorder in weak model -* (powerpc/arm). -* There are 2 choices for the users -* 1.use rmb() memory barrier -* 2.use one-direction load_acquire/store_release barrier,defined by -* CONFIG_RTE_USE_C11_MEM_MODEL=y -* It depends on performance test results. -* By default, move common functions to rte_ring_generic.h - */ -#ifdef RTE_USE_C11_MEM_MODEL -#include "rte_ring_c11_mem.h" -#else -#include "rte_ring_generic.h" -#endif - -/** -* @internal Enqueue several objects on the ring -* -* @param r -* A pointer to the ring structure. -* @param obj_table -* A pointer to a table of void * pointers (objects). -* @param n -* The number of objects to add in the ring from the obj_table. -* @param behavior -* RTE_RING_QUEUE_FIXED: Enqueue a fixed number of items from a ring
- *RTE_RING_QUEUE_VARIABLE: Enqueue as many items as possible from
ring
- * @paramis_sp
- * Indicates whether to use single producer or multi-producer head update
- * @paramfree_space
- * returns the amount of space after the enqueue operation has finished
- * @return
- * Actual number of objects enqueued.
- * If behavior ==RTE_RING_QUEUE_FIXED, this will be 0 or n only.
- */
-static__rte_always_inlineunsigned int -__rte_ring_do_enqueue(structrte_ring*r, void * const*obj_table,lib/librte_ring/rte_ring.h +0
-31- unsigned int n, enum rte_ring_queue_behavior behavior, - unsigned int is_sp, unsigned int *free_space) -{ - uint32_t prod_head, prod_next; -uint32_t free_entries; - - n =__rte_ring_move_prod_head (r, is_sp, n, behavior, - &prod_head, &prod_next, &free_entries); -if (n ==0 ) - goto end; - - ENQUEUE_PTRS(r, &r[1], prod_head, obj_table, n, void *); - -update_tail (&r->prod, prod_head, prod_next, is_sp,1 ); -end: -if (free_space !=NULL ) - *free_space = free_entries - n; -return n; -} - -/** -* @internal Dequeue several objects from the ring -* -* @param r -* A pointer to the ring structure. -* @param obj_table -* A pointer to a table of void * pointers (objects). -* @param n -* The number of objects to pull from the ring. -* @param behavior -* RTE_RING_QUEUE_FIXED: Dequeue a fixed number of items from a ring
- *RTE_RING_QUEUE_VARIABLE: Dequeue as many items as possible from
ring
- * @paramis_sc
- * Indicates whether to use single consumer or multi-consumer head
update
- * @param available
- * returns the number of remaining ring entries after the dequeue has
finished
- * @return
- * - Actual number of objects dequeued.
- * If behavior ==RTE_RING_QUEUE_FIXED, this will be 0 or n only.
- */
-static__rte_always_inlineunsigned int -__rte_ring_do_dequeue(structrte_ring*r, void **obj_table,lib/librte_ring/rte_ring.h +6
-43- unsigned int n, enum rte_ring_queue_behavior behavior, - unsigned int is_sc, unsigned int *available) -{ - uint32_t cons_head, cons_next; -uint32_t entries; - - n =__rte_ring_move_cons_head (r, (int )is_sc, n, behavior, - &cons_head, &cons_next, &entries); -if (n ==0 ) - goto end; - - DEQUEUE_PTRS(r, &r[1], cons_head, obj_table, n, void *); - -update_tail (&r->cons, cons_head, cons_next, is_sc,0 ); - -end: -if (available !=NULL ) - *available = entries - n; -return n; -} -/** * Enqueue several objects on the ring (multi-producers safe). * @@ -375,8 +213,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_MT, free_space); + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/** @@ -398,8 +236,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_ST, free_space); + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/** @@ -425,24 +263,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - switch (r->prod.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_bulk (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mp_rts_enqueue_bulk (r, obj_table, n, - free_space); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mp_hts_enqueue_bulk (r, obj_table, n, - free_space); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_enqueue_bulk_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +0
-0@@ -462,7 +284,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void *const
*obj_table, static__rte_always_inlineintrte_ring_mp_enqueue(struct rte_ring *r, void *obj){lib/librte_ring/rte_ring.h +1
-1-return rte_ring_mp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_mp_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -479,7 +301,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj)static
__rte_always_inlineintrte_ring_sp_enqueue(struct rte_ring *r, void *obj){lib/librte_ring/rte_ring.h +8
-22-return rte_ring_sp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_sp_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -500,7 +322,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline int rte_ring_enqueue(struct rte_ring *r, void *obj) { -return rte_ring_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -525,8 +347,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_MT, available); + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }/** @@ -549,8 +371,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_ST, available); + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }/** @@ -576,22 +398,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - switch (r->cons.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_bulk (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mc_rts_dequeue_bulk (r, obj_table, n, available); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mc_hts_dequeue_bulk (r, obj_table, n, available); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_dequeue_bulk_elem (r, obj_table,sizeof (void *), + n, available); }/**
lib/librte_ring/rte_ring.h +2
-2@@ -612,7 +420,7 @@ rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, static __rte_always_inline intrte_ring_mc_dequeue (struct rte_ring *r,void **obj_p) { -return rte_ring_mc_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_mc_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -630,7 +438,7 @@ rte_ring_mc_dequeue(struct rte_ring *r, void **obj_p) static __rte_always_inline int rte_ring_sc_dequeue(structrte_ring *r,void **obj_p) { -return rte_ring_sc_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_sc_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -652,7 +460,7 @@ rte_ring_sc_dequeue(struct rte_ring *r, void **obj_p)static
__rte_always_inlineintrte_ring_dequeue(struct rte_ring *r, void **obj_p){lib/librte_ring/rte_ring.h +3
-3-return rte_ring_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -860,8 +668,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, free_space); +return rte_ring_mp_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +4
-20@@ -883,8 +691,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, free_space); +return rte_ring_sp_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/** @@ -910,24 +718,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - switch (r->prod.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_burst (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mp_rts_enqueue_burst (r, obj_table, n, - free_space); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mp_hts_enqueue_burst (r, obj_table, n, - free_space); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +2
-2@@ -954,8 +746,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, available); +return rte_ring_mc_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }/**
lib/librte_ring/rte_ring.h +4
-21@@ -979,8 +771,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, available); +return rte_ring_sc_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }/** @@ -1006,24 +798,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - switch (r->cons.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mc_dequeue_burst(r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_burst (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mc_rts_dequeue_burst (r, obj_table, n, - available); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mc_hts_dequeue_burst (r, obj_table, n, - available); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }#ifdef __cplusplus --2.17.1
Re: [dpdk-dev] [PATCH 3/3] ring: use element APIs to implement legacy APIs
<snip>
Quoted 5 lines
Hi Feifei,
Quoted 2 lines
Hi, Konstantin, David
Quoted 7 lines
Quoted 2 lines
I'm Feifei Wang from Arm. Sorry to make the following request:
Would you please do some ring performance tests of this patch in yourplatforms at the time you are free?
Quoted 1 line
And I want to know whether this patch has a significant impact on other
platforms except ARM.
I run few tests on SKX box and so far didn’t notice any real perf difference.
Thanks Konstantin for testing this.
Quoted 66 lines
Konstantin
Quoted 64 lines
Thanks very much.
FeifeiQuoted 61 lines
-----Original Message-----
From: Feifei Wang <[email protected]>
Sent: 2020年7月3日 18:27
To: Honnappa Nagarahalli <[email protected]>; Konstantin Ananyev <[email protected]>
Cc: [email protected]; nd <[email protected]>; Feifei Wang <[email protected]>
Subject: [PATCH 3/3] ring: use element APIs to implement legacy APIsUse
rte_ring_xxx_elem_xxxAPIs to replace legacy API implementation. This reduces code duplication and improves code maintenance.aarch64:
HW:N1sdp, 1 socket, 4 cores, 1 thread/core, 2.6GHz OS:Ubuntu 18.04.1 LTS,
Kernel: 5.4.0+
DPDK: 20.05-rc3, Configuration: arm64-n1sdp-linux-gcc gcc:9.2.1$sudo ./arm64-n1sdp-linux-gcc/app/test -l 1-2
RTE>>ring_perf_autotesttest results on aarch64 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 1.11 1.10
legacy APIs: SP/SC: burst (size: 32): 1.95 1.97
legacy APIs: MP/MC: burst (size: 8): 1.86 1.94
legacy APIs: MP/MC: burst (size: 32): 2.65 2.69
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 1.08 1.09
legacy APIs: SP/SC: bulk (size: 32): 1.89 1.90
legacy APIs: MP/MC: bulk (size: 8): 1.85 1.98
legacy APIs: MP/MC: bulk (size: 32): 2.65 2.69x86:
HW: dell, CPU Intel(R) Xeon(R) Gold 6240, 2 sockets, 18 cores/socket,
1 thread/core, 3.3GHz
OS: Ubuntu 20.04 LTS, Kernel: 5.4.0-37-generic
DPDK: 20.05-rc3, Configuration: x86_64-native-linuxapp-gcc
gcc: 9.3.0$sudo ./x86_64-native-linuxapp-gcc/app/test -l 14,16 RTE>>ring_perf_autotest
test results on x86 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 29.35 27.78
legacy APIs: SP/SC: burst (size: 32): 73.11 73.39
legacy APIs: MP/MC: burst (size: 8): 62.36 62.37
legacy APIs: MP/MC: burst (size: 32): 101.01 101.03
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 25.94 29.55
legacy APIs: SP/SC: bulk (size: 32): 70.00 78.87
legacy APIs: MP/MC: bulk (size: 8): 63.41 62.48
legacy APIs: MP/MC: bulk (size: 32): 105.86 103.84
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Summary:
In aarch64 server with this patch, there is almost no performancedifference.
Quoted 2 lines
Quoted 2 lines
In x86 server with this patch, in some cases, the performance slightly improve, in other cases, the performance slightly drop.
I suggest removing the perf data from the commit message, as Konstantin confirmed there is no perf drop on x86 either.
Quoted 444 lines
Quoted 100 lines
Quoted 100 lines
Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 284 ++++--------------------------------- 1 file changed, 30 insertions(+), 254 deletions(-)lib/librte_ring/rte_ring.h +0
-65@@ -191,168 +191,6 @@ void rte_ring_free(struct rte_ring *r);*/ void rte_ring_dump (FILE *f,const struct rte_ring *r); -/* the actual enqueue of pointers on the ring. -* Placed here since identical code needed in both - * single and multi producer enqueue functions */ -#define ENQUEUE_PTRS(r, ring_start, prod_head, obj_table, n, obj_type) do { \ - unsigned int i; \ - const uint32_t size = (r)->size; \ - uint32_t idx = prod_head & (r)->mask; \ - obj_type *ring = (obj_type *)ring_start; \ - if (likely(idx + n < size)) { \ - for (i = 0; i < (n & ~0x3); i += 4, idx += 4) { \ - ring[idx] = obj_table[i]; \ - ring[idx + 1] = obj_table[i + 1]; \ - ring[idx + 2] = obj_table[i + 2]; \ - ring[idx + 3] = obj_table[i + 3]; \ - } \ - switch (n & 0x3) { \ - case 3: \ - ring[idx++] = obj_table[i++];/* fallthrough */ \ -case 2 : \ - ring[idx++] = obj_table[i++];/* fallthrough */ \ -case 1 : \ - ring[idx++] = obj_table[i++]; \ - } \ - } else { \ -for (i =0 ; idx < size; i++, idx++)\ - ring[idx] = obj_table[i]; \ -for (idx =0 ; i < n; i++, idx++) \ - ring[idx] = obj_table[i]; \ - } \ -} while (0) - -/* the actual copy of pointers on the ring to obj_table. - * Placed here since identical code needed in both - * single and multi consumer dequeue functions */ -#define DEQUEUE_PTRS(r, ring_start, cons_head, obj_table, n, obj_type) do { \ - unsigned int i; \ - uint32_t idx = cons_head & (r)->mask; \ - const uint32_t size = (r)->size; \ - obj_type *ring = (obj_type *)ring_start; \ - if (likely(idx + n < size)) { \ - for (i = 0; i < (n & ~0x3); i += 4, idx += 4) {\ - obj_table[i] = ring[idx]; \ - obj_table[i + 1] = ring[idx + 1]; \ - obj_table[i + 2] = ring[idx + 2]; \ - obj_table[i + 3] = ring[idx + 3]; \ - } \ - switch (n & 0x3) { \ - case 3: \ - obj_table[i++] = ring[idx++];/* fallthrough */ \ -case 2 : \ - obj_table[i++] = ring[idx++];/* fallthrough */ \ -case 1 : \ - obj_table[i++] = ring[idx++]; \ - } \ - } else { \ -for (i =0 ; idx < size; i++, idx++) \ - obj_table[i] = ring[idx]; \ -for (idx =0 ; i < n; i++, idx++) \ - obj_table[i] = ring[idx]; \ - } \ -} while (0) - -/* Between load and load. there might be cpu reorder in weak model -* (powerpc/arm). -* There are 2 choices for the users -* 1.use rmb() memory barrier -* 2.use one-direction load_acquire/store_release barrier,defined by
- *CONFIG_RTE_USE_C11_MEM_MODEL=y
- * It depends on performance test results.
- * By default, move common functions torte_ring_generic.h
- */lib/librte_ring/rte_ring.h +0
-11-#ifdef RTE_USE_C11_MEM_MODEL -#include "rte_ring_c11_mem.h" -#else -#include "rte_ring_generic.h" -#endif - -/** -* @internal Enqueue several objects on the ring -* -* @param r -* A pointer to the ring structure. Quoted 8 lines
Quoted 8 lines
- * @param
obj_table
- * A pointer to a table of void * pointers (objects).
- * @param n
- * The number of objects to add in the ring from theobj_table.
- * @param behavior
- *RTE_RING_QUEUE_FIXED: Enqueue a fixed number of items from a
ring
- *RTE_RING_QUEUE_VARIABLE: Enqueue as many items as possiblefrom
Quoted 3 lines
Quoted 3 lines
ring
- * @paramis_sp
- * Indicates whether to use single producer or multi-producer headupdate
Quoted 33 lines
Quoted 33 lines
- * @param
free_space
- * returns the amount of space after the enqueue operation has finished
- * @return
- * Actual number of objects enqueued.
- * If behavior ==RTE_RING_QUEUE_FIXED, this will be 0 or n only.
- */lib/librte_ring/rte_ring.h +0
-27-static __rte_always_inline unsigned int -__rte_ring_do_enqueue (struct rte_ring *r,void *const *obj_table, -unsigned int n,enum rte_ring_queue_behavior behavior, -unsigned int is_sp,unsigned int *free_space) -{ -uint32_t prod_head, prod_next; -uint32_t free_entries; - - n =__rte_ring_move_prod_head (r, is_sp, n, behavior, - &prod_head, &prod_next, &free_entries); -if (n ==0 ) - goto end; - - ENQUEUE_PTRS(r, &r[1], prod_head, obj_table, n, void *); - -update_tail (&r->prod, prod_head, prod_next, is_sp,1 ); -end: -if (free_space !=NULL ) - *free_space = free_entries - n; -return n; -} - -/** -* @internal Dequeue several objects from the ring -* -* @param r -* A pointer to the ring structure. Quoted 8 lines
Quoted 8 lines
- * @param
obj_table
- * A pointer to a table of void * pointers (objects).
- * @param n
- * The number of objects to pull from the ring.
- * @param behavior
- *RTE_RING_QUEUE_FIXED: Dequeue a fixed number of items from a
ring
- *RTE_RING_QUEUE_VARIABLE: Dequeue as many items as possiblefrom
Quoted 289 lines
Quoted 289 lines
ring
- * @paramis_sc
- * Indicates whether to use single consumer or multi-consumer head
update
- * @param available
- * returns the number of remaining ring entries after the dequeue has
finished
- * @return
- * - Actual number of objects dequeued.
- * If behavior ==RTE_RING_QUEUE_FIXED, this will be 0 or n only.
- */lib/librte_ring/rte_ring.h +6
-45-static __rte_always_inline unsigned int -__rte_ring_do_dequeue (struct rte_ring *r,void **obj_table, -unsigned int n,enum rte_ring_queue_behavior behavior, -unsigned int is_sc,unsigned int *available) -{ -uint32_t cons_head, cons_next; -uint32_t entries; - - n =__rte_ring_move_cons_head (r, (int )is_sc, n, behavior, - &cons_head, &cons_next, &entries); -if (n ==0 ) - goto end; - - DEQUEUE_PTRS(r, &r[1], cons_head, obj_table, n, void *); - -update_tail (&r->cons, cons_head, cons_next, is_sc,0 ); - -end: -if (available !=NULL ) - *available = entries - n; -return n; -} -/** * Enqueue several objects on the ring (multi-producers safe). * @@ -375,8 +213,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_MT, free_space); + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/** @@ -398,8 +236,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_ST, free_space); + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/** @@ -425,24 +263,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - switch (r->prod.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_bulk (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mp_rts_enqueue_bulk (r, obj_table, n, - free_space); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mp_hts_enqueue_bulk (r, obj_table, n, - free_space); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_enqueue_bulk_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +0
-0@@ -462,7 +284,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void *const
*obj_table, static__rte_always_inlineintrte_ring_mp_enqueue(struct rte_ring *r, void *obj){lib/librte_ring/rte_ring.h +1
-1-return rte_ring_mp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_mp_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -479,7 +301,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline int rte_ring_sp_enqueue(struct
rte_ring*r, void
*obj) {lib/librte_ring/rte_ring.h +8
-22-return rte_ring_sp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_sp_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -500,7 +322,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline int rte_ring_enqueue(structrte_ring *r,void *obj) { -return rte_ring_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -525,8 +347,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_MT, available); + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }/** @@ -549,8 +371,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_ST, available); + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }/** @@ -576,22 +398,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - switch (r->cons.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mc_dequeue_bulk(r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_bulk (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mc_rts_dequeue_bulk (r, obj_table, n, available); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mc_hts_dequeue_bulk (r, obj_table, n, available); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_dequeue_bulk_elem (r, obj_table,sizeof (void *), + n, available); }/**
lib/librte_ring/rte_ring.h +2
-2@@ -612,7 +420,7 @@ rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, static __rte_always_inline intrte_ring_mc_dequeue (struct rte_ring *r,void **obj_p) { -return rte_ring_mc_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_mc_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -630,7 +438,7 @@ rte_ring_mc_dequeue(struct rte_ring *r, void **obj_p) static __rte_always_inline int rte_ring_sc_dequeue(structrte_ring *r,void **obj_p) { -return rte_ring_sc_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_sc_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -652,7 +460,7 @@ rte_ring_sc_dequeue(struct rte_ring *r, void **obj_p) static __rte_always_inline int rte_ring_dequeue(struct
rte_ring*r, void
**obj_p) {lib/librte_ring/rte_ring.h +3
-3-return rte_ring_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -860,8 +668,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, free_space); +return rte_ring_mp_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +4
-20@@ -883,8 +691,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, free_space); +return rte_ring_sp_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/** @@ -910,24 +718,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - switch (r->prod.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_burst (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mp_rts_enqueue_burst (r, obj_table, n, - free_space); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mp_hts_enqueue_burst (r, obj_table, n, - free_space); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +2
-2@@ -954,8 +746,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, available); +return rte_ring_mc_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }/**
lib/librte_ring/rte_ring.h +4
-21@@ -979,8 +771,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, available); +return rte_ring_sc_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }/** @@ -1006,24 +798,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - switch (r->cons.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mc_dequeue_burst(r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_burst (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mc_rts_dequeue_burst (r, obj_table, n, - available); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mc_hts_dequeue_burst (r, obj_table, n, - available); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }#ifdef __cplusplus --2.17.1
Re: [dpdk-dev] [PATCH 3/3] ring: use element APIs to implement legacy APIs
Quoted 97 lines
-----Original Message-----
From: Honnappa Nagarahalli <[email protected]>
Sent: 2020年7月8日 0:22
To: Ananyev, Konstantin <[email protected]>; Feifei Wang <[email protected]>; [email protected]
Cc: [email protected]; nd <[email protected]>; Ruifeng Wang <[email protected]>; nd <[email protected]>; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH 3/3] ring: use element APIs to implement legacy APIs<snip>
Quoted 8 lines
Hi Feifei,
Quoted 5 lines
Hi, Konstantin, David
I'm Feifei Wang from Arm. Sorry to make the following request:
Would you please do some ring performance tests of this patch in yourQuoted 6 lines
platforms at the time you are free?
Quoted 2 lines
And I want to know whether this patch has a significant impact on other
platforms except ARM.
I run few tests on SKX box and so far didn’t notice any real perf difference.
Thanks Konstantin for testing this.
Quoted 67 lines
Konstantin
Quoted 65 lines
Thanks very much.
FeifeiQuoted 62 lines
-----Original Message-----
From: Feifei Wang <[email protected]>
Sent: 2020年7月3日 18:27
To: Honnappa Nagarahalli <[email protected]>; Konstantin Ananyev <[email protected]>
Cc: [email protected]; nd <[email protected]>; Feifei Wang <[email protected]>
Subject: [PATCH 3/3] ring: use element APIs to implement legacy APIsUse
rte_ring_xxx_elem_xxxAPIs to replace legacy API implementation. This reduces code duplication and improves code maintenance.aarch64:
HW:N1sdp, 1 socket, 4 cores, 1 thread/core, 2.6GHz OS:Ubuntu 18.04.1 LTS,
Kernel: 5.4.0+
DPDK: 20.05-rc3, Configuration: arm64-n1sdp-linux-gcc gcc:9.2.1$sudo ./arm64-n1sdp-linux-gcc/app/test -l 1-2
RTE>>ring_perf_autotesttest results on aarch64 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 1.11 1.10
legacy APIs: SP/SC: burst (size: 32): 1.95 1.97
legacy APIs: MP/MC: burst (size: 8): 1.86 1.94
legacy APIs: MP/MC: burst (size: 32): 2.65 2.69
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 1.08 1.09
legacy APIs: SP/SC: bulk (size: 32): 1.89 1.90
legacy APIs: MP/MC: bulk (size: 8): 1.85 1.98
legacy APIs: MP/MC: bulk (size: 32): 2.65 2.69x86:
HW: dell, CPU Intel(R) Xeon(R) Gold 6240, 2 sockets, 18 cores/socket,
1 thread/core, 3.3GHz
OS: Ubuntu 20.04 LTS, Kernel: 5.4.0-37-generic
DPDK: 20.05-rc3, Configuration: x86_64-native-linuxapp-gcc
gcc: 9.3.0$sudo ./x86_64-native-linuxapp-gcc/app/test -l 14,16 RTE>>ring_perf_autotest
test results on x86 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 29.35 27.78
legacy APIs: SP/SC: burst (size: 32): 73.11 73.39
legacy APIs: MP/MC: burst (size: 8): 62.36 62.37
legacy APIs: MP/MC: burst (size: 32): 101.01 101.03
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 25.94 29.55
legacy APIs: SP/SC: bulk (size: 32): 70.00 78.87
legacy APIs: MP/MC: bulk (size: 8): 63.41 62.48
legacy APIs: MP/MC: bulk (size: 32): 105.86 103.84
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Summary:
In aarch64 server with this patch, there is almost no performancedifference.
Quoted 2 lines
Quoted 2 lines
In x86 server with this patch, in some cases, the performance slightly improve, in other cases, the performance slightly drop.
I suggest removing the perf data from the commit message, as Konstantin confirmed there is no perf drop on x86 either.
Ok, that's all right.
Quoted 383 lines
Quoted 72 lines
Quoted 72 lines
Quoted 72 lines
Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 284 ++++--------------------------------- 1 file changed, 30 insertions(+), 254 deletions(-)(quoted diff) +0
-0
b/lib/librte_ring/rte_ring.hindex35f3f8c42..2a2190bfc100644lib/librte_ring/rte_ring.h +0
-3@@ -191,168 +191,6 @@ void rte_ring_free(struct rte_ring *r);*/ void rte_ring_dump (FILE *f,const struct rte_ring *r); -/* the actual enqueue of pointers on the ring. -* Placed here since identical code needed in both - * single and multi producer enqueue functions */ -#define
ENQUEUE_PTRS(r, ring_start, prod_head, obj_table, n, obj_type)do { \ -unsigned int i; \ -constuint32_tsize = (r)->size; \
-uint32_t idx =prod_head& (r)->mask; \ -obj_type *ring = (obj_type*)ring_start; \ -if (likely(idx + n < size)) { \ -for (i = 0; i < (n & ~0x3); i += 4, idx += 4) { \ -ring[idx] = obj_table[i]; \ -ring[idx + 1] = obj_table[i + 1]; \ -ring[idx + 2] = obj_table[i + 2]; \ -ring[idx + 3] = obj_table[i + 3]; \ -} \
-switch (n &0x3) { \ -case 3: \ -ring[idx++] = obj_table[i++]; /* fallthrough */ \ -case 2: \ -ring[idx++] = obj_table[i++]; /* fallthrough */ \ -case 1: \ -ring[idx++] = obj_table[i++]; \ -} \
-} else { \ -for (i = 0; idx < size; i++, idx++)\ -ring[idx] = obj_table[i]; \ -for (idx = 0; i < n; i++, idx++) \ -ring[idx] = obj_table[i]; \ -} \ -} while (0)lib/librte_ring/rte_ring.h +0
-4- -/* the actual copy of pointers on the ring to obj_table. -* Placed here since identical code needed in both - * single and multi consumer dequeue functions */ -#define
DEQUEUE_PTRS(r, ring_start, cons_head, obj_table, n, obj_type)do { \ -unsigned int i; \ -uint32_t idx =cons_head& (r)->mask; \
-constuint32_tsize = (r)->size; \ -obj_type *ring = (obj_type*)ring_start; \ -if (likely(idx + n < size)) { \ -for (i = 0; i < (n & ~0x3); i += 4, idx += 4) {\ -obj_table[i] = ring[idx]; \
-obj_table[i + 1] = ring[idx + 1]; \ -obj_table[i + 2] = ring[idx
+ 2]; \ -obj_table[i + 3] = ring[idx + 3]; \ -} \ -switch (n &0x3) { \ -case 3: \ -obj_table[i++] = ring[idx++]; /* fallthrough */ \ -case 2: \ -obj_table[i++] = ring[idx++]; /* fallthrough */ \
-case 1: \ -obj_table[i++] = ring[idx++]; \ -} \ -} else { \ -for (i = 0; idx < size; i++, idx++) \ -obj_table[i] = ring[idx]; \lib/librte_ring/rte_ring.h +0
-4-for (idx = 0; i < n; i++, idx++) \ -obj_table[i] = ring[idx]; \ -} \ -} while (0) - -/* Between load and load. there might be cpu reorder in weak model
- * (powerpc/arm).
- * There are 2 choices for the users
- * 1.usermb()memory barrier
- * 2.use one-direction load_acquire/store_release barrier,defined by
- *CONFIG_RTE_USE_C11_MEM_MODEL=y
- * It depends on performance test results.
- * By default, move common functions torte_ring_generic.h
- */lib/librte_ring/rte_ring.h +0
-9-#ifdef RTE_USE_C11_MEM_MODEL -#include "rte_ring_c11_mem.h" -#else -#include "rte_ring_generic.h" -#endif - -/** -* @internal Enqueue several objects on the ring -* Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
- * @param r
- * A pointer to the ring structure.
- * @paramobj_table
- * A pointer to a table of void * pointers (objects).
- * @param n
- * The number of objects to add in the ring from theobj_table.
- * @param behavior
- *RTE_RING_QUEUE_FIXED: Enqueue a fixed number of items froma
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
ring
- *RTE_RING_QUEUE_VARIABLE: Enqueue as many items as possiblefrom
Quoted 3 lines
Quoted 3 lines
ring
- * @paramis_sp
- * Indicates whether to use single producer or multi-producer headupdate
Quoted 2 lines
Quoted 2 lines
- * @param
free_space
- * returns the amount of space after the enqueue operation hasfinished
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
- * @return
- * Actual number of objects enqueued.
- * If behavior ==RTE_RING_QUEUE_FIXED, this will be 0 or n only.
- */lib/librte_ring/rte_ring.h +0
-2-static __rte_always_inline unsigned int -__rte_ring_do_enqueue(struct rte_ring *r, void * const
*obj_table,
- unsigned int n, enumrte_ring_queue_behaviorbehavior,
- unsigned intis_sp, unsigned int*free_space) -{ -uint32_tprod_head,prod_next; -uint32_tfree_entries;lib/librte_ring/rte_ring.h +0
-2- -n = __rte_ring_move_prod_head(r, is_sp, n, behavior, -&prod_head,
&prod_next,&free_entries); -if (n == 0) -goto end;lib/librte_ring/rte_ring.h +0
-13- -ENQUEUE_PTRS(r, &r[1], prod_head, obj_table, n, void *); - -update_tail (&r->prod, prod_head, prod_next, is_sp,1 ); -end: -if (free_space !=NULL ) -*free_space = free_entries - n; -return n; -} - -/** -* @internal Dequeue several objects from the ring -* Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
- * @param r
- * A pointer to the ring structure.
- * @paramobj_table
- * A pointer to a table of void * pointers (objects).
- * @param n
- * The number of objects to pull from the ring.
- * @param behavior
- *RTE_RING_QUEUE_FIXED: Dequeue a fixed number of items froma
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
ring
- *RTE_RING_QUEUE_VARIABLE: Dequeue as many items as possiblefrom
Quoted 6 lines
Quoted 6 lines
ring
- * @paramis_sc
- * Indicates whether to use single consumer or multi-consumer head
update
- * @param available
- * returns the number of remaining ring entries after the dequeuehas
Quoted 156 lines
Quoted 156 lines
Quoted 156 lines
finished
- * @return
- * - Actual number of objects dequeued.
- * If behavior ==RTE_RING_QUEUE_FIXED, this will be 0 or n only.
- */lib/librte_ring/rte_ring.h +0
-4-static __rte_always_inline unsigned int -__rte_ring_do_dequeue (struct rte_ring *r,void **obj_table, -unsigned int n,enum rte_ring_queue_behavior behavior, - unsigned int is_sc, unsigned int *available) -{ -uint32_t
cons_head,cons_next; -uint32_t entries;lib/librte_ring/rte_ring.h +4
-16- -n =__rte_ring_move_cons_head (r, (int )is_sc, n, behavior, -&cons_head, &cons_next, &entries); -if (n == 0) -goto end; - -DEQUEUE_PTRS(r, &r[1], cons_head, obj_table, n, void *); - -update_tail (&r->cons, cons_head, cons_next, is_sc,0 ); - -end: -if (available !=NULL ) -*available = entries - n; -return n; -} -/** * Enqueue several objects on the ring (multi-producers safe). * @@ -375,8 +213,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { -return__rte_ring_do_enqueue (r, obj_table, n, RTE_RING_QUEUE_FIXED, -RTE_RING_SYNC_MT, free_space); +return rte_ring_mp_enqueue_bulk_elem(r, obj_table, sizeof(void +*), n, free_space); }/** @@ -398,8 +236,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { -return__rte_ring_do_enqueue (r, obj_table, n, RTE_RING_QUEUE_FIXED, -RTE_RING_SYNC_ST, free_space); +return rte_ring_sp_enqueue_bulk_elem(r, obj_table, sizeof(void +*), n, free_space); }/** @@ -425,24 +263,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { -switch(
r->prod.sync_type) { -caseRTE_RING_SYNC_MT:lib/librte_ring/rte_ring.h +2
-11-return rte_ring_mp_enqueue_bulk (r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_bulk (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS: -return rte_ring_mp_rts_enqueue_bulk (r, obj_table, n, -free_space); -case RTE_RING_SYNC_MT_HTS: -return rte_ring_mp_hts_enqueue_bulk (r, obj_table, n, -free_space); -#endif -} - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_enqueue_bulk_elem (r, obj_table,sizeof (void *), +n, free_space); }/** @@ -462,7 +284,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void* const *obj_table, static __rte_always_inline int
rte_ring_mp_enqueue(struct rte_ring *r, void *obj){ -returnrte_ring_mp_enqueue_bulk(r, &obj, 1, NULL)? 0 :-ENOBUFS;lib/librte_ring/rte_ring.h +1
-0+return rte_ring_mp_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -479,7 +301,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline int rte_ring_sp_enqueue(struct
rte_ring*r, void
*obj) {lib/librte_ring/rte_ring.h +2
-1-return rte_ring_sp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_sp_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -500,7 +322,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline int rte_ring_enqueue(struct rte_ring *r, void *obj) { -return rte_ring_enqueue_bulk(r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -525,8 +347,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_bulk(struct rte_ring *r, void **obj_table,unsigned int n, unsigned int *available) { -return __rte_ring_do_dequeue(r,
obj_table, n,RTE_RING_QUEUE_FIXED,lib/librte_ring/rte_ring.h +2
-1-RTE_RING_SYNC_MT, available); +return rte_ring_mc_dequeue_bulk_elem (r, obj_table,sizeof (void +*), n, available); }/** @@ -549,8 +371,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_bulk(struct rte_ring *r, void **obj_table,unsigned int n, unsigned int *available) { -return __rte_ring_do_dequeue(r,
obj_table, n,RTE_RING_QUEUE_FIXED,lib/librte_ring/rte_ring.h +2
-1-RTE_RING_SYNC_ST, available); +return rte_ring_sc_dequeue_bulk_elem (r, obj_table,sizeof (void +*), n, available); }/** @@ -576,22 +398,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table,unsigned int n, unsigned int *available) { -switch (
r->cons.sync_type) { -caseRTE_RING_SYNC_MT:lib/librte_ring/rte_ring.h +2
-11-return rte_ring_mc_dequeue_bulk (r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_bulk (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS: -return rte_ring_mc_rts_dequeue_bulk (r, obj_table, n, available); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mc_hts_dequeue_bulk (r, obj_table, n, available); -#endif -} - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_dequeue_bulk_elem (r, obj_table,sizeof (void *), +n, available); }/** @@ -612,7 +420,7 @@ rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, static __rte_always_inline int
rte_ring_mc_dequeue(struct rte_ring *r, void **obj_p){ -returnrte_ring_mc_dequeue_bulk(r, obj_p, 1, NULL)? 0 :-ENOENT;lib/librte_ring/rte_ring.h +1
-0+return rte_ring_mc_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -630,7 +438,7 @@ rte_ring_mc_dequeue(struct rte_ring *r, void **obj_p) static __rte_always_inline int
rte_ring_sc_dequeue(struct rte_ring *r, void **obj_p){ -returnrte_ring_sc_dequeue_bulk(r, obj_p, 1, NULL)? 0 :-ENOENT;lib/librte_ring/rte_ring.h +1
-0+return rte_ring_sc_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -652,7 +460,7 @@ rte_ring_sc_dequeue(struct rte_ring *r, void **obj_p) static __rte_always_inline int rte_ring_dequeue(struct
rte_ring*r, void
**obj_p) {lib/librte_ring/rte_ring.h +1
-1-return rte_ring_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_dequeue_elem (r, obj_p,sizeof (void *)); }Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
/**
lib/librte_ring/rte_ring.h +0
-0@@ -860,8 +668,8 @@ static __rte_always_inline unsigned intrte_ring_mp_enqueue_burst(struct
rte_ring*r, void * const
*obj_table,Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
unsigned int n, unsigned int
*free_space) { -return
__rte_ring_do_enqueue(r,obj_table, n, -
RTE_RING_QUEUE_VARIABLE,Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
RTE_RING_SYNC_MT,free_space);
+return rte_ring_mp_enqueue_burst_elem(r,obj_table,sizeof(void *),lib/librte_ring/rte_ring.h +1
-0+n, free_space); }/** @@ -883,8 +691,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { -return__rte_ring_do_enqueue(r,
obj_table, n, -
RTE_RING_QUEUE_VARIABLE,Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
RTE_RING_SYNC_ST,free_space);lib/librte_ring/rte_ring.h +2
-0+return rte_ring_sp_enqueue_burst_elem (r, obj_table,sizeof (void +*), n, free_space); }/** @@ -910,24 +718,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { -switch(
r->prod.sync_type) { -caseRTE_RING_SYNC_MT:lib/librte_ring/rte_ring.h +2
-11-return rte_ring_mp_enqueue_burst (r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_burst (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS: -return rte_ring_mp_rts_enqueue_burst (r, obj_table, n, -free_space); -case RTE_RING_SYNC_MT_HTS: -return rte_ring_mp_hts_enqueue_burst (r, obj_table, n, -free_space); -#endif -} - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_enqueue_burst_elem (r, obj_table,sizeof (void *), +n, free_space); }Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
/**
lib/librte_ring/rte_ring.h +0
-0@@ -954,8 +746,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_burst(struct rte_ring *r, void **obj_table,unsigned int n, unsigned int *available) { -return __rte_ring_do_dequeue(r,
obj_table, n, -
RTE_RING_QUEUE_VARIABLE,Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
RTE_RING_SYNC_MT, available);
+return rte_ring_mc_dequeue_burst_elem(r,obj_table,sizeof(void *),lib/librte_ring/rte_ring.h +1
-0+n, available); }/** @@ -979,8 +771,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_burst(struct rte_ring *r, void **obj_table,unsigned int n, unsigned int *available) { -return __rte_ring_do_dequeue(r,
obj_table, n, -
RTE_RING_QUEUE_VARIABLE,Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
RTE_RING_SYNC_ST, available);lib/librte_ring/rte_ring.h +2
-0+return rte_ring_sc_dequeue_burst_elem (r, obj_table,sizeof (void +*), n, available); }/** @@ -1006,24 +798,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table,unsigned int n, unsigned int *available) { -switch (
r->cons.sync_type) { -caseRTE_RING_SYNC_MT:lib/librte_ring/rte_ring.h +2
-12-return rte_ring_mc_dequeue_burst (r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_burst (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS: -return rte_ring_mc_rts_dequeue_burst (r, obj_table, n, -available); -case RTE_RING_SYNC_MT_HTS: -return rte_ring_mc_hts_dequeue_burst (r, obj_table, n, -available); -#endif -} - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_dequeue_burst_elem (r, obj_table,sizeof (void *), +n, available); }#ifdef __cplusplus --2.17.1
Re: [dpdk-dev] [PATCH 3/3] ring: use element APIs to implement legacy APIs
In reply to Ananyev, KonstantinQuoted 12 lines · Konstantin
Hi Feifei,
Quoted 5 lines
Hi, Konstantin, David
I'm Feifei Wang from Arm. Sorry to make the following request:
Would you please do some ring performance tests of this patch in your platforms at the time you are free? And I want to know whether this patch has a significant impact on other platforms except ARM.I run few tests on SKX box and so far didn’t notice any real perf difference. Konstantin
Full performance results for IBM POWER9 system below. I ran the tests twice for each version and the results were consistent.
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 43.63 43.63
legacy APIs: SP/SC: burst (size: 32): 50.07 50.04
legacy APIs: MP/MC: burst (size: 8): 58.43 58.42
legacy APIs: MP/MC: burst (size: 32): 65.52 65.51
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 43.61 43.61
legacy APIs: SP/SC: bulk (size: 32): 50.05 50.02
legacy APIs: MP/MC: bulk (size: 8): 58.43 58.43
legacy APIs: MP/MC: bulk (size: 32): 65.50 65.49
HW:
Architecture: ppc64le Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Thread(s) per core: 4 Core(s) per socket: 16 Socket(s): 2 NUMA node(s): 6 Model: 2.3 (pvr 004e 1203) Model name: POWER9, altivec supported CPU max MHz: 3800.0000 CPU min MHz: 2300.0000 L1d cache: 32K L1i cache: 32K L2 cache: 512K L3 cache: 10240K NUMA node0 CPU(s): 0-63 NUMA node8 CPU(s): 64-127
OS: RHEL 8.2
GCC: gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)
DPDK: 20.08.0-rc0 (a8550b773)
Unpatched
===========
sudo app/test/dpdk-test -l 68,69
EAL: Detected 128 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: No available hugepages reported in hugepages-2048kB
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0000:01:00.0 (socket 0)
EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0000:01:00.1 (socket 0)
EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0030:01:00.0 (socket 8)
EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0030:01:00.1 (socket 8)
EAL: using IOMMU type 7 (sPAPR)
EAL: Probe PCI driver: net_i40e (8086:1583) device: 0034:01:00.0 (socket 8)
EAL: Probe PCI driver: net_i40e (8086:1583) device: 0034:01:00.1 (socket 8)
APP: HPET is not enabled, using TSC as default timer RTE>>ring_perf_autotest
### Testing single element enq/deq ###
legacy APIs: SP/SC: single: 42.01
legacy APIs: MP/MC: single: 56.27
### Testing burst enq/deq ###
legacy APIs: SP/SC: burst (size: 8): 43.63
legacy APIs: SP/SC: burst (size: 32): 50.07
legacy APIs: MP/MC: burst (size: 8): 58.43
legacy APIs: MP/MC: burst (size: 32): 65.52
### Testing bulk enq/deq ###
legacy APIs: SP/SC: bulk (size: 8): 43.61
legacy APIs: SP/SC: bulk (size: 32): 50.05
legacy APIs: MP/MC: bulk (size: 8): 58.43
legacy APIs: MP/MC: bulk (size: 32): 65.50
### Testing empty bulk deq ###
legacy APIs: SP/SC: bulk (size: 8): 7.16
legacy APIs: MP/MC: bulk (size: 8): 7.16
### Testing using two hyperthreads ###
legacy APIs: SP/SC: bulk (size: 8): 12.44
legacy APIs: MP/MC: bulk (size: 8): 16.19
legacy APIs: SP/SC: bulk (size: 32): 3.10
legacy APIs: MP/MC: bulk (size: 32): 3.64
### Testing using all slave nodes ###
Bulk enq/dequeue count on size 8
Core [68] count = 362382
Core [69] count = 362516
Total count (size: 8): 724898
Bulk enq/dequeue count on size 32
Core [68] count = 361565
Core [69] count = 361852
Total count (size: 32): 723417
### Testing single element enq/deq ###
elem APIs: element size 16B: SP/SC: single: 42.81
elem APIs: element size 16B: MP/MC: single: 56.78
### Testing burst enq/deq ###
elem APIs: element size 16B: SP/SC: burst (size: 8): 45.04 elem APIs: element size 16B: SP/SC: burst (size: 32): 59.27 elem APIs: element size 16B: MP/MC: burst (size: 8): 60.68 elem APIs: element size 16B: MP/MC: burst (size: 32): 75.00
### Testing bulk enq/deq ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 45.05 elem APIs: element size 16B: SP/SC: bulk (size: 32): 59.23 elem APIs: element size 16B: MP/MC: bulk (size: 8): 60.64 elem APIs: element size 16B: MP/MC: bulk (size: 32): 75.11
### Testing empty bulk deq ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 7.16 elem APIs: element size 16B: MP/MC: bulk (size: 8): 7.16
### Testing using two hyperthreads ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 12.15 elem APIs: element size 16B: MP/MC: bulk (size: 8): 15.55 elem APIs: element size 16B: SP/SC: bulk (size: 32): 3.22 elem APIs: element size 16B: MP/MC: bulk (size: 32): 3.86
### Testing using all slave nodes ###
Bulk enq/dequeue count on size 8
Core [68] count = 374327
Core [69] count = 374433
Total count (size: 8): 748760
Bulk enq/dequeue count on size 32
Core [68] count = 324111
Core [69] count = 320038
Total count (size: 32): 644149
Test OK
Patched
=======
$ sudo app/test/dpdk-test -l 68,69 EAL: Detected 128 lcore(s) EAL: Detected 2 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: No available hugepages reported in hugepages-2048kB EAL: Probing VFIO support... EAL: VFIO support initialized EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0000:01:00.0 (socket 0) EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0000:01:00.1 (socket 0) EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0030:01:00.0 (socket 8) EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0030:01:00.1 (socket 8) EAL: using IOMMU type 7 (sPAPR) EAL: Probe PCI driver: net_i40e (8086:1583) device: 0034:01:00.0 (socket 8) EAL: Probe PCI driver: net_i40e (8086:1583) device: 0034:01:00.1 (socket 8) APP: HPET is not enabled, using TSC as default timer RTE>>ring_perf_autotest
### Testing single element enq/deq ###
legacy APIs: SP/SC: single: 42.00
legacy APIs: MP/MC: single: 56.27
### Testing burst enq/deq ###
legacy APIs: SP/SC: burst (size: 8): 43.63
legacy APIs: SP/SC: burst (size: 32): 50.04
legacy APIs: MP/MC: burst (size: 8): 58.42
legacy APIs: MP/MC: burst (size: 32): 65.51
### Testing bulk enq/deq ###
legacy APIs: SP/SC: bulk (size: 8): 43.61
legacy APIs: SP/SC: bulk (size: 32): 50.02
legacy APIs: MP/MC: bulk (size: 8): 58.43
legacy APIs: MP/MC: bulk (size: 32): 65.49
### Testing empty bulk deq ###
legacy APIs: SP/SC: bulk (size: 8): 7.16
legacy APIs: MP/MC: bulk (size: 8): 7.16
### Testing using two hyperthreads ###
legacy APIs: SP/SC: bulk (size: 8): 12.43
legacy APIs: MP/MC: bulk (size: 8): 16.17
legacy APIs: SP/SC: bulk (size: 32): 3.10
legacy APIs: MP/MC: bulk (size: 32): 3.65
### Testing using all slave nodes ###
Bulk enq/dequeue count on size 8
Core [68] count = 363208
Core [69] count = 363334
Total count (size: 8): 726542
Bulk enq/dequeue count on size 32
Core [68] count = 361592
Core [69] count = 361690
Total count (size: 32): 723282
### Testing single element enq/deq ###
elem APIs: element size 16B: SP/SC: single: 42.78
elem APIs: element size 16B: MP/MC: single: 56.75
### Testing burst enq/deq ###
elem APIs: element size 16B: SP/SC: burst (size: 8): 45.04 elem APIs: element size 16B: SP/SC: burst (size: 32): 59.27 elem APIs: element size 16B: MP/MC: burst (size: 8): 60.66 elem APIs: element size 16B: MP/MC: burst (size: 32): 75.03
### Testing bulk enq/deq ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 45.04 elem APIs: element size 16B: SP/SC: bulk (size: 32): 59.33 elem APIs: element size 16B: MP/MC: bulk (size: 8): 60.65 elem APIs: element size 16B: MP/MC: bulk (size: 32): 75.04
### Testing empty bulk deq ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 7.16 elem APIs: element size 16B: MP/MC: bulk (size: 8): 7.16
### Testing using two hyperthreads ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 12.14 elem APIs: element size 16B: MP/MC: bulk (size: 8): 15.56 elem APIs: element size 16B: SP/SC: bulk (size: 32): 3.22 elem APIs: element size 16B: MP/MC: bulk (size: 32): 3.86
### Testing using all slave nodes ###
Bulk enq/dequeue count on size 8
Core [68] count = 372618
Core [69] count = 372415
Total count (size: 8): 745033
Bulk enq/dequeue count on size 32
Core [68] count = 318784
Core [69] count = 316066
Total count (size: 32): 634850
Test OK
Re: [dpdk-dev] [PATCH 3/3] ring: use element APIs to implement legacy APIs
Hi, David
Quoted 16 lines
-----Original Message-----
From: David Christensen <[email protected]>
Sent: 2020年7月8日 4:07
To: Ananyev, Konstantin <[email protected]>; Feifei Wang <[email protected]>; Honnappa Nagarahalli <[email protected]>
Cc: [email protected]; nd <[email protected]>; Ruifeng Wang <[email protected]>
Subject: Re: [PATCH 3/3] ring: use element APIs to implement legacy APIsQuoted 3 lines · Konstantin
Hi Feifei,
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Hi, Konstantin, David
I'm Feifei Wang from Arm. Sorry to make the following request:
Would you please do some ring performance tests of this patch in yourplatforms at the time you are free?
Quoted 1 line
Quoted 1 line
And I want to know whether this patch has a significant impact on other
platforms except ARM.
Quoted 4 lines
I run few tests on SKX box and so far didn’t notice any real perf difference. Konstantin
Thanks very much for presenting these test results. Feifei
Quoted 226 lines
Full performance results for IBM POWER9 system below. I ran the tests twice for each version and the results were consistent.
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 43.63 43.63
legacy APIs: SP/SC: burst (size: 32): 50.07 50.04
legacy APIs: MP/MC: burst (size: 8): 58.43 58.42
legacy APIs: MP/MC: burst (size: 32): 65.52 65.51
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 43.61 43.61
legacy APIs: SP/SC: bulk (size: 32): 50.05 50.02
legacy APIs: MP/MC: bulk (size: 8): 58.43 58.43
legacy APIs: MP/MC: bulk (size: 32): 65.50 65.49HW:
Architecture: ppc64le Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Thread(s) per core: 4 Core(s) per socket: 16 Socket(s): 2 NUMA node(s): 6 Model: 2.3 (pvr 004e 1203) Model name: POWER9, altivec supported CPU max MHz: 3800.0000 CPU min MHz: 2300.0000 L1d cache: 32K L1i cache: 32K L2 cache: 512K L3 cache: 10240K NUMA node0 CPU(s): 0-63 NUMA node8 CPU(s): 64-127OS: RHEL 8.2
GCC: gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)
DPDK: 20.08.0-rc0 (
a8550b773)Unpatched
===========
sudo app/test/dpdk-test -l 68,69
EAL: Detected 128 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket/var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: No available hugepages reported in hugepages-2048kB
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: Probe PCI driver:net_mlx5(15b3:1019) device: 0000:01:00.0 (socket 0)
EAL: Probe PCI driver:net_mlx5(15b3:1019) device: 0000:01:00.1 (socket 0)
EAL: Probe PCI driver:net_mlx5(15b3:1019) device: 0030:01:00.0 (socket 8)
EAL: Probe PCI driver:net_mlx5(15b3:1019) device: 0030:01:00.1 (socket 8)
EAL: using IOMMU type 7 (sPAPR)
EAL: Probe PCI driver:net_i40e(8086:1583) device: 0034:01:00.0 (socket 8)
EAL: Probe PCI driver:net_i40e(8086:1583) device: 0034:01:00.1 (socket 8)
APP: HPET is not enabled, using TSC as default timer RTE>>ring_perf_autotest### Testing single element enq/deq ###
legacy APIs: SP/SC: single: 42.01
legacy APIs: MP/MC: single: 56.27### Testing burst enq/deq ###
legacy APIs: SP/SC: burst (size: 8): 43.63 legacy APIs: SP/SC: burst (size: 32):
50.07 legacy APIs: MP/MC: burst (size: 8): 58.43 legacy APIs: MP/MC: burst (size: 32): 65.52### Testing bulk enq/deq ###
legacy APIs: SP/SC: bulk (size: 8): 43.61 legacy APIs: SP/SC: bulk (size: 32):
50.05 legacy APIs: MP/MC: bulk (size: 8): 58.43 legacy APIs: MP/MC: bulk (size:
32): 65.50### Testing empty bulk deq ###
legacy APIs: SP/SC: bulk (size: 8): 7.16 legacy APIs: MP/MC: bulk (size: 8): 7.16### Testing using two hyperthreads ###
legacy APIs: SP/SC: bulk (size: 8): 12.44 legacy APIs: MP/MC: bulk (size: 8):
16.19 legacy APIs: SP/SC: bulk (size: 32): 3.10 legacy APIs: MP/MC: bulk (size:
32): 3.64### Testing using all slave nodes ###
Bulk enq/dequeue count on size 8
Core [68] count = 362382
Core [69] count = 362516
Total count (size: 8): 724898Bulk enq/dequeue count on size 32
Core [68] count = 361565
Core [69] count = 361852
Total count (size: 32): 723417### Testing single element enq/deq ###
elem APIs: element size 16B: SP/SC: single: 42.81 elem APIs: element size 16B:
MP/MC: single: 56.78### Testing burst enq/deq ###
elem APIs: element size 16B: SP/SC: burst (size: 8): 45.04 elem APIs: element size 16B: SP/SC: burst (size: 32): 59.27 elem APIs: element size 16B: MP/MC:
burst (size: 8): 60.68 elem APIs: element size 16B: MP/MC: burst (size: 32):
75.00### Testing bulk enq/deq ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 45.05 elem APIs: element size 16B: SP/SC: bulk (size: 32): 59.23 elem APIs: element size 16B: MP/MC:
bulk (size: 8): 60.64 elem APIs: element size 16B: MP/MC: bulk (size: 32):
75.11### Testing empty bulk deq ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 7.16 elem APIs: element size 16B: MP/MC: bulk (size: 8): 7.16### Testing using two hyperthreads ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 12.15 elem APIs: element size 16B: MP/MC: bulk (size: 8): 15.55 elem APIs: element size 16B: SP/SC:
bulk (size: 32): 3.22 elem APIs: element size 16B: MP/MC: bulk (size: 32): 3.86### Testing using all slave nodes ###
Bulk enq/dequeue count on size 8
Core [68] count = 374327
Core [69] count = 374433
Total count (size: 8): 748760Bulk enq/dequeue count on size 32
Core [68] count = 324111
Core [69] count = 320038
Total count (size: 32): 644149
Test OKPatched
=======$ sudo app/test/dpdk-test -l 68,69 EAL: Detected 128 lcore(s) EAL: Detected 2 NUMA nodes EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: No available hugepages reported in hugepages-2048kB EAL: Probing VFIO support... EAL: VFIO support initialized EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0000:01:00.0 (socket 0) EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0000:01:00.1 (socket 0) EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0030:01:00.0 (socket 8) EAL: Probe PCI driver: net_mlx5 (15b3:1019) device: 0030:01:00.1 (socket 8) EAL: using IOMMU type 7 (sPAPR) EAL: Probe PCI driver: net_i40e (8086:1583) device: 0034:01:00.0 (socket 8) EAL: Probe PCI driver: net_i40e (8086:1583) device: 0034:01:00.1 (socket 8) APP: HPET is not enabled, using TSC as default timer RTE>>ring_perf_autotest### Testing single element enq/deq ###
legacy APIs: SP/SC: single: 42.00
legacy APIs: MP/MC: single: 56.27### Testing burst enq/deq ###
legacy APIs: SP/SC: burst (size: 8): 43.63 legacy APIs: SP/SC: burst (size: 32):
50.04 legacy APIs: MP/MC: burst (size: 8): 58.42 legacy APIs: MP/MC: burst (size: 32): 65.51### Testing bulk enq/deq ###
legacy APIs: SP/SC: bulk (size: 8): 43.61 legacy APIs: SP/SC: bulk (size: 32):
50.02 legacy APIs: MP/MC: bulk (size: 8): 58.43 legacy APIs: MP/MC: bulk (size:
32): 65.49### Testing empty bulk deq ###
legacy APIs: SP/SC: bulk (size: 8): 7.16 legacy APIs: MP/MC: bulk (size: 8): 7.16### Testing using two hyperthreads ###
legacy APIs: SP/SC: bulk (size: 8): 12.43 legacy APIs: MP/MC: bulk (size: 8):
16.17 legacy APIs: SP/SC: bulk (size: 32): 3.10 legacy APIs: MP/MC: bulk (size:
32): 3.65### Testing using all slave nodes ###
Bulk enq/dequeue count on size 8
Core [68] count = 363208
Core [69] count = 363334
Total count (size: 8): 726542Bulk enq/dequeue count on size 32
Core [68] count = 361592
Core [69] count = 361690
Total count (size: 32): 723282### Testing single element enq/deq ###
elem APIs: element size 16B: SP/SC: single: 42.78 elem APIs: element size 16B:
MP/MC: single: 56.75### Testing burst enq/deq ###
elem APIs: element size 16B: SP/SC: burst (size: 8): 45.04 elem APIs: element size 16B: SP/SC: burst (size: 32): 59.27 elem APIs: element size 16B: MP/MC:
burst (size: 8): 60.66 elem APIs: element size 16B: MP/MC: burst (size: 32):
75.03### Testing bulk enq/deq ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 45.04 elem APIs: element size 16B: SP/SC: bulk (size: 32): 59.33 elem APIs: element size 16B: MP/MC:
bulk (size: 8): 60.65 elem APIs: element size 16B: MP/MC: bulk (size: 32):
75.04### Testing empty bulk deq ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 7.16 elem APIs: element size 16B: MP/MC: bulk (size: 8): 7.16### Testing using two hyperthreads ###
elem APIs: element size 16B: SP/SC: bulk (size: 8): 12.14 elem APIs: element size 16B: MP/MC: bulk (size: 8): 15.56 elem APIs: element size 16B: SP/SC:
bulk (size: 32): 3.22 elem APIs: element size 16B: MP/MC: bulk (size: 32): 3.86### Testing using all slave nodes ###
Bulk enq/dequeue count on size 8
Core [68] count = 372618
Core [69] count = 372415
Total count (size: 8): 745033Bulk enq/dequeue count on size 32
Core [68] count = 318784
Core [69] count = 316066
Total count (size: 32): 634850
Test OK
Re: [dpdk-dev] [PATCH 3/3] ring: use element APIs to implement legacy APIs
In reply to Ananyev, KonstantinHi, Konstantin
Thanks very much for your effort.
Feifei
Quoted 538 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: 2020年7月7日 22:04
To: Feifei Wang <[email protected]>; Honnappa Nagarahalli <[email protected]>; [email protected]
Cc: [email protected]; nd <[email protected]>; Ruifeng Wang <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH 3/3] ring: use element APIs to implement legacy APIsHi Feifei,
Quoted 4 lines
Hi, Konstantin, David
I'm Feifei Wang from Arm. Sorry to make the following request:
Would you please do some ring performance tests of this patch in yourplatforms at the time you are free?
Quoted 1 line
And I want to know whether this patch has a significant impact on other
platforms except ARM.
I run few tests on SKX box and so far didn’t notice any real perf difference. Konstantin
Quoted 66 lines
Thanks very much.
FeifeiQuoted 63 lines
-----Original Message-----
From: Feifei Wang <[email protected]>
Sent: 2020年7月3日 18:27
To: Honnappa Nagarahalli <[email protected]>; Konstantin Ananyev <[email protected]>
Cc: [email protected]; nd <[email protected]>; Feifei Wang <[email protected]>
Subject: [PATCH 3/3] ring: use element APIs to implement legacy APIsUse
rte_ring_xxx_elem_xxxAPIs to replace legacy API implementation. This reduces code duplication and improves code maintenance.aarch64:
HW:N1sdp, 1 socket, 4 cores, 1 thread/core, 2.6GHz OS:Ubuntu 18.04.1 LTS,
Kernel: 5.4.0+
DPDK: 20.05-rc3, Configuration: arm64-n1sdp-linux-gcc gcc:9.2.1$sudo ./arm64-n1sdp-linux-gcc/app/test -l 1-2
RTE>>ring_perf_autotesttest results on aarch64 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 1.11 1.10
legacy APIs: SP/SC: burst (size: 32): 1.95 1.97
legacy APIs: MP/MC: burst (size: 8): 1.86 1.94
legacy APIs: MP/MC: burst (size: 32): 2.65 2.69
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 1.08 1.09
legacy APIs: SP/SC: bulk (size: 32): 1.89 1.90
legacy APIs: MP/MC: bulk (size: 8): 1.85 1.98
legacy APIs: MP/MC: bulk (size: 32): 2.65 2.69x86:
HW: dell, CPU Intel(R) Xeon(R) Gold 6240, 2 sockets, 18 cores/socket,
1 thread/core, 3.3GHz
OS: Ubuntu 20.04 LTS, Kernel: 5.4.0-37-generic
DPDK: 20.05-rc3, Configuration: x86_64-native-linuxapp-gcc
gcc: 9.3.0$sudo ./x86_64-native-linuxapp-gcc/app/test -l 14,16 RTE>>ring_perf_autotest
test results on x86 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 29.35 27.78
legacy APIs: SP/SC: burst (size: 32): 73.11 73.39
legacy APIs: MP/MC: burst (size: 8): 62.36 62.37
legacy APIs: MP/MC: burst (size: 32): 101.01 101.03
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 25.94 29.55
legacy APIs: SP/SC: bulk (size: 32): 70.00 78.87
legacy APIs: MP/MC: bulk (size: 8): 63.41 62.48
legacy APIs: MP/MC: bulk (size: 32): 105.86 103.84Summary:
In aarch64 server with this patch, there is almost no performancedifference.
Quoted 102 lines
Quoted 102 lines
In x86 server with this patch, in some cases, the performance slightly improve, in other cases, the performance slightly drop.
Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>--- lib/librte_ring/rte_ring.h | 284 ++++--------------------------------- 1 file changed, 30 insertions(+), 254 deletions(-)lib/librte_ring/rte_ring.h +0
-65@@ -191,168 +191,6 @@ void rte_ring_free(struct rte_ring *r);*/ void rte_ring_dump (FILE *f,const struct rte_ring *r); -/* the actual enqueue of pointers on the ring. -* Placed here since identical code needed in both - * single and multi producer enqueue functions */ -#define ENQUEUE_PTRS(r, ring_start, prod_head, obj_table, n, obj_type) do { \ - unsigned int i; \ - const uint32_t size = (r)->size; \ - uint32_t idx = prod_head & (r)->mask; \ - obj_type *ring = (obj_type *)ring_start; \ - if (likely(idx + n < size)) { \ - for (i = 0; i < (n & ~0x3); i += 4, idx += 4) { \ - ring[idx] = obj_table[i]; \ - ring[idx + 1] = obj_table[i + 1]; \ - ring[idx + 2] = obj_table[i + 2]; \ - ring[idx + 3] = obj_table[i + 3]; \ - } \ - switch (n & 0x3) { \ - case 3: \ - ring[idx++] = obj_table[i++];/* fallthrough */ \ -case 2 : \ - ring[idx++] = obj_table[i++];/* fallthrough */ \ -case 1 : \ - ring[idx++] = obj_table[i++]; \ - } \ - } else { \ -for (i =0 ; idx < size; i++, idx++)\ - ring[idx] = obj_table[i]; \ -for (idx =0 ; i < n; i++, idx++) \ - ring[idx] = obj_table[i]; \ - } \ -} while (0) - -/* the actual copy of pointers on the ring to obj_table. - * Placed here since identical code needed in both - * single and multi consumer dequeue functions */ -#define DEQUEUE_PTRS(r, ring_start, cons_head, obj_table, n, obj_type) do { \ - unsigned int i; \ - uint32_t idx = cons_head & (r)->mask; \ - const uint32_t size = (r)->size; \ - obj_type *ring = (obj_type *)ring_start; \ - if (likely(idx + n < size)) { \ - for (i = 0; i < (n & ~0x3); i += 4, idx += 4) {\ - obj_table[i] = ring[idx]; \ - obj_table[i + 1] = ring[idx + 1]; \ - obj_table[i + 2] = ring[idx + 2]; \ - obj_table[i + 3] = ring[idx + 3]; \ - } \ - switch (n & 0x3) { \ - case 3: \ - obj_table[i++] = ring[idx++];/* fallthrough */ \ -case 2 : \ - obj_table[i++] = ring[idx++];/* fallthrough */ \ -case 1 : \ - obj_table[i++] = ring[idx++]; \ - } \ - } else { \ -for (i =0 ; idx < size; i++, idx++) \ - obj_table[i] = ring[idx]; \ -for (idx =0 ; i < n; i++, idx++) \ - obj_table[i] = ring[idx]; \ - } \ -} while (0) - -/* Between load and load. there might be cpu reorder in weak model -* (powerpc/arm). -* There are 2 choices for the users -* 1.use rmb() memory barrier -* 2.use one-direction load_acquire/store_release barrier,defined by
- *CONFIG_RTE_USE_C11_MEM_MODEL=y
- * It depends on performance test results.
- * By default, move common functions torte_ring_generic.h
- */lib/librte_ring/rte_ring.h +0
-11-#ifdef RTE_USE_C11_MEM_MODEL -#include "rte_ring_c11_mem.h" -#else -#include "rte_ring_generic.h" -#endif - -/** -* @internal Enqueue several objects on the ring -* -* @param r -* A pointer to the ring structure. Quoted 8 lines
Quoted 8 lines
- * @param
obj_table
- * A pointer to a table of void * pointers (objects).
- * @param n
- * The number of objects to add in the ring from theobj_table.
- * @param behavior
- *RTE_RING_QUEUE_FIXED: Enqueue a fixed number of items from a
ring
- *RTE_RING_QUEUE_VARIABLE: Enqueue as many items as possiblefrom
Quoted 3 lines
Quoted 3 lines
ring
- * @paramis_sp
- * Indicates whether to use single producer or multi-producer headupdate
Quoted 2 lines
Quoted 2 lines
- * @param
free_space
- * returns the amount of space after the enqueue operation hasfinished
Quoted 31 lines
Quoted 31 lines
- * @return
- * Actual number of objects enqueued.
- * If behavior ==RTE_RING_QUEUE_FIXED, this will be 0 or n only.
- */lib/librte_ring/rte_ring.h +0
-27-static __rte_always_inline unsigned int -__rte_ring_do_enqueue (struct rte_ring *r,void *const *obj_table, -unsigned int n,enum rte_ring_queue_behavior behavior, -unsigned int is_sp,unsigned int *free_space) -{ -uint32_t prod_head, prod_next; -uint32_t free_entries; - - n =__rte_ring_move_prod_head (r, is_sp, n, behavior, - &prod_head, &prod_next, &free_entries); -if (n ==0 ) - goto end; - - ENQUEUE_PTRS(r, &r[1], prod_head, obj_table, n, void *); - -update_tail (&r->prod, prod_head, prod_next, is_sp,1 ); -end: -if (free_space !=NULL ) - *free_space = free_entries - n; -return n; -} - -/** -* @internal Dequeue several objects from the ring -* -* @param r -* A pointer to the ring structure. Quoted 8 lines
Quoted 8 lines
- * @param
obj_table
- * A pointer to a table of void * pointers (objects).
- * @param n
- * The number of objects to pull from the ring.
- * @param behavior
- *RTE_RING_QUEUE_FIXED: Dequeue a fixed number of items from a
ring
- *RTE_RING_QUEUE_VARIABLE: Dequeue as many items as possiblefrom
Quoted 133 lines
Quoted 133 lines
ring
- * @paramis_sc
- * Indicates whether to use single consumer or multi-consumer head
update
- * @param available
- * returns the number of remaining ring entries after the dequeue has
finished
- * @return
- * - Actual number of objects dequeued.
- * If behavior ==RTE_RING_QUEUE_FIXED, this will be 0 or n only.
- */lib/librte_ring/rte_ring.h +6
-45-static __rte_always_inline unsigned int -__rte_ring_do_dequeue (struct rte_ring *r,void **obj_table, -unsigned int n,enum rte_ring_queue_behavior behavior, -unsigned int is_sc,unsigned int *available) -{ -uint32_t cons_head, cons_next; -uint32_t entries; - - n =__rte_ring_move_cons_head (r, (int )is_sc, n, behavior, - &cons_head, &cons_next, &entries); -if (n ==0 ) - goto end; - - DEQUEUE_PTRS(r, &r[1], cons_head, obj_table, n, void *); - -update_tail (&r->cons, cons_head, cons_next, is_sc,0 ); - -end: -if (available !=NULL ) - *available = entries - n; -return n; -} -/** * Enqueue several objects on the ring (multi-producers safe). * @@ -375,8 +213,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_MT, free_space); + return rte_ring_mp_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/** @@ -398,8 +236,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_ST, free_space); + return rte_ring_sp_enqueue_bulk_elem(r, obj_table, sizeof(void *), + n, free_space); }/** @@ -425,24 +263,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - switch (r->prod.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mp_enqueue_bulk(r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_bulk (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mp_rts_enqueue_bulk (r, obj_table, n, - free_space); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mp_hts_enqueue_bulk (r, obj_table, n, - free_space); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_enqueue_bulk_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +0
-0@@ -462,7 +284,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void *const
*obj_table, static__rte_always_inlineintrte_ring_mp_enqueue(struct rte_ring *r, void *obj){lib/librte_ring/rte_ring.h +1
-1-return rte_ring_mp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_mp_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -479,7 +301,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline int rte_ring_sp_enqueue(struct
rte_ring*r, void
*obj) {lib/librte_ring/rte_ring.h +6
-6-return rte_ring_sp_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_sp_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -500,7 +322,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline int rte_ring_enqueue(structrte_ring *r,void *obj) { -return rte_ring_enqueue_bulk (r, &obj,1 ,NULL ) ?0 : -ENOBUFS ; +return rte_ring_enqueue_elem (r, obj,sizeof (void *)); }/** @@ -525,8 +347,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_MT, available); + return rte_ring_mc_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }/** @@ -549,8 +371,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n,RTE_RING_QUEUE_FIXED , - RTE_RING_SYNC_ST, available); + return rte_ring_sc_dequeue_bulk_elem(r, obj_table, sizeof(void *), + n, available); }Quoted 3 lines
Quoted 3 lines
lib/librte_ring/rte_ring.h +0
-0/** @@ -576,22 +398,8 @@ static __rte_always_inline unsigned intrte_ring_dequeue_bulk(struct
rte_ring*r, void **obj_table, unsigned intn,
Quoted 153 lines
Quoted 153 lines
lib/librte_ring/rte_ring.h +0
-8unsigned int *available) { -switch (r->cons.sync_type) { -case RTE_RING_SYNC_MT : -return rte_ring_mc_dequeue_bulk (r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_bulk (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : - return rte_ring_mc_rts_dequeue_bulk(r, obj_table, n,available);
lib/librte_ring/rte_ring.h +0
-2-case RTE_RING_SYNC_MT_HTS : - return rte_ring_mc_hts_dequeue_bulk(r, obj_table, n,available);
lib/librte_ring/rte_ring.h +4
-8-#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_dequeue_bulk_elem (r, obj_table,sizeof (void *), + n, available); }/** @@ -612,7 +420,7 @@ rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n, static __rte_always_inline intrte_ring_mc_dequeue (struct rte_ring *r,void **obj_p) { -return rte_ring_mc_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_mc_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -630,7 +438,7 @@ rte_ring_mc_dequeue(struct rte_ring *r, void **obj_p) static __rte_always_inline int rte_ring_sc_dequeue(structrte_ring *r,void **obj_p) { -return rte_ring_sc_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_sc_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -652,7 +460,7 @@ rte_ring_sc_dequeue(struct rte_ring *r, void **obj_p) static __rte_always_inline int rte_ring_dequeue(struct
rte_ring*r, void
**obj_p) {lib/librte_ring/rte_ring.h +3
-3-return rte_ring_dequeue_bulk (r, obj_p,1 ,NULL ) ?0 : -ENOENT ; +return rte_ring_dequeue_elem (r, obj_p,sizeof (void *)); }/** @@ -860,8 +668,8 @@ static __rte_always_inline unsigned int rte_ring_mp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, free_space); +return rte_ring_mp_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +4
-20@@ -883,8 +691,8 @@ static __rte_always_inline unsigned int rte_ring_sp_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - return __rte_ring_do_enqueue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, free_space); +return rte_ring_sp_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/** @@ -910,24 +718,8 @@ static __rte_always_inline unsigned int rte_ring_enqueue_burst(struct rte_ring *r, void * const *obj_table, unsigned int n, unsigned int *free_space) { - switch (r->prod.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mp_enqueue_burst(r, obj_table, n, free_space); -case RTE_RING_SYNC_ST : -return rte_ring_sp_enqueue_burst (r, obj_table, n, free_space); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mp_rts_enqueue_burst (r, obj_table, n, - free_space); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mp_hts_enqueue_burst (r, obj_table, n, - free_space); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_enqueue_burst_elem (r, obj_table,sizeof (void *), + n, free_space); }/**
lib/librte_ring/rte_ring.h +2
-2@@ -954,8 +746,8 @@ static __rte_always_inline unsigned int rte_ring_mc_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_MT, available); +return rte_ring_mc_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }/**
lib/librte_ring/rte_ring.h +4
-21@@ -979,8 +771,8 @@ static __rte_always_inline unsigned int rte_ring_sc_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - return __rte_ring_do_dequeue(r, obj_table, n, - RTE_RING_QUEUE_VARIABLE, RTE_RING_SYNC_ST, available); +return rte_ring_sc_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }/** @@ -1006,24 +798,8 @@ static __rte_always_inline unsigned int rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available) { - switch (r->cons.sync_type) { - case RTE_RING_SYNC_MT: - return rte_ring_mc_dequeue_burst(r, obj_table, n, available); -case RTE_RING_SYNC_ST : -return rte_ring_sc_dequeue_burst (r, obj_table, n, available); -#ifdef ALLOW_EXPERIMENTAL_API -case RTE_RING_SYNC_MT_RTS : -return rte_ring_mc_rts_dequeue_burst (r, obj_table, n, - available); -case RTE_RING_SYNC_MT_HTS : -return rte_ring_mc_hts_dequeue_burst (r, obj_table, n, - available); -#endif - } - -/* valid ring should never reach this point */ -RTE_ASSERT (0 ); -return 0 ; +return rte_ring_dequeue_burst_elem (r, obj_table,sizeof (void *), + n, available); }#ifdef __cplusplus --2.17.1
Re: [dpdk-dev] [PATCH 3/3] ring: use element APIs to implement legacy APIs
In reply to Feifei WangQuoted 57 lines
Use
rte_ring_xxx_elem_xxxAPIs to replace legacy API implementation. This reduces code duplication and improves code maintenance.aarch64:
HW:N1sdp, 1 socket, 4 cores, 1 thread/core, 2.6GHz OS:Ubuntu 18.04.1 LTS, Kernel: 5.4.0+
DPDK: 20.05-rc3, Configuration: arm64-n1sdp-linux-gcc gcc:9.2.1$sudo ./arm64-n1sdp-linux-gcc/app/test -l 1-2
RTE>>ring_perf_autotesttest results on aarch64 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 1.11 1.10
legacy APIs: SP/SC: burst (size: 32): 1.95 1.97
legacy APIs: MP/MC: burst (size: 8): 1.86 1.94
legacy APIs: MP/MC: burst (size: 32): 2.65 2.69
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 1.08 1.09
legacy APIs: SP/SC: bulk (size: 32): 1.89 1.90
legacy APIs: MP/MC: bulk (size: 8): 1.85 1.98
legacy APIs: MP/MC: bulk (size: 32): 2.65 2.69x86:
HW: dell, CPU Intel(R) Xeon(R) Gold 6240, 2 sockets, 18 cores/socket, 1 thread/core, 3.3GHz
OS: Ubuntu 20.04 LTS, Kernel: 5.4.0-37-generic
DPDK: 20.05-rc3, Configuration: x86_64-native-linuxapp-gcc
gcc: 9.3.0$sudo ./x86_64-native-linuxapp-gcc/app/test -l 14,16 RTE>>ring_perf_autotest
test results on x86 in the case of esize 4:
without this patch with this patch
Testing burst enq/deq
legacy APIs: SP/SC: burst (size: 8): 29.35 27.78
legacy APIs: SP/SC: burst (size: 32): 73.11 73.39
legacy APIs: MP/MC: burst (size: 8): 62.36 62.37
legacy APIs: MP/MC: burst (size: 32): 101.01 101.03
Testing bulk enq/deq
legacy APIs: SP/SC: bulk (size: 8): 25.94 29.55
legacy APIs: SP/SC: bulk (size: 32): 70.00 78.87
legacy APIs: MP/MC: bulk (size: 8): 63.41 62.48
legacy APIs: MP/MC: bulk (size: 32): 105.86 103.84Summary:
In aarch64 server with this patch, there is almost no performance difference.
In x86 server with this patch, in some cases, the performance slightly improve, in other cases, the performance slightly drop.
Quoted 4 lines
Signed-off-by Feifei Wang <[email protected]>Reviewed-by Honnappa Nagarahalli <[email protected]>Reviewed-by Ruifeng Wang <[email protected]>---
Quoted 1 line
2.17.1
Quoted 4 lines · Feifei Wang
Do some work for ring refactoring, which includes:
1. remove experimental tags
2. use element APIs to implement legacy APIs
This series triggers unit test failures.
https://travis-ci.com/github/ovsrobot/dpdk/builds/174196115
https://travis-ci.com/github/ovsrobot/dpdk/jobs/357314387#L1092
In my env:
test_refcnt_slave started at lcore 22test_refcnt_slave started at lcore 23test_refcnt_slave started at lcore 24test_refcnt_slave started at lcore 25test_refcnt_slave started at lcore 26test_refcnt_slave started at lcore 27test_refcnt_master started at lcore 1
Thread 6 "lcore-slave-4" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff4723400 (LWP 374679)] 0x00000000007e29d0 in rte_pktmbuf_free (m=0xffff000100010000) at ../../dpdk/lib/librte_mbuf/rte_mbuf.h:1407
1407 m_next = m->next;
Missing separate debuginfos, use: dnf debuginfo-install dbus-libs-1.12.18-1.fc31.x86_64 elfutils-libelf-0.179-2.fc31.x86_64 jansson-2.12-4.fc31.x86_64 libbpf-0.0.7-1.fc31.x86_64 libbsd-0.9.1-4.fc31.x86_64 libfdt-1.6.0-1.fc31.x86_64 libgcc-9.3.1-2.fc31.x86_64 libgcrypt-1.8.5-1.fc31.x86_64 libnl3-3.5.0-1.fc31.x86_64 libpcap-1.9.1-2.fc31.x86_64 lz4-libs-1.9.1-1.fc31.x86_64 numactl-libs-2.0.12-3.fc31.x86_64 openssl-libs-1.1.1g-1.fc31.x86_64 systemd-libs-243.8-1.fc31.x86_64 xz-libs-5.2.5-1.fc31.x86_64 zlib-1.2.11-20.fc31.x86_64
(gdb) bt
#0 0x00000000007e29d0 in rte_pktmbuf_free (m=0xffff000100010000) at ../../dpdk/lib/librte_mbuf/rte_mbuf.h:1407
#1 test_refcnt_slave (arg=0x17f7e3940) at ../../dpdk/app/test/test_mbuf.c:1016 #2 0x0000000000446a89 in eal_thread_loop (arg=<optimized out>) at ../../dpdk/lib/librte_eal/linux/eal_thread.c:127
#3 0x00007ffff709c4e2 in start_thread () from /usr/lib64/libpthread.so.0 #4 0x00007ffff6fc96a3 in clone () from /usr/lib64/libc.so.6
Thanks.
Signature · 1 line
David Marchand
Quoted 35 lines · Feifei Wang
Quoted 4 lines
Do some work for ring refactoring, which includes:
1. remove experimental tags
2. use element APIs to implement legacy APIsThis series triggers unit test failures.
https://travis-ci.com/github/ovsrobot/dpdk/builds/174196115https://travis-ci.com/github/ovsrobot/dpdk/jobs/357314387#L1092
In my env:
test_refcnt_slavestarted at lcore 22test_refcnt_slavestarted at lcore 23test_refcnt_slavestarted at lcore 24test_refcnt_slavestarted at lcore 25test_refcnt_slavestarted at lcore 26test_refcnt_slavestarted at lcore 27test_refcnt_masterstarted at lcore 1Thread 6 "lcore-slave-4" received signal SIGSEGV, Segmentation fault. [Switching to Thread
0x7ffff4723400(LWP 374679)]0x00000000007e29d0inrte_pktmbuf_free(m=0xffff000100010000) at../../dpdk/lib/librte_mbuf/rte_mbuf.h:1407
1407m_next=m->next;
Missing separate debuginfos, use: dnf debuginfo-install dbus-libs-1.12.18-1.fc31.x86_64 elfutils-libelf-0.179-2.fc31.x86_64 jansson-2.12-4.fc31.x86_64 libbpf-0.0.7-1.fc31.x86_64 libbsd-0.9.1-4.fc31.x86_64 libfdt-1.6.0-1.fc31.x86_64 libgcc-9.3.1-2.fc31.x86_64 libgcrypt-1.8.5-1.fc31.x86_64 libnl3-3.5.0-1.fc31.x86_64 libpcap-1.9.1-2.fc31.x86_64 lz4-libs-1.9.1-1.fc31.x86_64 numactl-libs-2.0.12-3.fc31.x86_64 openssl-libs-1.1.1g-1.fc31.x86_64 systemd-libs-243.8-1.fc31.x86_64 xz-libs-5.2.5-1.fc31.x86_64 zlib-1.2.11-20.fc31.x86_64
Quoted 9 lines
(gdb) bt
#00x00000000007e29d0inrte_pktmbuf_free(m=0xffff000100010000) at../../dpdk/lib/librte_mbuf/rte_mbuf.h:1407
#1test_refcnt_slave(arg=0x17f7e3940) at../../dpdk/app/test/test_mbuf.c:1016#20x0000000000446a89ineal_thread_loop(arg=<optimized out>) at../../dpdk/lib/librte_eal/linux/eal_thread.c:127
#30x00007ffff709c4e2instart_thread() from/usr/lib64/libpthread.so.0#40x00007ffff6fc96a3in clone () from/usr/lib64/libc.so.6
Ah, yes indeed there is problem within single enqueue. It should be:
lib/librte_ring/rte_ring.h +3 -3
@@ -284,7 +284,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table, static __rte_always_inline intrte_ring_mp_enqueue (struct rte_ring *r,void *obj) { -return rte_ring_mp_enqueue_elem (r, obj,sizeof (void *)); +return rte_ring_mp_enqueue_elem (r, &obj,sizeof (void *)); }/**
@@ -301,7 +301,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline intrte_ring_sp_enqueue (struct rte_ring *r,void *obj) { -return rte_ring_sp_enqueue_elem (r, obj,sizeof (void *)); +return rte_ring_sp_enqueue_elem (r, &obj,sizeof (void *)); }/**
@@ -322,7 +322,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline intrte_ring_enqueue (struct rte_ring *r,void *obj) { -return rte_ring_enqueue_elem (r, obj,sizeof (void *)); +return rte_ring_enqueue_elem (r, &obj,sizeof (void *)); }/**
<snip>
Quoted 73 lines
Quoted 38 lines · Feifei Wang
Quoted 4 lines
Do some work for ring refactoring, which includes:
1. remove experimental tags
2. use element APIs to implement legacy APIsThis series triggers unit test failures.
https://travis-ci.com/github/ovsrobot/dpdk/builds/174196115https://travis-ci.com/github/ovsrobot/dpdk/jobs/357314387#L1092
In my env:
test_refcnt_slavestarted at lcore 22test_refcnt_slavestarted at lcore 23test_refcnt_slavestarted at lcore 24test_refcnt_slavestarted at lcore 25test_refcnt_slavestarted at lcore 26test_refcnt_slavestarted at lcore 27test_refcnt_masterstarted at lcore 1Thread 6 "lcore-slave-4" received signal SIGSEGV, Segmentation fault. [Switching to Thread
0x7ffff4723400(LWP 374679)]0x00000000007e29d0inrte_pktmbuf_free(m=0xffff000100010000) at../../dpdk/lib/librte_mbuf/rte_mbuf.h:1407
1407m_next=m->next;
Missing separate debuginfos, use: dnf debuginfo-install dbus-libs-1.12.18-1.fc31.x86_64 elfutils-libelf-0.179-2.fc31.x86_64 jansson-2.12-4.fc31.x86_64 libbpf-0.0.7-1.fc31.x86_64 libbsd-0.9.1-4.fc31.x86_64 libfdt-1.6.0-1.fc31.x86_64 libgcc-9.3.1-2.fc31.x86_64 libgcrypt-1.8.5-1.fc31.x86_64 libnl3-3.5.0-1.fc31.x86_64 libpcap-1.9.1-2.fc31.x86_64 lz4-libs-1.9.1-1.fc31.x86_64 numactl-libs-2.0.12-3.fc31.x86_64 openssl-libs-1.1.1g-1.fc31.x86_64 systemd-libs-243.8-1.fc31.x86_64 xz-libs-5.2.5-1.fc31.x86_64 zlib-1.2.11-20.fc31.x86_64 (gdb) bt
#00x00000000007e29d0inrte_pktmbuf_free(m=0xffff000100010000) atQuoted 9 lines
../../dpdk/lib/librte_mbuf/rte_mbuf.h:1407
#1test_refcnt_slave(arg=0x17f7e3940) at../../dpdk/app/test/test_mbuf.c:1016
#20x0000000000446a89ineal_thread_loop(arg=<optimized out>) at../../dpdk/lib/librte_eal/linux/eal_thread.c:127
#30x00007ffff709c4e2instart_thread() from/usr/lib64/libpthread.so.0
#40x00007ffff6fc96a3in clone () from/usr/lib64/libc.so.6Ah, yes indeed there is problem within single enqueue. It should be:
lib/librte_ring/rte_ring.h index renamed from lib/librte_ring/rte_ring.h +0
-0
2a2190bfc..da17ed6d7100644lib/librte_ring/rte_ring.h +1
-1@@ -284,7 +284,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void * const *obj_table, static __rte_always_inline int rte_ring_mp_enqueue(structrte_ring *r,void *obj) { -return rte_ring_mp_enqueue_elem (r, obj,sizeof (void *)); +return rte_ring_mp_enqueue_elem (r, &obj,sizeof (void *)); }/** @@ -301,7 +301,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj)static
__rte_always_inlineintrte_ring_sp_enqueue(struct rte_ring *r, void *obj){lib/librte_ring/rte_ring.h +1
-1-return rte_ring_sp_enqueue_elem (r, obj,sizeof (void *)); +return rte_ring_sp_enqueue_elem (r, &obj,sizeof (void *)); }/**
lib/librte_ring/rte_ring.h rte_ring_sp_enqueue(struct rte_ring *r, void *obj) · line 325
Quoted 5 lines
lib/librte_ring/rte_ring.h +1
-1@@ -322,7 +322,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline int rte_ring_enqueue(struct rte_ring *r, void *obj) { -return rte_ring_enqueue_elem (r, obj,sizeof (void *)); +return rte_ring_enqueue_elem (r, &obj,sizeof (void *)); }
Thanks, same conclusion. table_autotest was failing, that passes as well.
Quoted 2 lines
lib/librte_ring/rte_ring.h +0
-0/**
Quoted 58 lines
-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: 2020年7月9日 1:06
To: David Marchand <[email protected]>; Feifei Wang <[email protected]>
Cc: dev <[email protected]>; nd <[email protected]>
Subject: RE: [dpdk-dev] [PATCH 0/3] ring clean upQuoted 46 lines · Feifei Wang
Quoted 4 lines
Do some work for ring refactoring, which includes:
1. remove experimental tags
2. use element APIs to implement legacy APIsThis series triggers unit test failures.
https://travis-ci.com/github/ovsrobot/dpdk/builds/174196115https://travis-ci.com/github/ovsrobot/dpdk/jobs/357314387#L1092
In my env:
test_refcnt_slavestarted at lcore 22test_refcnt_slavestarted at lcore 23test_refcnt_slavestarted at lcore 24test_refcnt_slavestarted at lcore 25test_refcnt_slavestarted at lcore 26test_refcnt_slavestarted at lcore 27test_refcnt_masterstarted at lcore 1Thread 6 "lcore-slave-4" received signal SIGSEGV, Segmentation fault. [Switching to Thread
0x7ffff4723400(LWP 374679)]0x00000000007e29d0inrte_pktmbuf_free(m=0xffff000100010000) at../../dpdk/lib/librte_mbuf/rte_mbuf.h:1407
1407m_next=m->next;
Missing separate debuginfos, use: dnf debuginfo-install dbus-libs-1.12.18-1.fc31.x86_64 elfutils-libelf-0.179-2.fc31.x86_64 jansson-2.12-4.fc31.x86_64 libbpf-0.0.7-1.fc31.x86_64 libbsd-0.9.1-4.fc31.x86_64 libfdt-1.6.0-1.fc31.x86_64 libgcc-9.3.1-2.fc31.x86_64 libgcrypt-1.8.5-1.fc31.x86_64 libnl3-3.5.0-1.fc31.x86_64 libpcap-1.9.1-2.fc31.x86_64 lz4-libs-1.9.1-1.fc31.x86_64 numactl-libs-2.0.12-3.fc31.x86_64 openssl-libs-1.1.1g-1.fc31.x86_64 systemd-libs-243.8-1.fc31.x86_64 xz-libs-5.2.5-1.fc31.x86_64 zlib-1.2.11-20.fc31.x86_64 (gdb) bt
#00x00000000007e29d0inrte_pktmbuf_free(m=0xffff000100010000) at../../dpdk/lib/librte_mbuf/rte_mbuf.h:1407
#1test_refcnt_slave(arg=0x17f7e3940) at../../dpdk/app/test/test_mbuf.c:1016
#20x0000000000446a89ineal_thread_loop(arg=<optimized out>) at../../dpdk/lib/librte_eal/linux/eal_thread.c:127
#30x00007ffff709c4e2instart_thread() from/usr/lib64/libpthread.so.0
#40x00007ffff6fc96a3in clone () from/usr/lib64/libc.so.6
Hi, Konstantin
Thanks very much for your effort.
We are in the process of solving this problem and modify the same part. Until now, the tested result is OK.
Currently, we are conducting internal testing. After confirming it is fully secure, the new version will be sent to the community as soon as possible.
Thanks again
Feifei
Quoted 31 lines
Ah, yes indeed there is problem within single enqueue. It should be:
lib/librte_ring/rte_ring.h index renamed from lib/librte_ring/rte_ring.h +0
-0
2a2190bfc..da17ed6d7100644lib/librte_ring/rte_ring.h +0
-0@@ -284,7 +284,7 @@ rte_ring_enqueue_bulk(struct rte_ring *r, void *const
*obj_table, static__rte_always_inlineintrte_ring_mp_enqueue(struct rte_ring *r, void *obj){lib/librte_ring/rte_ring.h +1
-1-return rte_ring_mp_enqueue_elem (r, obj,sizeof (void *)); +return rte_ring_mp_enqueue_elem (r, &obj,sizeof (void *)); }/** @@ -301,7 +301,7 @@ rte_ring_mp_enqueue(struct rte_ring *r, void *obj)static
__rte_always_inlineintrte_ring_sp_enqueue(struct rte_ring *r, void *obj){lib/librte_ring/rte_ring.h +2
-2-return rte_ring_sp_enqueue_elem (r, obj,sizeof (void *)); +return rte_ring_sp_enqueue_elem (r, &obj,sizeof (void *)); }/** @@ -322,7 +322,7 @@ rte_ring_sp_enqueue(struct rte_ring *r, void *obj) static __rte_always_inline int rte_ring_enqueue(struct rte_ring *r, void *obj) { -return rte_ring_enqueue_elem (r, obj,sizeof (void *)); +return rte_ring_enqueue_elem (r, &obj,sizeof (void *)); }/**