DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [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-dev] [PATCH 2/4] test/lpm: return error on failure " Dharmik Thakkar
                   ` (5 more replies)
  0 siblings, 6 replies; 52+ 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] 52+ messages in thread

end of thread, other threads:[~2020-11-05 15:59 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 15:36 [dpdk-dev] [PATCH 1/4] test/lpm: fix cycle calculation in rcu qsbr perf Dharmik Thakkar
2020-10-29 15:36 ` [dpdk-dev] [PATCH 2/4] test/lpm: return error on failure " Dharmik Thakkar
2020-10-29 15:36 ` [dpdk-dev] [PATCH 3/4] test/lpm: remove error checking " Dharmik Thakkar
2020-10-29 15:36 ` [dpdk-dev] [PATCH 4/4] test/lpm: avoid code duplication " Dharmik Thakkar
2020-11-02 17:17   ` Medvedkin, Vladimir
2020-11-02 22:11     ` Dharmik Thakkar
2020-11-02 10:08 ` [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
2020-11-02 17:21     ` Medvedkin, Vladimir
2020-11-02 17:33     ` Bruce Richardson
2020-11-02 23:51 ` [dpdk-dev] [PATCH v2 0/4] test/lpm: fix rcu qsbr perf test Dharmik Thakkar
2020-11-02 23:52   ` [dpdk-dev] [PATCH v2 1/4] test/lpm: fix cycle calculation in rcu qsbr perf Dharmik Thakkar
2020-11-03  1:30     ` Honnappa Nagarahalli
2020-11-02 23:52   ` [dpdk-dev] [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-dev] [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
2020-11-02 23:52   ` [dpdk-dev] [PATCH v2 4/4] test/lpm: avoid code duplication " Dharmik Thakkar
2020-11-03  4:21     ` Honnappa Nagarahalli
2020-11-03  4:33       ` Dharmik Thakkar
2020-11-03  5:32         ` Honnappa Nagarahalli
2020-11-03 14:03           ` Dharmik Thakkar
2020-11-03 14:51             ` Honnappa Nagarahalli
2020-11-03 18:01             ` Medvedkin, Vladimir
2020-11-03  5:12   ` [dpdk-dev] [PATCH v3 0/4] test/lpm: fix rcu qsbr perf test Dharmik Thakkar
2020-11-03  5:12     ` [dpdk-dev] [PATCH v3 1/4] test/lpm: fix cycle calculation in rcu qsbr perf Dharmik Thakkar
2020-11-03  5:12     ` [dpdk-dev] [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-dev] [PATCH v3 3/4] test/lpm: remove error checking " Dharmik Thakkar
2020-11-03  5:22       ` Honnappa Nagarahalli
2020-11-03  5:12     ` [dpdk-dev] [PATCH v3 4/4] test/lpm: avoid code duplication " Dharmik Thakkar
2020-11-03 22:23     ` [dpdk-dev] [PATCH v4 0/4] test/lpm: fix rcu qsbr perf test Dharmik Thakkar
2020-11-03 22:23       ` [dpdk-dev] [PATCH v4 1/4] test/lpm: fix cycle calculation in rcu qsbr perf Dharmik Thakkar
2020-11-03 22:23       ` [dpdk-dev] [PATCH v4 2/4] test/lpm: return error on failure " Dharmik Thakkar
2020-11-03 22:23       ` [dpdk-dev] [PATCH v4 3/4] test/lpm: remove error checking " Dharmik Thakkar
2020-11-03 22:23       ` [dpdk-dev] [PATCH v4 4/4] test/lpm: avoid code duplication " Dharmik Thakkar
2020-11-03 22:35         ` Honnappa Nagarahalli
2020-11-04 15:46         ` Medvedkin, Vladimir
2020-11-04 16:49           ` Dharmik Thakkar
2020-11-04 18:58       ` [dpdk-dev] [PATCH v5 0/4] test/lpm: fix rcu qsbr perf test Dharmik Thakkar
2020-11-04 18:58         ` [dpdk-dev] [PATCH v5 1/4] test/lpm: fix cycle calculation in rcu qsbr perf Dharmik Thakkar
2020-11-04 19:34           ` Medvedkin, Vladimir
2020-11-04 18:58         ` [dpdk-dev] [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-dev] [PATCH v5 3/4] test/lpm: remove error checking " Dharmik Thakkar
2020-11-04 19:35           ` Medvedkin, Vladimir
2020-11-04 18:58         ` [dpdk-dev] [PATCH v5 4/4] test/lpm: avoid code duplication " Dharmik Thakkar
2020-11-04 19:35           ` Medvedkin, Vladimir
2020-11-05 15:58         ` [dpdk-dev] [PATCH v5 0/4] test/lpm: fix rcu qsbr perf test David Marchand

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git