* [dpdk-stable] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
@ 2020-10-29 15:36 Dharmik Thakkar
2020-10-29 15:36 ` [dpdk-stable] [PATCH 2/4] test/lpm: return error on failure " Dharmik Thakkar
` (4 more replies)
0 siblings, 5 replies; 30+ messages in thread
From: Dharmik Thakkar @ 2020-10-29 15:36 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Honnappa Nagarahalli,
Ruifeng Wang, Gavin Hu
Cc: dev, nd, Dharmik Thakkar, stable
Fix incorrect calculations for LPM adds, LPM deletes,
and average cycles in RCU QSBR perf tests
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
app/test/test_lpm_perf.c | 43 ++++++++++++++--------------------------
1 file changed, 15 insertions(+), 28 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index c5a238b9d1e8..0a2d76a983c3 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -23,7 +23,6 @@ static struct rte_rcu_qsbr *rv;
static volatile uint8_t writer_done;
static volatile uint32_t thr_id;
static uint64_t gwrite_cycles;
-static uint64_t gwrites;
/* LPM APIs are not thread safe, use mutex to provide thread safety */
static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -60,6 +59,8 @@ static uint32_t num_ldepth_route_entries;
#define NUM_ROUTE_ENTRIES num_route_entries
#define NUM_LDEPTH_ROUTE_ENTRIES num_ldepth_route_entries
+#define TOTAL_WRITES (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES)
+
enum {
IP_CLASS_A,
IP_CLASS_B,
@@ -432,7 +433,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
uint8_t core_id = (uint8_t)((uintptr_t)arg);
uint32_t next_hop_add = 0xAA;
- RTE_SET_USED(arg);
/* 2 writer threads are used */
if (core_id % 2 == 0) {
si = 0;
@@ -472,9 +472,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
total_cycles = rte_rdtsc_precise() - begin;
__atomic_fetch_add(&gwrite_cycles, total_cycles, __ATOMIC_RELAXED);
- __atomic_fetch_add(&gwrites,
- 2 * NUM_LDEPTH_ROUTE_ENTRIES * RCU_ITERATIONS,
- __ATOMIC_RELAXED);
return 0;
}
@@ -528,7 +525,6 @@ test_lpm_rcu_perf_multi_writer(void)
writer_done = 0;
__atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
- __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
@@ -548,13 +544,10 @@ test_lpm_rcu_perf_multi_writer(void)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
- printf("Total LPM Adds: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %"PRIu64" cycles\n",
- __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
- __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
+ __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) / TOTAL_WRITES
);
/* Wait and check return value from reader threads */
@@ -581,7 +574,6 @@ test_lpm_rcu_perf_multi_writer(void)
writer_done = 0;
__atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
- __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
/* Launch reader threads */
@@ -600,14 +592,11 @@ test_lpm_rcu_perf_multi_writer(void)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
- printf("Total LPM Adds: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %"PRIu64" cycles\n",
- __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
- __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
- );
+ __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
+ / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
@@ -711,11 +700,10 @@ test_lpm_rcu_perf(void)
}
total_cycles = rte_rdtsc_precise() - begin;
- printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %g cycles\n",
- (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
+ (double)total_cycles / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
@@ -771,11 +759,10 @@ test_lpm_rcu_perf(void)
}
total_cycles = rte_rdtsc_precise() - begin;
- printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %g cycles\n",
- (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
+ (double)total_cycles / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH 2/4] test/lpm: return error on failure in rcu qsbr perf
2020-10-29 15:36 [dpdk-stable] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf Dharmik Thakkar
@ 2020-10-29 15:36 ` Dharmik Thakkar
2020-10-29 15:36 ` [dpdk-stable] [PATCH 3/4] test/lpm: remove error checking " Dharmik Thakkar
` (3 subsequent siblings)
4 siblings, 0 replies; 30+ messages in thread
From: Dharmik Thakkar @ 2020-10-29 15:36 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Gavin Hu, Ruifeng Wang,
Honnappa Nagarahalli
Cc: dev, nd, Dharmik Thakkar, stable
Return error if Add/Delete fail in multiwriter perf test
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
app/test/test_lpm_perf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index 0a2d76a983c3..251ea12345ae 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -453,6 +453,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
next_hop_add) != 0) {
printf("Failed to add iteration %d, route# %d\n",
i, j);
+ pthread_mutex_unlock(&lpm_mutex);
+ return -1;
}
pthread_mutex_unlock(&lpm_mutex);
}
@@ -464,6 +466,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
large_ldepth_route_table[j].depth) != 0) {
printf("Failed to delete iteration %d, route# %d\n",
i, j);
+ pthread_mutex_unlock(&lpm_mutex);
+ return -1;
}
pthread_mutex_unlock(&lpm_mutex);
}
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH 3/4] test/lpm: remove error checking in rcu qsbr perf
2020-10-29 15:36 [dpdk-stable] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf Dharmik Thakkar
2020-10-29 15:36 ` [dpdk-stable] [PATCH 2/4] test/lpm: return error on failure " Dharmik Thakkar
@ 2020-10-29 15:36 ` Dharmik Thakkar
2020-11-02 10:08 ` [dpdk-stable] [dpdk-dev] [PATCH 1/4] test/lpm: fix cycle calculation " David Marchand
` (2 subsequent siblings)
4 siblings, 0 replies; 30+ messages in thread
From: Dharmik Thakkar @ 2020-10-29 15:36 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Gavin Hu, Ruifeng Wang,
Honnappa Nagarahalli
Cc: dev, nd, Dharmik Thakkar, stable
Remove redundant error checking for reader threads
since they never return error.
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
app/test/test_lpm_perf.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index 251ea12345ae..4f15db4f85ee 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -554,11 +554,10 @@ test_lpm_rcu_perf_multi_writer(void)
__atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) / TOTAL_WRITES
);
- /* Wait and check return value from reader threads */
writer_done = 1;
+ /* Wait until all readers have exited */
for (i = 2; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
rte_free(rv);
@@ -603,10 +602,9 @@ test_lpm_rcu_perf_multi_writer(void)
/ TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 2; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
@@ -710,10 +708,9 @@ test_lpm_rcu_perf(void)
(double)total_cycles / TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 0; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ if (rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
rte_free(rv);
@@ -769,11 +766,9 @@ test_lpm_rcu_perf(void)
(double)total_cycles / TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 0; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- printf("Warning: lcore %u not finished.\n",
- enabled_core_ids[i]);
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
2020-10-29 15:36 [dpdk-stable] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf Dharmik Thakkar
2020-10-29 15:36 ` [dpdk-stable] [PATCH 2/4] test/lpm: return error on failure " Dharmik Thakkar
2020-10-29 15:36 ` [dpdk-stable] [PATCH 3/4] test/lpm: remove error checking " Dharmik Thakkar
@ 2020-11-02 10:08 ` David Marchand
2020-11-02 15:11 ` [dpdk-stable] " Bruce Richardson
[not found] ` <20201102235203.6342-1-dharmik.thakkar@arm.com>
4 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-11-02 10:08 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin
Cc: Honnappa Nagarahalli, Ruifeng Wang, Gavin Hu, dev, nd,
Dharmik Thakkar, dpdk stable
On Thu, Oct 29, 2020 at 4:37 PM Dharmik Thakkar <dharmik.thakkar@arm.com> wrote:
>
> Fix incorrect calculations for LPM adds, LPM deletes,
> and average cycles in RCU QSBR perf tests
>
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Bruce, Vladimir, reviews for this series please?
Thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
2020-10-29 15:36 [dpdk-stable] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf Dharmik Thakkar
` (2 preceding siblings ...)
2020-11-02 10:08 ` [dpdk-stable] [dpdk-dev] [PATCH 1/4] test/lpm: fix cycle calculation " David Marchand
@ 2020-11-02 15:11 ` Bruce Richardson
2020-11-02 16:58 ` Dharmik Thakkar
[not found] ` <20201102235203.6342-1-dharmik.thakkar@arm.com>
4 siblings, 1 reply; 30+ messages in thread
From: Bruce Richardson @ 2020-11-02 15:11 UTC (permalink / raw)
To: Dharmik Thakkar
Cc: Vladimir Medvedkin, Honnappa Nagarahalli, Ruifeng Wang, Gavin Hu,
dev, nd, stable
On Thu, Oct 29, 2020 at 10:36:31AM -0500, Dharmik Thakkar wrote:
> Fix incorrect calculations for LPM adds, LPM deletes,
> and average cycles in RCU QSBR perf tests
>
To help review this patch, could you provide some more details in the
commit log as to what exactly was wrong with the calculation and how this
patch fixes things?
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
2020-11-02 15:11 ` [dpdk-stable] " Bruce Richardson
@ 2020-11-02 16:58 ` Dharmik Thakkar
2020-11-02 17:21 ` Medvedkin, Vladimir
2020-11-02 17:33 ` Bruce Richardson
0 siblings, 2 replies; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-02 16:58 UTC (permalink / raw)
To: Bruce Richardson
Cc: Vladimir Medvedkin, Honnappa Nagarahalli, Ruifeng Wang, Gavin Hu,
dev, nd, dpdk stable
> On Nov 2, 2020, at 9:11 AM, Bruce Richardson <bruce.richardson@intel.com> wrote:
>
> On Thu, Oct 29, 2020 at 10:36:31AM -0500, Dharmik Thakkar wrote:
>> Fix incorrect calculations for LPM adds, LPM deletes,
>> and average cycles in RCU QSBR perf tests
>>
>
> To help review this patch, could you provide some more details in the
> commit log as to what exactly was wrong with the calculation and how this
> patch fixes things?
>
I will update the commit message in the next version. Adding it here as well:
Since, rcu qsbr tests run for ‘RCU_ITERATIONS’ and not ‘ITERATIONS’,
replace ‘ITERATIONS’ with ‘RCU_ITERATIONS’ for calculating adds, deletes, and cycles.
Also, for multi-writer perf test, each writer only writes half of NUM_LDEPTH_ROUTE_ENTRIES.
For 2 writers, total adds (or deletes) should be (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES) instead of
(2 * RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES).
Since, for both the single and multi writer tests, total adds/deletes is equal to (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES),
this has been replaced with a macro ’TOTAL_WRITES’ and furthermore, ‘g_writes’ has been removed since it is always a fixed value
equal to TOTAL_WRITES.
>> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
>> Cc: honnappa.nagarahalli@arm.com
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
>> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
2020-11-02 16:58 ` Dharmik Thakkar
@ 2020-11-02 17:21 ` Medvedkin, Vladimir
2020-11-02 17:33 ` Bruce Richardson
1 sibling, 0 replies; 30+ messages in thread
From: Medvedkin, Vladimir @ 2020-11-02 17:21 UTC (permalink / raw)
To: Dharmik Thakkar, Bruce Richardson
Cc: Honnappa Nagarahalli, Ruifeng Wang, Gavin Hu, dev, nd, dpdk stable
Hi Dharmik,
On 02/11/2020 16:58, Dharmik Thakkar wrote:
>
>> On Nov 2, 2020, at 9:11 AM, Bruce Richardson <bruce.richardson@intel.com> wrote:
>>
>> On Thu, Oct 29, 2020 at 10:36:31AM -0500, Dharmik Thakkar wrote:
>>> Fix incorrect calculations for LPM adds, LPM deletes,
>>> and average cycles in RCU QSBR perf tests
>>>
>>
>> To help review this patch, could you provide some more details in the
>> commit log as to what exactly was wrong with the calculation and how this
>> patch fixes things?
>>
>
> I will update the commit message in the next version. Adding it here as well:
>
> Since, rcu qsbr tests run for ‘RCU_ITERATIONS’ and not ‘ITERATIONS’,
> replace ‘ITERATIONS’ with ‘RCU_ITERATIONS’ for calculating adds, deletes, and cycles.
>
> Also, for multi-writer perf test, each writer only writes half of NUM_LDEPTH_ROUTE_ENTRIES.
> For 2 writers, total adds (or deletes) should be (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES) instead of
> (2 * RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES).
>
> Since, for both the single and multi writer tests, total adds/deletes is equal to (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES),
> this has been replaced with a macro ’TOTAL_WRITES’ and furthermore, ‘g_writes’ has been removed since it is always a fixed value
> equal to TOTAL_WRITES.
>
Thanks for the clarification. I left a few comments regarding 4-th
patch. First 3 patches LGTM, just put more details in the commit message.
>>> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
>>> Cc: honnappa.nagarahalli@arm.com
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
>>> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
>
--
Regards,
Vladimir
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
2020-11-02 16:58 ` Dharmik Thakkar
2020-11-02 17:21 ` Medvedkin, Vladimir
@ 2020-11-02 17:33 ` Bruce Richardson
1 sibling, 0 replies; 30+ messages in thread
From: Bruce Richardson @ 2020-11-02 17:33 UTC (permalink / raw)
To: Dharmik Thakkar
Cc: Vladimir Medvedkin, Honnappa Nagarahalli, Ruifeng Wang, Gavin Hu,
dev, nd, dpdk stable
On Mon, Nov 02, 2020 at 04:58:43PM +0000, Dharmik Thakkar wrote:
>
> > On Nov 2, 2020, at 9:11 AM, Bruce Richardson <bruce.richardson@intel.com> wrote:
> >
> > On Thu, Oct 29, 2020 at 10:36:31AM -0500, Dharmik Thakkar wrote:
> >> Fix incorrect calculations for LPM adds, LPM deletes,
> >> and average cycles in RCU QSBR perf tests
> >>
> >
> > To help review this patch, could you provide some more details in the
> > commit log as to what exactly was wrong with the calculation and how this
> > patch fixes things?
> >
>
> I will update the commit message in the next version. Adding it here as well:
>
> Since, rcu qsbr tests run for ‘RCU_ITERATIONS’ and not ‘ITERATIONS’,
> replace ‘ITERATIONS’ with ‘RCU_ITERATIONS’ for calculating adds, deletes, and cycles.
>
> Also, for multi-writer perf test, each writer only writes half of NUM_LDEPTH_ROUTE_ENTRIES.
> For 2 writers, total adds (or deletes) should be (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES) instead of
> (2 * RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES).
>
> Since, for both the single and multi writer tests, total adds/deletes is equal to (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES),
> this has been replaced with a macro ’TOTAL_WRITES’ and furthermore, ‘g_writes’ has been removed since it is always a fixed value
> equal to TOTAL_WRITES.
>
Thanks for the clear explanation.
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v2 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
[not found] ` <20201102235203.6342-1-dharmik.thakkar@arm.com>
@ 2020-11-02 23:52 ` Dharmik Thakkar
2020-11-03 1:30 ` Honnappa Nagarahalli
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 2/4] test/lpm: return error on failure " Dharmik Thakkar
` (2 subsequent siblings)
3 siblings, 1 reply; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-02 23:52 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Honnappa Nagarahalli,
Ruifeng Wang, Gavin Hu
Cc: dev, nd, Dharmik Thakkar, stable
Fix incorrect calculations for LPM adds, LPM deletes,
and average cycles in RCU QSBR perf tests
Since, rcu qsbr tests run for 'RCU_ITERATIONS' and not
'ITERATIONS', replace 'ITERATIONS' with 'RCU_ITERATIONS'
for calculating adds, deletes, and cycles.
Also, for multi-writer perf test, each writer only writes
half of NUM_LDEPTH_ROUTE_ENTRIES.
For 2 writers, total adds (or deletes) should be
(RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES) instead of
(2 * RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES).
Since, for both the single and multi writer tests, total adds/deletes
is equal to (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES),
this has been replaced with a macro 'TOTAL_WRITES' and furthermore,
'g_writes' has been removed since it is always a fixed value
equal to TOTAL_WRITES.
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
app/test/test_lpm_perf.c | 45 ++++++++++++++--------------------------
1 file changed, 16 insertions(+), 29 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index c5a238b9d1e8..45164b23214b 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -23,7 +23,6 @@ static struct rte_rcu_qsbr *rv;
static volatile uint8_t writer_done;
static volatile uint32_t thr_id;
static uint64_t gwrite_cycles;
-static uint64_t gwrites;
/* LPM APIs are not thread safe, use mutex to provide thread safety */
static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -60,6 +59,8 @@ static uint32_t num_ldepth_route_entries;
#define NUM_ROUTE_ENTRIES num_route_entries
#define NUM_LDEPTH_ROUTE_ENTRIES num_ldepth_route_entries
+#define TOTAL_WRITES (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES)
+
enum {
IP_CLASS_A,
IP_CLASS_B,
@@ -432,7 +433,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
uint8_t core_id = (uint8_t)((uintptr_t)arg);
uint32_t next_hop_add = 0xAA;
- RTE_SET_USED(arg);
/* 2 writer threads are used */
if (core_id % 2 == 0) {
si = 0;
@@ -472,9 +472,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
total_cycles = rte_rdtsc_precise() - begin;
__atomic_fetch_add(&gwrite_cycles, total_cycles, __ATOMIC_RELAXED);
- __atomic_fetch_add(&gwrites,
- 2 * NUM_LDEPTH_ROUTE_ENTRIES * RCU_ITERATIONS,
- __ATOMIC_RELAXED);
return 0;
}
@@ -528,7 +525,6 @@ test_lpm_rcu_perf_multi_writer(void)
writer_done = 0;
__atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
- __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
@@ -548,14 +544,11 @@ test_lpm_rcu_perf_multi_writer(void)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
- printf("Total LPM Adds: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %"PRIu64" cycles\n",
- __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
- __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
- );
+ __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
+ / TOTAL_WRITES);
/* Wait and check return value from reader threads */
writer_done = 1;
@@ -581,7 +574,6 @@ test_lpm_rcu_perf_multi_writer(void)
writer_done = 0;
__atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
- __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
/* Launch reader threads */
@@ -600,14 +592,11 @@ test_lpm_rcu_perf_multi_writer(void)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
- printf("Total LPM Adds: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %"PRIu64" cycles\n",
- __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
- __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
- );
+ __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
+ / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
@@ -711,11 +700,10 @@ test_lpm_rcu_perf(void)
}
total_cycles = rte_rdtsc_precise() - begin;
- printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %g cycles\n",
- (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
+ (double)total_cycles / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
@@ -771,11 +759,10 @@ test_lpm_rcu_perf(void)
}
total_cycles = rte_rdtsc_precise() - begin;
- printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %g cycles\n",
- (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
+ (double)total_cycles / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v2 2/4] test/lpm: return error on failure in rcu qsbr perf
[not found] ` <20201102235203.6342-1-dharmik.thakkar@arm.com>
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 " Dharmik Thakkar
@ 2020-11-02 23:52 ` Dharmik Thakkar
2020-11-03 1:28 ` Honnappa Nagarahalli
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 3/4] test/lpm: remove error checking " Dharmik Thakkar
[not found] ` <20201103051224.12620-1-dharmik.thakkar@arm.com>
3 siblings, 1 reply; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-02 23:52 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Honnappa Nagarahalli,
Gavin Hu, Ruifeng Wang
Cc: dev, nd, Dharmik Thakkar, stable
Return error if Add/Delete fail in multiwriter perf test
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
app/test/test_lpm_perf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index 45164b23214b..55084816ab91 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -453,6 +453,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
next_hop_add) != 0) {
printf("Failed to add iteration %d, route# %d\n",
i, j);
+ pthread_mutex_unlock(&lpm_mutex);
+ return -1;
}
pthread_mutex_unlock(&lpm_mutex);
}
@@ -464,6 +466,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
large_ldepth_route_table[j].depth) != 0) {
printf("Failed to delete iteration %d, route# %d\n",
i, j);
+ pthread_mutex_unlock(&lpm_mutex);
+ return -1;
}
pthread_mutex_unlock(&lpm_mutex);
}
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v2 3/4] test/lpm: remove error checking in rcu qsbr perf
[not found] ` <20201102235203.6342-1-dharmik.thakkar@arm.com>
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 " Dharmik Thakkar
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 2/4] test/lpm: return error on failure " Dharmik Thakkar
@ 2020-11-02 23:52 ` Dharmik Thakkar
2020-11-03 1:21 ` Honnappa Nagarahalli
[not found] ` <20201103051224.12620-1-dharmik.thakkar@arm.com>
3 siblings, 1 reply; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-02 23:52 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Ruifeng Wang,
Honnappa Nagarahalli, Gavin Hu
Cc: dev, nd, Dharmik Thakkar, stable
Remove redundant error checking for reader threads
since they never return error.
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
app/test/test_lpm_perf.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index 55084816ab91..224c92fa3d65 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -554,11 +554,10 @@ test_lpm_rcu_perf_multi_writer(void)
__atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
/ TOTAL_WRITES);
- /* Wait and check return value from reader threads */
writer_done = 1;
+ /* Wait until all readers have exited */
for (i = 2; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
rte_free(rv);
@@ -603,10 +602,9 @@ test_lpm_rcu_perf_multi_writer(void)
/ TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 2; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
@@ -710,10 +708,9 @@ test_lpm_rcu_perf(void)
(double)total_cycles / TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 0; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ if (rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
rte_free(rv);
@@ -769,11 +766,9 @@ test_lpm_rcu_perf(void)
(double)total_cycles / TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 0; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- printf("Warning: lcore %u not finished.\n",
- enabled_core_ids[i]);
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH v2 3/4] test/lpm: remove error checking in rcu qsbr perf
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 3/4] test/lpm: remove error checking " Dharmik Thakkar
@ 2020-11-03 1:21 ` Honnappa Nagarahalli
2020-11-03 4:56 ` Dharmik Thakkar
0 siblings, 1 reply; 30+ messages in thread
From: Honnappa Nagarahalli @ 2020-11-03 1:21 UTC (permalink / raw)
To: Dharmik Thakkar, Bruce Richardson, Vladimir Medvedkin,
Ruifeng Wang, Gavin Hu
Cc: dev, nd, Dharmik Thakkar, stable, Honnappa Nagarahalli, nd
<snip>
>
> Remove redundant error checking for reader threads since they never return
> error.
>
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
> app/test/test_lpm_perf.c | 21 ++++++++-------------
> 1 file changed, 8 insertions(+), 13 deletions(-)
>
> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index
> 55084816ab91..224c92fa3d65 100644
> --- a/app/test/test_lpm_perf.c
> +++ b/app/test/test_lpm_perf.c
> @@ -554,11 +554,10 @@ test_lpm_rcu_perf_multi_writer(void)
> __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
> / TOTAL_WRITES);
>
> - /* Wait and check return value from reader threads */
> writer_done = 1;
> + /* Wait until all readers have exited */
> for (i = 2; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - goto error;
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
> rte_free(rv);
> @@ -603,10 +602,9 @@ test_lpm_rcu_perf_multi_writer(void)
> / TOTAL_WRITES);
>
> writer_done = 1;
> - /* Wait and check return value from reader threads */
> + /* Wait until all readers have exited */
> for (i = 2; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - goto error;
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
>
> @@ -710,10 +708,9 @@ test_lpm_rcu_perf(void)
> (double)total_cycles / TOTAL_WRITES);
>
> writer_done = 1;
> - /* Wait and check return value from reader threads */
> + /* Wait until all readers have exited */
> for (i = 0; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - goto error;
> + if (rte_eal_wait_lcore(enabled_core_ids[i]);
^^ Do we need the 'if' statement?
>
> rte_lpm_free(lpm);
> rte_free(rv);
> @@ -769,11 +766,9 @@ test_lpm_rcu_perf(void)
> (double)total_cycles / TOTAL_WRITES);
>
> writer_done = 1;
> - /* Wait and check return value from reader threads */
> + /* Wait until all readers have exited */
> for (i = 0; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - printf("Warning: lcore %u not finished.\n",
> - enabled_core_ids[i]);
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
>
> --
> 2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH v2 2/4] test/lpm: return error on failure in rcu qsbr perf
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 2/4] test/lpm: return error on failure " Dharmik Thakkar
@ 2020-11-03 1:28 ` Honnappa Nagarahalli
2020-11-03 4:42 ` Dharmik Thakkar
0 siblings, 1 reply; 30+ messages in thread
From: Honnappa Nagarahalli @ 2020-11-03 1:28 UTC (permalink / raw)
To: Dharmik Thakkar, Bruce Richardson, Vladimir Medvedkin, Gavin Hu,
Ruifeng Wang
Cc: dev, nd, Dharmik Thakkar, stable, Honnappa Nagarahalli, nd
<snip>
>
> Return error if Add/Delete fail in multiwriter perf test
>
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
> app/test/test_lpm_perf.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index
> 45164b23214b..55084816ab91 100644
> --- a/app/test/test_lpm_perf.c
> +++ b/app/test/test_lpm_perf.c
> @@ -453,6 +453,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
> next_hop_add) != 0) {
> printf("Failed to add iteration %d, route#
> %d\n",
> i, j);
> + pthread_mutex_unlock(&lpm_mutex);
> + return -1;
Would be good to use the "goto error" method used in this file in other functions.
> }
> pthread_mutex_unlock(&lpm_mutex);
> }
> @@ -464,6 +466,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
> large_ldepth_route_table[j].depth) != 0) {
> printf("Failed to delete iteration %d, route#
> %d\n",
> i, j);
> + pthread_mutex_unlock(&lpm_mutex);
> + return -1;
> }
> pthread_mutex_unlock(&lpm_mutex);
> }
> --
> 2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH v2 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 " Dharmik Thakkar
@ 2020-11-03 1:30 ` Honnappa Nagarahalli
0 siblings, 0 replies; 30+ messages in thread
From: Honnappa Nagarahalli @ 2020-11-03 1:30 UTC (permalink / raw)
To: Dharmik Thakkar, Bruce Richardson, Vladimir Medvedkin,
Ruifeng Wang, Gavin Hu
Cc: dev, nd, Dharmik Thakkar, stable, Honnappa Nagarahalli, nd
<snip>
>
> Fix incorrect calculations for LPM adds, LPM deletes, and average cycles in
> RCU QSBR perf tests
>
> Since, rcu qsbr tests run for 'RCU_ITERATIONS' and not 'ITERATIONS', replace
> 'ITERATIONS' with 'RCU_ITERATIONS'
> for calculating adds, deletes, and cycles.
>
> Also, for multi-writer perf test, each writer only writes half of
> NUM_LDEPTH_ROUTE_ENTRIES.
> For 2 writers, total adds (or deletes) should be (RCU_ITERATIONS *
> NUM_LDEPTH_ROUTE_ENTRIES) instead of
> (2 * RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES).
>
> Since, for both the single and multi writer tests, total adds/deletes is equal to
> (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES), this has been replaced
> with a macro 'TOTAL_WRITES' and furthermore, 'g_writes' has been removed
> since it is always a fixed value equal to TOTAL_WRITES.
>
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Looks good
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalliu@arm.com>
> ---
> app/test/test_lpm_perf.c | 45 ++++++++++++++--------------------------
> 1 file changed, 16 insertions(+), 29 deletions(-)
>
> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index
> c5a238b9d1e8..45164b23214b 100644
> --- a/app/test/test_lpm_perf.c
> +++ b/app/test/test_lpm_perf.c
> @@ -23,7 +23,6 @@ static struct rte_rcu_qsbr *rv; static volatile uint8_t
> writer_done; static volatile uint32_t thr_id; static uint64_t gwrite_cycles; -
> static uint64_t gwrites;
> /* LPM APIs are not thread safe, use mutex to provide thread safety */
> static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
>
> @@ -60,6 +59,8 @@ static uint32_t num_ldepth_route_entries; #define
> NUM_ROUTE_ENTRIES num_route_entries #define
> NUM_LDEPTH_ROUTE_ENTRIES num_ldepth_route_entries
>
> +#define TOTAL_WRITES (RCU_ITERATIONS *
> NUM_LDEPTH_ROUTE_ENTRIES)
> +
> enum {
> IP_CLASS_A,
> IP_CLASS_B,
> @@ -432,7 +433,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
> uint8_t core_id = (uint8_t)((uintptr_t)arg);
> uint32_t next_hop_add = 0xAA;
>
> - RTE_SET_USED(arg);
> /* 2 writer threads are used */
> if (core_id % 2 == 0) {
> si = 0;
> @@ -472,9 +472,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
> total_cycles = rte_rdtsc_precise() - begin;
>
> __atomic_fetch_add(&gwrite_cycles, total_cycles,
> __ATOMIC_RELAXED);
> - __atomic_fetch_add(&gwrites,
> - 2 * NUM_LDEPTH_ROUTE_ENTRIES *
> RCU_ITERATIONS,
> - __ATOMIC_RELAXED);
>
> return 0;
> }
> @@ -528,7 +525,6 @@ test_lpm_rcu_perf_multi_writer(void)
>
> writer_done = 0;
> __atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
> - __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
>
> __atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
>
> @@ -548,14 +544,11 @@ test_lpm_rcu_perf_multi_writer(void)
> if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> goto error;
>
> - printf("Total LPM Adds: %d\n",
> - 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> - printf("Total LPM Deletes: %d\n",
> - 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> + printf("Total LPM Adds: %d\n", TOTAL_WRITES);
> + printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
> printf("Average LPM Add/Del: %"PRIu64" cycles\n",
> - __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
> - __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
> - );
> + __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
> + / TOTAL_WRITES);
>
> /* Wait and check return value from reader threads */
> writer_done = 1;
> @@ -581,7 +574,6 @@ test_lpm_rcu_perf_multi_writer(void)
>
> writer_done = 0;
> __atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
> - __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
> __atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
>
> /* Launch reader threads */
> @@ -600,14 +592,11 @@ test_lpm_rcu_perf_multi_writer(void)
> if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> goto error;
>
> - printf("Total LPM Adds: %d\n",
> - 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> - printf("Total LPM Deletes: %d\n",
> - 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> + printf("Total LPM Adds: %d\n", TOTAL_WRITES);
> + printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
> printf("Average LPM Add/Del: %"PRIu64" cycles\n",
> - __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
> - __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
> - );
> + __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
> + / TOTAL_WRITES);
>
> writer_done = 1;
> /* Wait and check return value from reader threads */ @@ -711,11
> +700,10 @@ test_lpm_rcu_perf(void)
> }
> total_cycles = rte_rdtsc_precise() - begin;
>
> - printf("Total LPM Adds: %d\n", ITERATIONS *
> NUM_LDEPTH_ROUTE_ENTRIES);
> - printf("Total LPM Deletes: %d\n",
> - ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> + printf("Total LPM Adds: %d\n", TOTAL_WRITES);
> + printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
> printf("Average LPM Add/Del: %g cycles\n",
> - (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES *
> ITERATIONS));
> + (double)total_cycles / TOTAL_WRITES);
>
> writer_done = 1;
> /* Wait and check return value from reader threads */ @@ -771,11
> +759,10 @@ test_lpm_rcu_perf(void)
> }
> total_cycles = rte_rdtsc_precise() - begin;
>
> - printf("Total LPM Adds: %d\n", ITERATIONS *
> NUM_LDEPTH_ROUTE_ENTRIES);
> - printf("Total LPM Deletes: %d\n",
> - ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> + printf("Total LPM Adds: %d\n", TOTAL_WRITES);
> + printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
> printf("Average LPM Add/Del: %g cycles\n",
> - (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES *
> ITERATIONS));
> + (double)total_cycles / TOTAL_WRITES);
>
> writer_done = 1;
> /* Wait and check return value from reader threads */
> --
> 2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH v2 2/4] test/lpm: return error on failure in rcu qsbr perf
2020-11-03 1:28 ` Honnappa Nagarahalli
@ 2020-11-03 4:42 ` Dharmik Thakkar
0 siblings, 0 replies; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-03 4:42 UTC (permalink / raw)
To: Honnappa Nagarahalli
Cc: Bruce Richardson, Vladimir Medvedkin, Gavin Hu, Ruifeng Wang,
dev, nd, stable
> On Nov 2, 2020, at 7:28 PM, Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com> wrote:
>
> <snip>
>
>>
>> Return error if Add/Delete fail in multiwriter perf test
>>
>> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
>> Cc: honnappa.nagarahalli@arm.com
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
>> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
>> ---
>> app/test/test_lpm_perf.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index
>> 45164b23214b..55084816ab91 100644
>> --- a/app/test/test_lpm_perf.c
>> +++ b/app/test/test_lpm_perf.c
>> @@ -453,6 +453,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
>> next_hop_add) != 0) {
>> printf("Failed to add iteration %d, route#
>> %d\n",
>> i, j);
>> + pthread_mutex_unlock(&lpm_mutex);
>> + return -1;
> Would be good to use the "goto error" method used in this file in other functions.
Yes, will update in the next version.
>
>> }
>> pthread_mutex_unlock(&lpm_mutex);
>> }
>> @@ -464,6 +466,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
>> large_ldepth_route_table[j].depth) != 0) {
>> printf("Failed to delete iteration %d, route#
>> %d\n",
>> i, j);
>> + pthread_mutex_unlock(&lpm_mutex);
>> + return -1;
>> }
>> pthread_mutex_unlock(&lpm_mutex);
>> }
>> --
>> 2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH v2 3/4] test/lpm: remove error checking in rcu qsbr perf
2020-11-03 1:21 ` Honnappa Nagarahalli
@ 2020-11-03 4:56 ` Dharmik Thakkar
0 siblings, 0 replies; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-03 4:56 UTC (permalink / raw)
To: Honnappa Nagarahalli
Cc: Bruce Richardson, Vladimir Medvedkin, Ruifeng Wang, Gavin Hu,
dev, nd, stable
> On Nov 2, 2020, at 7:21 PM, Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com> wrote:
>
> <snip>
>
>>
>> Remove redundant error checking for reader threads since they never return
>> error.
>>
>> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
>> Cc: honnappa.nagarahalli@arm.com
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
>> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
>> ---
>> app/test/test_lpm_perf.c | 21 ++++++++-------------
>> 1 file changed, 8 insertions(+), 13 deletions(-)
>>
>> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index
>> 55084816ab91..224c92fa3d65 100644
>> --- a/app/test/test_lpm_perf.c
>> +++ b/app/test/test_lpm_perf.c
>> @@ -554,11 +554,10 @@ test_lpm_rcu_perf_multi_writer(void)
>> __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
>> / TOTAL_WRITES);
>>
>> - /* Wait and check return value from reader threads */
>> writer_done = 1;
>> + /* Wait until all readers have exited */
>> for (i = 2; i < num_cores; i++)
>> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
>> - goto error;
>> + rte_eal_wait_lcore(enabled_core_ids[i]);
>>
>> rte_lpm_free(lpm);
>> rte_free(rv);
>> @@ -603,10 +602,9 @@ test_lpm_rcu_perf_multi_writer(void)
>> / TOTAL_WRITES);
>>
>> writer_done = 1;
>> - /* Wait and check return value from reader threads */
>> + /* Wait until all readers have exited */
>> for (i = 2; i < num_cores; i++)
>> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
>> - goto error;
>> + rte_eal_wait_lcore(enabled_core_ids[i]);
>>
>> rte_lpm_free(lpm);
>>
>> @@ -710,10 +708,9 @@ test_lpm_rcu_perf(void)
>> (double)total_cycles / TOTAL_WRITES);
>>
>> writer_done = 1;
>> - /* Wait and check return value from reader threads */
>> + /* Wait until all readers have exited */
>> for (i = 0; i < num_cores; i++)
>> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
>> - goto error;
>> + if (rte_eal_wait_lcore(enabled_core_ids[i]);
> ^^ Do we need the 'if' statement?
No, will remove in the next version.
>>
>> rte_lpm_free(lpm);
>> rte_free(rv);
>> @@ -769,11 +766,9 @@ test_lpm_rcu_perf(void)
>> (double)total_cycles / TOTAL_WRITES);
>>
>> writer_done = 1;
>> - /* Wait and check return value from reader threads */
>> + /* Wait until all readers have exited */
>> for (i = 0; i < num_cores; i++)
>> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
>> - printf("Warning: lcore %u not finished.\n",
>> - enabled_core_ids[i]);
>> + rte_eal_wait_lcore(enabled_core_ids[i]);
>>
>> rte_lpm_free(lpm);
>>
>> --
>> 2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v3 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
[not found] ` <20201103051224.12620-1-dharmik.thakkar@arm.com>
@ 2020-11-03 5:12 ` Dharmik Thakkar
2020-11-03 5:12 ` [dpdk-stable] [PATCH v3 2/4] test/lpm: return error on failure " Dharmik Thakkar
` (2 subsequent siblings)
3 siblings, 0 replies; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-03 5:12 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Gavin Hu,
Honnappa Nagarahalli, Ruifeng Wang
Cc: dev, nd, Dharmik Thakkar, stable
Fix incorrect calculations for LPM adds, LPM deletes,
and average cycles in RCU QSBR perf tests
Since, rcu qsbr tests run for 'RCU_ITERATIONS' and not
'ITERATIONS', replace 'ITERATIONS' with 'RCU_ITERATIONS'
for calculating adds, deletes, and cycles.
Also, for multi-writer perf test, each writer only writes
half of NUM_LDEPTH_ROUTE_ENTRIES.
For 2 writers, total adds (or deletes) should be
(RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES) instead of
(2 * RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES).
Since, for both the single and multi writer tests, total adds/deletes
is equal to (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES),
this has been replaced with a macro 'TOTAL_WRITES' and furthermore,
'g_writes' has been removed since it is always a fixed value
equal to TOTAL_WRITES.
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
app/test/test_lpm_perf.c | 45 ++++++++++++++--------------------------
1 file changed, 16 insertions(+), 29 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index c5a238b9d1e8..45164b23214b 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -23,7 +23,6 @@ static struct rte_rcu_qsbr *rv;
static volatile uint8_t writer_done;
static volatile uint32_t thr_id;
static uint64_t gwrite_cycles;
-static uint64_t gwrites;
/* LPM APIs are not thread safe, use mutex to provide thread safety */
static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -60,6 +59,8 @@ static uint32_t num_ldepth_route_entries;
#define NUM_ROUTE_ENTRIES num_route_entries
#define NUM_LDEPTH_ROUTE_ENTRIES num_ldepth_route_entries
+#define TOTAL_WRITES (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES)
+
enum {
IP_CLASS_A,
IP_CLASS_B,
@@ -432,7 +433,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
uint8_t core_id = (uint8_t)((uintptr_t)arg);
uint32_t next_hop_add = 0xAA;
- RTE_SET_USED(arg);
/* 2 writer threads are used */
if (core_id % 2 == 0) {
si = 0;
@@ -472,9 +472,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
total_cycles = rte_rdtsc_precise() - begin;
__atomic_fetch_add(&gwrite_cycles, total_cycles, __ATOMIC_RELAXED);
- __atomic_fetch_add(&gwrites,
- 2 * NUM_LDEPTH_ROUTE_ENTRIES * RCU_ITERATIONS,
- __ATOMIC_RELAXED);
return 0;
}
@@ -528,7 +525,6 @@ test_lpm_rcu_perf_multi_writer(void)
writer_done = 0;
__atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
- __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
@@ -548,14 +544,11 @@ test_lpm_rcu_perf_multi_writer(void)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
- printf("Total LPM Adds: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %"PRIu64" cycles\n",
- __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
- __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
- );
+ __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
+ / TOTAL_WRITES);
/* Wait and check return value from reader threads */
writer_done = 1;
@@ -581,7 +574,6 @@ test_lpm_rcu_perf_multi_writer(void)
writer_done = 0;
__atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
- __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
/* Launch reader threads */
@@ -600,14 +592,11 @@ test_lpm_rcu_perf_multi_writer(void)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
- printf("Total LPM Adds: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %"PRIu64" cycles\n",
- __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
- __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
- );
+ __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
+ / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
@@ -711,11 +700,10 @@ test_lpm_rcu_perf(void)
}
total_cycles = rte_rdtsc_precise() - begin;
- printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %g cycles\n",
- (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
+ (double)total_cycles / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
@@ -771,11 +759,10 @@ test_lpm_rcu_perf(void)
}
total_cycles = rte_rdtsc_precise() - begin;
- printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %g cycles\n",
- (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
+ (double)total_cycles / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v3 2/4] test/lpm: return error on failure in rcu qsbr perf
[not found] ` <20201103051224.12620-1-dharmik.thakkar@arm.com>
2020-11-03 5:12 ` [dpdk-stable] [PATCH v3 1/4] test/lpm: fix cycle calculation " Dharmik Thakkar
@ 2020-11-03 5:12 ` Dharmik Thakkar
2020-11-03 5:21 ` Honnappa Nagarahalli
2020-11-03 5:12 ` [dpdk-stable] [PATCH v3 3/4] test/lpm: remove error checking " Dharmik Thakkar
[not found] ` <20201103222352.11566-1-dharmik.thakkar@arm.com>
3 siblings, 1 reply; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-03 5:12 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Ruifeng Wang, Gavin Hu,
Honnappa Nagarahalli
Cc: dev, nd, Dharmik Thakkar, stable
Return error if Add/Delete fail in multiwriter perf test
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
app/test/test_lpm_perf.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index 45164b23214b..fc4c9b60cbbc 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -453,6 +453,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
next_hop_add) != 0) {
printf("Failed to add iteration %d, route# %d\n",
i, j);
+ goto error;
}
pthread_mutex_unlock(&lpm_mutex);
}
@@ -464,6 +465,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
large_ldepth_route_table[j].depth) != 0) {
printf("Failed to delete iteration %d, route# %d\n",
i, j);
+ goto error;
}
pthread_mutex_unlock(&lpm_mutex);
}
@@ -474,6 +476,10 @@ test_lpm_rcu_qsbr_writer(void *arg)
__atomic_fetch_add(&gwrite_cycles, total_cycles, __ATOMIC_RELAXED);
return 0;
+
+error:
+ pthread_mutex_unlock(&lpm_mutex);
+ return -1;
}
/*
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v3 3/4] test/lpm: remove error checking in rcu qsbr perf
[not found] ` <20201103051224.12620-1-dharmik.thakkar@arm.com>
2020-11-03 5:12 ` [dpdk-stable] [PATCH v3 1/4] test/lpm: fix cycle calculation " Dharmik Thakkar
2020-11-03 5:12 ` [dpdk-stable] [PATCH v3 2/4] test/lpm: return error on failure " Dharmik Thakkar
@ 2020-11-03 5:12 ` Dharmik Thakkar
2020-11-03 5:22 ` Honnappa Nagarahalli
[not found] ` <20201103222352.11566-1-dharmik.thakkar@arm.com>
3 siblings, 1 reply; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-03 5:12 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Gavin Hu,
Honnappa Nagarahalli, Ruifeng Wang
Cc: dev, nd, Dharmik Thakkar, stable
Remove redundant error checking for reader threads
since they never return error.
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
app/test/test_lpm_perf.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index fc4c9b60cbbc..fa6ebc4f7547 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -556,11 +556,10 @@ test_lpm_rcu_perf_multi_writer(void)
__atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
/ TOTAL_WRITES);
- /* Wait and check return value from reader threads */
writer_done = 1;
+ /* Wait until all readers have exited */
for (i = 2; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
rte_free(rv);
@@ -605,10 +604,9 @@ test_lpm_rcu_perf_multi_writer(void)
/ TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 2; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
@@ -712,10 +710,9 @@ test_lpm_rcu_perf(void)
(double)total_cycles / TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 0; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
rte_free(rv);
@@ -771,11 +768,9 @@ test_lpm_rcu_perf(void)
(double)total_cycles / TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 0; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- printf("Warning: lcore %u not finished.\n",
- enabled_core_ids[i]);
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH v3 2/4] test/lpm: return error on failure in rcu qsbr perf
2020-11-03 5:12 ` [dpdk-stable] [PATCH v3 2/4] test/lpm: return error on failure " Dharmik Thakkar
@ 2020-11-03 5:21 ` Honnappa Nagarahalli
0 siblings, 0 replies; 30+ messages in thread
From: Honnappa Nagarahalli @ 2020-11-03 5:21 UTC (permalink / raw)
To: Dharmik Thakkar, Bruce Richardson, Vladimir Medvedkin,
Ruifeng Wang, Gavin Hu
Cc: dev, nd, Dharmik Thakkar, stable, Honnappa Nagarahalli, nd
<snip>
>
> Return error if Add/Delete fail in multiwriter perf test
>
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Looks good
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---
> app/test/test_lpm_perf.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index
> 45164b23214b..fc4c9b60cbbc 100644
> --- a/app/test/test_lpm_perf.c
> +++ b/app/test/test_lpm_perf.c
> @@ -453,6 +453,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
> next_hop_add) != 0) {
> printf("Failed to add iteration %d, route#
> %d\n",
> i, j);
> + goto error;
> }
> pthread_mutex_unlock(&lpm_mutex);
> }
> @@ -464,6 +465,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
> large_ldepth_route_table[j].depth) != 0) {
> printf("Failed to delete iteration %d, route#
> %d\n",
> i, j);
> + goto error;
> }
> pthread_mutex_unlock(&lpm_mutex);
> }
> @@ -474,6 +476,10 @@ test_lpm_rcu_qsbr_writer(void *arg)
> __atomic_fetch_add(&gwrite_cycles, total_cycles,
> __ATOMIC_RELAXED);
>
> return 0;
> +
> +error:
> + pthread_mutex_unlock(&lpm_mutex);
> + return -1;
> }
>
> /*
> --
> 2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH v3 3/4] test/lpm: remove error checking in rcu qsbr perf
2020-11-03 5:12 ` [dpdk-stable] [PATCH v3 3/4] test/lpm: remove error checking " Dharmik Thakkar
@ 2020-11-03 5:22 ` Honnappa Nagarahalli
0 siblings, 0 replies; 30+ messages in thread
From: Honnappa Nagarahalli @ 2020-11-03 5:22 UTC (permalink / raw)
To: Dharmik Thakkar, Bruce Richardson, Vladimir Medvedkin, Gavin Hu,
Ruifeng Wang
Cc: dev, nd, Dharmik Thakkar, stable, Honnappa Nagarahalli, nd
> -----Original Message-----
> From: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Sent: Monday, November 2, 2020 11:12 PM
> To: Bruce Richardson <bruce.richardson@intel.com>; Vladimir Medvedkin
> <vladimir.medvedkin@intel.com>; Gavin Hu <Gavin.Hu@arm.com>;
> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>; Dharmik Thakkar
> <Dharmik.Thakkar@arm.com>; stable@dpdk.org
> Subject: [PATCH v3 3/4] test/lpm: remove error checking in rcu qsbr perf
>
> Remove redundant error checking for reader threads since they never return
> error.
>
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Looks good
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---
> app/test/test_lpm_perf.c | 21 ++++++++-------------
> 1 file changed, 8 insertions(+), 13 deletions(-)
>
> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index
> fc4c9b60cbbc..fa6ebc4f7547 100644
> --- a/app/test/test_lpm_perf.c
> +++ b/app/test/test_lpm_perf.c
> @@ -556,11 +556,10 @@ test_lpm_rcu_perf_multi_writer(void)
> __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
> / TOTAL_WRITES);
>
> - /* Wait and check return value from reader threads */
> writer_done = 1;
> + /* Wait until all readers have exited */
> for (i = 2; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - goto error;
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
> rte_free(rv);
> @@ -605,10 +604,9 @@ test_lpm_rcu_perf_multi_writer(void)
> / TOTAL_WRITES);
>
> writer_done = 1;
> - /* Wait and check return value from reader threads */
> + /* Wait until all readers have exited */
> for (i = 2; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - goto error;
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
>
> @@ -712,10 +710,9 @@ test_lpm_rcu_perf(void)
> (double)total_cycles / TOTAL_WRITES);
>
> writer_done = 1;
> - /* Wait and check return value from reader threads */
> + /* Wait until all readers have exited */
> for (i = 0; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - goto error;
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
> rte_free(rv);
> @@ -771,11 +768,9 @@ test_lpm_rcu_perf(void)
> (double)total_cycles / TOTAL_WRITES);
>
> writer_done = 1;
> - /* Wait and check return value from reader threads */
> + /* Wait until all readers have exited */
> for (i = 0; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - printf("Warning: lcore %u not finished.\n",
> - enabled_core_ids[i]);
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
>
> --
> 2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v4 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
[not found] ` <20201103222352.11566-1-dharmik.thakkar@arm.com>
@ 2020-11-03 22:23 ` Dharmik Thakkar
2020-11-03 22:23 ` [dpdk-stable] [PATCH v4 2/4] test/lpm: return error on failure " Dharmik Thakkar
` (2 subsequent siblings)
3 siblings, 0 replies; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-03 22:23 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Ruifeng Wang,
Honnappa Nagarahalli, Gavin Hu
Cc: dev, nd, Dharmik Thakkar, stable
Fix incorrect calculations for LPM adds, LPM deletes,
and average cycles in RCU QSBR perf tests
Since, rcu qsbr tests run for 'RCU_ITERATIONS' and not
'ITERATIONS', replace 'ITERATIONS' with 'RCU_ITERATIONS'
for calculating adds, deletes, and cycles.
Also, for multi-writer perf test, each writer only writes
half of NUM_LDEPTH_ROUTE_ENTRIES.
For 2 writers, total adds (or deletes) should be
(RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES) instead of
(2 * RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES).
Since, for both the single and multi writer tests, total adds/deletes
is equal to (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES),
this has been replaced with a macro 'TOTAL_WRITES' and furthermore,
'g_writes' has been removed since it is always a fixed value
equal to TOTAL_WRITES.
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
app/test/test_lpm_perf.c | 45 ++++++++++++++--------------------------
1 file changed, 16 insertions(+), 29 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index c5a238b9d1e8..45164b23214b 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -23,7 +23,6 @@ static struct rte_rcu_qsbr *rv;
static volatile uint8_t writer_done;
static volatile uint32_t thr_id;
static uint64_t gwrite_cycles;
-static uint64_t gwrites;
/* LPM APIs are not thread safe, use mutex to provide thread safety */
static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -60,6 +59,8 @@ static uint32_t num_ldepth_route_entries;
#define NUM_ROUTE_ENTRIES num_route_entries
#define NUM_LDEPTH_ROUTE_ENTRIES num_ldepth_route_entries
+#define TOTAL_WRITES (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES)
+
enum {
IP_CLASS_A,
IP_CLASS_B,
@@ -432,7 +433,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
uint8_t core_id = (uint8_t)((uintptr_t)arg);
uint32_t next_hop_add = 0xAA;
- RTE_SET_USED(arg);
/* 2 writer threads are used */
if (core_id % 2 == 0) {
si = 0;
@@ -472,9 +472,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
total_cycles = rte_rdtsc_precise() - begin;
__atomic_fetch_add(&gwrite_cycles, total_cycles, __ATOMIC_RELAXED);
- __atomic_fetch_add(&gwrites,
- 2 * NUM_LDEPTH_ROUTE_ENTRIES * RCU_ITERATIONS,
- __ATOMIC_RELAXED);
return 0;
}
@@ -528,7 +525,6 @@ test_lpm_rcu_perf_multi_writer(void)
writer_done = 0;
__atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
- __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
@@ -548,14 +544,11 @@ test_lpm_rcu_perf_multi_writer(void)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
- printf("Total LPM Adds: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %"PRIu64" cycles\n",
- __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
- __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
- );
+ __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
+ / TOTAL_WRITES);
/* Wait and check return value from reader threads */
writer_done = 1;
@@ -581,7 +574,6 @@ test_lpm_rcu_perf_multi_writer(void)
writer_done = 0;
__atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
- __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
/* Launch reader threads */
@@ -600,14 +592,11 @@ test_lpm_rcu_perf_multi_writer(void)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
- printf("Total LPM Adds: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %"PRIu64" cycles\n",
- __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
- __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
- );
+ __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
+ / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
@@ -711,11 +700,10 @@ test_lpm_rcu_perf(void)
}
total_cycles = rte_rdtsc_precise() - begin;
- printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %g cycles\n",
- (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
+ (double)total_cycles / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
@@ -771,11 +759,10 @@ test_lpm_rcu_perf(void)
}
total_cycles = rte_rdtsc_precise() - begin;
- printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %g cycles\n",
- (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
+ (double)total_cycles / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v4 2/4] test/lpm: return error on failure in rcu qsbr perf
[not found] ` <20201103222352.11566-1-dharmik.thakkar@arm.com>
2020-11-03 22:23 ` [dpdk-stable] [PATCH v4 1/4] test/lpm: fix cycle calculation " Dharmik Thakkar
@ 2020-11-03 22:23 ` Dharmik Thakkar
2020-11-03 22:23 ` [dpdk-stable] [PATCH v4 3/4] test/lpm: remove error checking " Dharmik Thakkar
[not found] ` <20201104185858.18397-1-dharmik.thakkar@arm.com>
3 siblings, 0 replies; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-03 22:23 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Honnappa Nagarahalli,
Ruifeng Wang, Gavin Hu
Cc: dev, nd, Dharmik Thakkar, stable
Return error if Add/Delete fail in multiwriter perf test
Return error if single or multi writer test fails
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
app/test/test_lpm_perf.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index 45164b23214b..873ecf511c97 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -453,6 +453,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
next_hop_add) != 0) {
printf("Failed to add iteration %d, route# %d\n",
i, j);
+ goto error;
}
pthread_mutex_unlock(&lpm_mutex);
}
@@ -464,6 +465,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
large_ldepth_route_table[j].depth) != 0) {
printf("Failed to delete iteration %d, route# %d\n",
i, j);
+ goto error;
}
pthread_mutex_unlock(&lpm_mutex);
}
@@ -474,6 +476,10 @@ test_lpm_rcu_qsbr_writer(void *arg)
__atomic_fetch_add(&gwrite_cycles, total_cycles, __ATOMIC_RELAXED);
return 0;
+
+error:
+ pthread_mutex_unlock(&lpm_mutex);
+ return -1;
}
/*
@@ -947,9 +953,11 @@ test_lpm_perf(void)
rte_lpm_delete_all(lpm);
rte_lpm_free(lpm);
- test_lpm_rcu_perf();
+ if (test_lpm_rcu_perf() < 0)
+ return -1;
- test_lpm_rcu_perf_multi_writer();
+ if (test_lpm_rcu_perf_multi_writer() < 0)
+ return -1;
return 0;
}
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v4 3/4] test/lpm: remove error checking in rcu qsbr perf
[not found] ` <20201103222352.11566-1-dharmik.thakkar@arm.com>
2020-11-03 22:23 ` [dpdk-stable] [PATCH v4 1/4] test/lpm: fix cycle calculation " Dharmik Thakkar
2020-11-03 22:23 ` [dpdk-stable] [PATCH v4 2/4] test/lpm: return error on failure " Dharmik Thakkar
@ 2020-11-03 22:23 ` Dharmik Thakkar
[not found] ` <20201104185858.18397-1-dharmik.thakkar@arm.com>
3 siblings, 0 replies; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-03 22:23 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Honnappa Nagarahalli,
Gavin Hu, Ruifeng Wang
Cc: dev, nd, Dharmik Thakkar, stable
Remove redundant error checking for reader threads
since they never return error.
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
app/test/test_lpm_perf.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index 873ecf511c97..c8e70ec89ff5 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -556,11 +556,10 @@ test_lpm_rcu_perf_multi_writer(void)
__atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
/ TOTAL_WRITES);
- /* Wait and check return value from reader threads */
writer_done = 1;
+ /* Wait until all readers have exited */
for (i = 2; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
rte_free(rv);
@@ -605,10 +604,9 @@ test_lpm_rcu_perf_multi_writer(void)
/ TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 2; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
@@ -712,10 +710,9 @@ test_lpm_rcu_perf(void)
(double)total_cycles / TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 0; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
rte_free(rv);
@@ -771,11 +768,9 @@ test_lpm_rcu_perf(void)
(double)total_cycles / TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 0; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- printf("Warning: lcore %u not finished.\n",
- enabled_core_ids[i]);
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v5 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
[not found] ` <20201104185858.18397-1-dharmik.thakkar@arm.com>
@ 2020-11-04 18:58 ` Dharmik Thakkar
2020-11-04 19:34 ` Medvedkin, Vladimir
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 2/4] test/lpm: return error on failure " Dharmik Thakkar
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 3/4] test/lpm: remove error checking " Dharmik Thakkar
2 siblings, 1 reply; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-04 18:58 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Gavin Hu, Ruifeng Wang,
Honnappa Nagarahalli
Cc: dev, nd, Dharmik Thakkar, stable
Fix incorrect calculations for LPM adds, LPM deletes,
and average cycles in RCU QSBR perf tests
Since, rcu qsbr tests run for 'RCU_ITERATIONS' and not
'ITERATIONS', replace 'ITERATIONS' with 'RCU_ITERATIONS'
for calculating adds, deletes, and cycles.
Also, for multi-writer perf test, each writer only writes
half of NUM_LDEPTH_ROUTE_ENTRIES.
For 2 writers, total adds (or deletes) should be
(RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES) instead of
(2 * RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES).
Since, for both the single and multi writer tests, total adds/deletes
is equal to (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES),
this has been replaced with a macro 'TOTAL_WRITES' and furthermore,
'g_writes' has been removed since it is always a fixed value
equal to TOTAL_WRITES.
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
app/test/test_lpm_perf.c | 45 ++++++++++++++--------------------------
1 file changed, 16 insertions(+), 29 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index c5a238b9d1e8..45164b23214b 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -23,7 +23,6 @@ static struct rte_rcu_qsbr *rv;
static volatile uint8_t writer_done;
static volatile uint32_t thr_id;
static uint64_t gwrite_cycles;
-static uint64_t gwrites;
/* LPM APIs are not thread safe, use mutex to provide thread safety */
static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -60,6 +59,8 @@ static uint32_t num_ldepth_route_entries;
#define NUM_ROUTE_ENTRIES num_route_entries
#define NUM_LDEPTH_ROUTE_ENTRIES num_ldepth_route_entries
+#define TOTAL_WRITES (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES)
+
enum {
IP_CLASS_A,
IP_CLASS_B,
@@ -432,7 +433,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
uint8_t core_id = (uint8_t)((uintptr_t)arg);
uint32_t next_hop_add = 0xAA;
- RTE_SET_USED(arg);
/* 2 writer threads are used */
if (core_id % 2 == 0) {
si = 0;
@@ -472,9 +472,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
total_cycles = rte_rdtsc_precise() - begin;
__atomic_fetch_add(&gwrite_cycles, total_cycles, __ATOMIC_RELAXED);
- __atomic_fetch_add(&gwrites,
- 2 * NUM_LDEPTH_ROUTE_ENTRIES * RCU_ITERATIONS,
- __ATOMIC_RELAXED);
return 0;
}
@@ -528,7 +525,6 @@ test_lpm_rcu_perf_multi_writer(void)
writer_done = 0;
__atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
- __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
@@ -548,14 +544,11 @@ test_lpm_rcu_perf_multi_writer(void)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
- printf("Total LPM Adds: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %"PRIu64" cycles\n",
- __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
- __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
- );
+ __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
+ / TOTAL_WRITES);
/* Wait and check return value from reader threads */
writer_done = 1;
@@ -581,7 +574,6 @@ test_lpm_rcu_perf_multi_writer(void)
writer_done = 0;
__atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
- __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
/* Launch reader threads */
@@ -600,14 +592,11 @@ test_lpm_rcu_perf_multi_writer(void)
if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
goto error;
- printf("Total LPM Adds: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %"PRIu64" cycles\n",
- __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
- __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
- );
+ __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
+ / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
@@ -711,11 +700,10 @@ test_lpm_rcu_perf(void)
}
total_cycles = rte_rdtsc_precise() - begin;
- printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %g cycles\n",
- (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
+ (double)total_cycles / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
@@ -771,11 +759,10 @@ test_lpm_rcu_perf(void)
}
total_cycles = rte_rdtsc_precise() - begin;
- printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
- printf("Total LPM Deletes: %d\n",
- ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
+ printf("Total LPM Adds: %d\n", TOTAL_WRITES);
+ printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
printf("Average LPM Add/Del: %g cycles\n",
- (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
+ (double)total_cycles / TOTAL_WRITES);
writer_done = 1;
/* Wait and check return value from reader threads */
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v5 2/4] test/lpm: return error on failure in rcu qsbr perf
[not found] ` <20201104185858.18397-1-dharmik.thakkar@arm.com>
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 1/4] test/lpm: fix cycle calculation " Dharmik Thakkar
@ 2020-11-04 18:58 ` Dharmik Thakkar
2020-11-04 19:35 ` Medvedkin, Vladimir
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 3/4] test/lpm: remove error checking " Dharmik Thakkar
2 siblings, 1 reply; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-04 18:58 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Gavin Hu,
Honnappa Nagarahalli, Ruifeng Wang
Cc: dev, nd, Dharmik Thakkar, stable
Return error if Add/Delete fail in multiwriter perf test
Return error if single or multi writer test fails
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
app/test/test_lpm_perf.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index 45164b23214b..873ecf511c97 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -453,6 +453,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
next_hop_add) != 0) {
printf("Failed to add iteration %d, route# %d\n",
i, j);
+ goto error;
}
pthread_mutex_unlock(&lpm_mutex);
}
@@ -464,6 +465,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
large_ldepth_route_table[j].depth) != 0) {
printf("Failed to delete iteration %d, route# %d\n",
i, j);
+ goto error;
}
pthread_mutex_unlock(&lpm_mutex);
}
@@ -474,6 +476,10 @@ test_lpm_rcu_qsbr_writer(void *arg)
__atomic_fetch_add(&gwrite_cycles, total_cycles, __ATOMIC_RELAXED);
return 0;
+
+error:
+ pthread_mutex_unlock(&lpm_mutex);
+ return -1;
}
/*
@@ -947,9 +953,11 @@ test_lpm_perf(void)
rte_lpm_delete_all(lpm);
rte_lpm_free(lpm);
- test_lpm_rcu_perf();
+ if (test_lpm_rcu_perf() < 0)
+ return -1;
- test_lpm_rcu_perf_multi_writer();
+ if (test_lpm_rcu_perf_multi_writer() < 0)
+ return -1;
return 0;
}
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-stable] [PATCH v5 3/4] test/lpm: remove error checking in rcu qsbr perf
[not found] ` <20201104185858.18397-1-dharmik.thakkar@arm.com>
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 1/4] test/lpm: fix cycle calculation " Dharmik Thakkar
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 2/4] test/lpm: return error on failure " Dharmik Thakkar
@ 2020-11-04 18:58 ` Dharmik Thakkar
2020-11-04 19:35 ` Medvedkin, Vladimir
2 siblings, 1 reply; 30+ messages in thread
From: Dharmik Thakkar @ 2020-11-04 18:58 UTC (permalink / raw)
To: Bruce Richardson, Vladimir Medvedkin, Honnappa Nagarahalli,
Ruifeng Wang, Gavin Hu
Cc: dev, nd, Dharmik Thakkar, stable
Remove redundant error checking for reader threads
since they never return error.
Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
app/test/test_lpm_perf.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index 873ecf511c97..c8e70ec89ff5 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -556,11 +556,10 @@ test_lpm_rcu_perf_multi_writer(void)
__atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
/ TOTAL_WRITES);
- /* Wait and check return value from reader threads */
writer_done = 1;
+ /* Wait until all readers have exited */
for (i = 2; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
rte_free(rv);
@@ -605,10 +604,9 @@ test_lpm_rcu_perf_multi_writer(void)
/ TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 2; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
@@ -712,10 +710,9 @@ test_lpm_rcu_perf(void)
(double)total_cycles / TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 0; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- goto error;
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
rte_free(rv);
@@ -771,11 +768,9 @@ test_lpm_rcu_perf(void)
(double)total_cycles / TOTAL_WRITES);
writer_done = 1;
- /* Wait and check return value from reader threads */
+ /* Wait until all readers have exited */
for (i = 0; i < num_cores; i++)
- if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
- printf("Warning: lcore %u not finished.\n",
- enabled_core_ids[i]);
+ rte_eal_wait_lcore(enabled_core_ids[i]);
rte_lpm_free(lpm);
--
2.17.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH v5 1/4] test/lpm: fix cycle calculation in rcu qsbr perf
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 1/4] test/lpm: fix cycle calculation " Dharmik Thakkar
@ 2020-11-04 19:34 ` Medvedkin, Vladimir
0 siblings, 0 replies; 30+ messages in thread
From: Medvedkin, Vladimir @ 2020-11-04 19:34 UTC (permalink / raw)
To: Dharmik Thakkar, Bruce Richardson, Gavin Hu, Ruifeng Wang,
Honnappa Nagarahalli
Cc: dev, nd, stable
On 04/11/2020 18:58, Dharmik Thakkar wrote:
> Fix incorrect calculations for LPM adds, LPM deletes,
> and average cycles in RCU QSBR perf tests
>
> Since, rcu qsbr tests run for 'RCU_ITERATIONS' and not
> 'ITERATIONS', replace 'ITERATIONS' with 'RCU_ITERATIONS'
> for calculating adds, deletes, and cycles.
>
> Also, for multi-writer perf test, each writer only writes
> half of NUM_LDEPTH_ROUTE_ENTRIES.
> For 2 writers, total adds (or deletes) should be
> (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES) instead of
> (2 * RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES).
>
> Since, for both the single and multi writer tests, total adds/deletes
> is equal to (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES),
> this has been replaced with a macro 'TOTAL_WRITES' and furthermore,
> 'g_writes' has been removed since it is always a fixed value
> equal to TOTAL_WRITES.
>
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---
> app/test/test_lpm_perf.c | 45 ++++++++++++++--------------------------
> 1 file changed, 16 insertions(+), 29 deletions(-)
>
> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
> index c5a238b9d1e8..45164b23214b 100644
> --- a/app/test/test_lpm_perf.c
> +++ b/app/test/test_lpm_perf.c
> @@ -23,7 +23,6 @@ static struct rte_rcu_qsbr *rv;
> static volatile uint8_t writer_done;
> static volatile uint32_t thr_id;
> static uint64_t gwrite_cycles;
> -static uint64_t gwrites;
> /* LPM APIs are not thread safe, use mutex to provide thread safety */
> static pthread_mutex_t lpm_mutex = PTHREAD_MUTEX_INITIALIZER;
>
> @@ -60,6 +59,8 @@ static uint32_t num_ldepth_route_entries;
> #define NUM_ROUTE_ENTRIES num_route_entries
> #define NUM_LDEPTH_ROUTE_ENTRIES num_ldepth_route_entries
>
> +#define TOTAL_WRITES (RCU_ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES)
> +
> enum {
> IP_CLASS_A,
> IP_CLASS_B,
> @@ -432,7 +433,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
> uint8_t core_id = (uint8_t)((uintptr_t)arg);
> uint32_t next_hop_add = 0xAA;
>
> - RTE_SET_USED(arg);
> /* 2 writer threads are used */
> if (core_id % 2 == 0) {
> si = 0;
> @@ -472,9 +472,6 @@ test_lpm_rcu_qsbr_writer(void *arg)
> total_cycles = rte_rdtsc_precise() - begin;
>
> __atomic_fetch_add(&gwrite_cycles, total_cycles, __ATOMIC_RELAXED);
> - __atomic_fetch_add(&gwrites,
> - 2 * NUM_LDEPTH_ROUTE_ENTRIES * RCU_ITERATIONS,
> - __ATOMIC_RELAXED);
>
> return 0;
> }
> @@ -528,7 +525,6 @@ test_lpm_rcu_perf_multi_writer(void)
>
> writer_done = 0;
> __atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
> - __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
>
> __atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
>
> @@ -548,14 +544,11 @@ test_lpm_rcu_perf_multi_writer(void)
> if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> goto error;
>
> - printf("Total LPM Adds: %d\n",
> - 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> - printf("Total LPM Deletes: %d\n",
> - 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> + printf("Total LPM Adds: %d\n", TOTAL_WRITES);
> + printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
> printf("Average LPM Add/Del: %"PRIu64" cycles\n",
> - __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
> - __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
> - );
> + __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
> + / TOTAL_WRITES);
>
> /* Wait and check return value from reader threads */
> writer_done = 1;
> @@ -581,7 +574,6 @@ test_lpm_rcu_perf_multi_writer(void)
>
> writer_done = 0;
> __atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
> - __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
> __atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
>
> /* Launch reader threads */
> @@ -600,14 +592,11 @@ test_lpm_rcu_perf_multi_writer(void)
> if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> goto error;
>
> - printf("Total LPM Adds: %d\n",
> - 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> - printf("Total LPM Deletes: %d\n",
> - 2 * ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> + printf("Total LPM Adds: %d\n", TOTAL_WRITES);
> + printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
> printf("Average LPM Add/Del: %"PRIu64" cycles\n",
> - __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED) /
> - __atomic_load_n(&gwrites, __ATOMIC_RELAXED)
> - );
> + __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
> + / TOTAL_WRITES);
>
> writer_done = 1;
> /* Wait and check return value from reader threads */
> @@ -711,11 +700,10 @@ test_lpm_rcu_perf(void)
> }
> total_cycles = rte_rdtsc_precise() - begin;
>
> - printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> - printf("Total LPM Deletes: %d\n",
> - ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> + printf("Total LPM Adds: %d\n", TOTAL_WRITES);
> + printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
> printf("Average LPM Add/Del: %g cycles\n",
> - (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
> + (double)total_cycles / TOTAL_WRITES);
>
> writer_done = 1;
> /* Wait and check return value from reader threads */
> @@ -771,11 +759,10 @@ test_lpm_rcu_perf(void)
> }
> total_cycles = rte_rdtsc_precise() - begin;
>
> - printf("Total LPM Adds: %d\n", ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> - printf("Total LPM Deletes: %d\n",
> - ITERATIONS * NUM_LDEPTH_ROUTE_ENTRIES);
> + printf("Total LPM Adds: %d\n", TOTAL_WRITES);
> + printf("Total LPM Deletes: %d\n", TOTAL_WRITES);
> printf("Average LPM Add/Del: %g cycles\n",
> - (double)total_cycles / (NUM_LDEPTH_ROUTE_ENTRIES * ITERATIONS));
> + (double)total_cycles / TOTAL_WRITES);
>
> writer_done = 1;
> /* Wait and check return value from reader threads */
>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
--
Regards,
Vladimir
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH v5 2/4] test/lpm: return error on failure in rcu qsbr perf
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 2/4] test/lpm: return error on failure " Dharmik Thakkar
@ 2020-11-04 19:35 ` Medvedkin, Vladimir
0 siblings, 0 replies; 30+ messages in thread
From: Medvedkin, Vladimir @ 2020-11-04 19:35 UTC (permalink / raw)
To: Dharmik Thakkar, Bruce Richardson, Gavin Hu,
Honnappa Nagarahalli, Ruifeng Wang
Cc: dev, nd, stable
On 04/11/2020 18:58, Dharmik Thakkar wrote:
> Return error if Add/Delete fail in multiwriter perf test
>
> Return error if single or multi writer test fails
>
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---
> app/test/test_lpm_perf.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
> index 45164b23214b..873ecf511c97 100644
> --- a/app/test/test_lpm_perf.c
> +++ b/app/test/test_lpm_perf.c
> @@ -453,6 +453,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
> next_hop_add) != 0) {
> printf("Failed to add iteration %d, route# %d\n",
> i, j);
> + goto error;
> }
> pthread_mutex_unlock(&lpm_mutex);
> }
> @@ -464,6 +465,7 @@ test_lpm_rcu_qsbr_writer(void *arg)
> large_ldepth_route_table[j].depth) != 0) {
> printf("Failed to delete iteration %d, route# %d\n",
> i, j);
> + goto error;
> }
> pthread_mutex_unlock(&lpm_mutex);
> }
> @@ -474,6 +476,10 @@ test_lpm_rcu_qsbr_writer(void *arg)
> __atomic_fetch_add(&gwrite_cycles, total_cycles, __ATOMIC_RELAXED);
>
> return 0;
> +
> +error:
> + pthread_mutex_unlock(&lpm_mutex);
> + return -1;
> }
>
> /*
> @@ -947,9 +953,11 @@ test_lpm_perf(void)
> rte_lpm_delete_all(lpm);
> rte_lpm_free(lpm);
>
> - test_lpm_rcu_perf();
> + if (test_lpm_rcu_perf() < 0)
> + return -1;
>
> - test_lpm_rcu_perf_multi_writer();
> + if (test_lpm_rcu_perf_multi_writer() < 0)
> + return -1;
>
> return 0;
> }
>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
--
Regards,
Vladimir
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-stable] [PATCH v5 3/4] test/lpm: remove error checking in rcu qsbr perf
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 3/4] test/lpm: remove error checking " Dharmik Thakkar
@ 2020-11-04 19:35 ` Medvedkin, Vladimir
0 siblings, 0 replies; 30+ messages in thread
From: Medvedkin, Vladimir @ 2020-11-04 19:35 UTC (permalink / raw)
To: Dharmik Thakkar, Bruce Richardson, Honnappa Nagarahalli,
Ruifeng Wang, Gavin Hu
Cc: dev, nd, stable
On 04/11/2020 18:58, Dharmik Thakkar wrote:
> Remove redundant error checking for reader threads
> since they never return error.
>
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---
> app/test/test_lpm_perf.c | 21 ++++++++-------------
> 1 file changed, 8 insertions(+), 13 deletions(-)
>
> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
> index 873ecf511c97..c8e70ec89ff5 100644
> --- a/app/test/test_lpm_perf.c
> +++ b/app/test/test_lpm_perf.c
> @@ -556,11 +556,10 @@ test_lpm_rcu_perf_multi_writer(void)
> __atomic_load_n(&gwrite_cycles, __ATOMIC_RELAXED)
> / TOTAL_WRITES);
>
> - /* Wait and check return value from reader threads */
> writer_done = 1;
> + /* Wait until all readers have exited */
> for (i = 2; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - goto error;
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
> rte_free(rv);
> @@ -605,10 +604,9 @@ test_lpm_rcu_perf_multi_writer(void)
> / TOTAL_WRITES);
>
> writer_done = 1;
> - /* Wait and check return value from reader threads */
> + /* Wait until all readers have exited */
> for (i = 2; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - goto error;
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
>
> @@ -712,10 +710,9 @@ test_lpm_rcu_perf(void)
> (double)total_cycles / TOTAL_WRITES);
>
> writer_done = 1;
> - /* Wait and check return value from reader threads */
> + /* Wait until all readers have exited */
> for (i = 0; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - goto error;
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
> rte_free(rv);
> @@ -771,11 +768,9 @@ test_lpm_rcu_perf(void)
> (double)total_cycles / TOTAL_WRITES);
>
> writer_done = 1;
> - /* Wait and check return value from reader threads */
> + /* Wait until all readers have exited */
> for (i = 0; i < num_cores; i++)
> - if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> - printf("Warning: lcore %u not finished.\n",
> - enabled_core_ids[i]);
> + rte_eal_wait_lcore(enabled_core_ids[i]);
>
> rte_lpm_free(lpm);
>
>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
--
Regards,
Vladimir
^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2020-11-04 19:35 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 15:36 [dpdk-stable] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf Dharmik Thakkar
2020-10-29 15:36 ` [dpdk-stable] [PATCH 2/4] test/lpm: return error on failure " Dharmik Thakkar
2020-10-29 15:36 ` [dpdk-stable] [PATCH 3/4] test/lpm: remove error checking " Dharmik Thakkar
2020-11-02 10:08 ` [dpdk-stable] [dpdk-dev] [PATCH 1/4] test/lpm: fix cycle calculation " David Marchand
2020-11-02 15:11 ` [dpdk-stable] " Bruce Richardson
2020-11-02 16:58 ` Dharmik Thakkar
2020-11-02 17:21 ` Medvedkin, Vladimir
2020-11-02 17:33 ` Bruce Richardson
[not found] ` <20201102235203.6342-1-dharmik.thakkar@arm.com>
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 " Dharmik Thakkar
2020-11-03 1:30 ` Honnappa Nagarahalli
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 2/4] test/lpm: return error on failure " Dharmik Thakkar
2020-11-03 1:28 ` Honnappa Nagarahalli
2020-11-03 4:42 ` Dharmik Thakkar
2020-11-02 23:52 ` [dpdk-stable] [PATCH v2 3/4] test/lpm: remove error checking " Dharmik Thakkar
2020-11-03 1:21 ` Honnappa Nagarahalli
2020-11-03 4:56 ` Dharmik Thakkar
[not found] ` <20201103051224.12620-1-dharmik.thakkar@arm.com>
2020-11-03 5:12 ` [dpdk-stable] [PATCH v3 1/4] test/lpm: fix cycle calculation " Dharmik Thakkar
2020-11-03 5:12 ` [dpdk-stable] [PATCH v3 2/4] test/lpm: return error on failure " Dharmik Thakkar
2020-11-03 5:21 ` Honnappa Nagarahalli
2020-11-03 5:12 ` [dpdk-stable] [PATCH v3 3/4] test/lpm: remove error checking " Dharmik Thakkar
2020-11-03 5:22 ` Honnappa Nagarahalli
[not found] ` <20201103222352.11566-1-dharmik.thakkar@arm.com>
2020-11-03 22:23 ` [dpdk-stable] [PATCH v4 1/4] test/lpm: fix cycle calculation " Dharmik Thakkar
2020-11-03 22:23 ` [dpdk-stable] [PATCH v4 2/4] test/lpm: return error on failure " Dharmik Thakkar
2020-11-03 22:23 ` [dpdk-stable] [PATCH v4 3/4] test/lpm: remove error checking " Dharmik Thakkar
[not found] ` <20201104185858.18397-1-dharmik.thakkar@arm.com>
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 1/4] test/lpm: fix cycle calculation " Dharmik Thakkar
2020-11-04 19:34 ` Medvedkin, Vladimir
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 2/4] test/lpm: return error on failure " Dharmik Thakkar
2020-11-04 19:35 ` Medvedkin, Vladimir
2020-11-04 18:58 ` [dpdk-stable] [PATCH v5 3/4] test/lpm: remove error checking " Dharmik Thakkar
2020-11-04 19:35 ` Medvedkin, Vladimir
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).