From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 9C7811B49C for ; Thu, 22 Nov 2018 17:52:20 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CAD7312E9D7; Thu, 22 Nov 2018 16:52:20 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 475CB60E3F; Thu, 22 Nov 2018 16:52:17 +0000 (UTC) From: Kevin Traynor To: Yipeng Wang Cc: Bruce Richardson , dpdk stable Date: Thu, 22 Nov 2018 16:49:23 +0000 Message-Id: <20181122164957.13003-31-ktraynor@redhat.com> In-Reply-To: <20181122164957.13003-1-ktraynor@redhat.com> References: <20181122164957.13003-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 22 Nov 2018 16:52:20 +0000 (UTC) Subject: [dpdk-stable] patch 'test/hash: fix r/w test with non-consecutive cores' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Nov 2018 16:52:21 -0000 Hi, FYI, your patch has been queued to stable release 18.08.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/28/18. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From d99b2fd115bf45183960dc085a867c14a2458d2d Mon Sep 17 00:00:00 2001 From: Yipeng Wang Date: Fri, 28 Sep 2018 07:11:07 -0700 Subject: [PATCH] test/hash: fix r/w test with non-consecutive cores [ upstream commit b2f1f3c02148af2a490802d271842f1c1e80df3d ] the multi-reader and multi-writer rte_hash unit test does not work correctly with non-consecutive core ids. This commit fixes the issue. Fixes: 0eb3726ebcf1 ("test/hash: add test for read/write concurrency") Signed-off-by: Yipeng Wang Tested-by: Bruce Richardson Acked-by: Bruce Richardson --- test/test/test_hash_readwrite.c | 78 +++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 29 deletions(-) diff --git a/test/test/test_hash_readwrite.c b/test/test/test_hash_readwrite.c index 55ae33d80..2a4f7b9b5 100644 --- a/test/test/test_hash_readwrite.c +++ b/test/test/test_hash_readwrite.c @@ -25,4 +25,5 @@ unsigned int core_cnt[NUM_TEST] = {2, 4, 8}; +unsigned int slave_core_ids[RTE_MAX_LCORE]; struct perf { uint32_t single_read; @@ -61,10 +62,13 @@ test_hash_readwrite_worker(__attribute__((unused)) void *arg) int ret; - offset = (lcore_id - rte_get_master_lcore()) - * tbl_rw_test_param.num_insert; + for (i = 0; i < rte_lcore_count(); i++) { + if (slave_core_ids[i] == lcore_id) + break; + } + offset = tbl_rw_test_param.num_insert * i; printf("Core #%d inserting and reading %d: %'"PRId64" - %'"PRId64"\n", lcore_id, tbl_rw_test_param.num_insert, - offset, offset + tbl_rw_test_param.num_insert); + offset, offset + tbl_rw_test_param.num_insert - 1); begin = rte_rdtsc_precise(); @@ -172,4 +176,5 @@ test_hash_readwrite_functional(int use_htm) uint32_t lost_keys = 0; int use_jhash = 1; + int slave_cnt = rte_lcore_count() - 1; rte_atomic64_init(&gcycles); @@ -183,9 +188,9 @@ test_hash_readwrite_functional(int use_htm) tbl_rw_test_param.num_insert = - TOTAL_INSERT / rte_lcore_count(); + TOTAL_INSERT / slave_cnt; tbl_rw_test_param.rounded_tot_insert = tbl_rw_test_param.num_insert - * rte_lcore_count(); + * slave_cnt; printf("++++++++Start function tests:+++++++++\n"); @@ -193,5 +198,5 @@ test_hash_readwrite_functional(int use_htm) /* Fire all threads. */ rte_eal_mp_remote_launch(test_hash_readwrite_worker, - NULL, CALL_MASTER); + NULL, SKIP_MASTER); rte_eal_mp_wait_lcore(); @@ -250,5 +255,5 @@ err: static int -test_rw_reader(__attribute__((unused)) void *arg) +test_rw_reader(void *arg) { uint64_t i; @@ -277,5 +282,5 @@ test_rw_reader(__attribute__((unused)) void *arg) static int -test_rw_writer(__attribute__((unused)) void *arg) +test_rw_writer(void *arg) { uint64_t i; @@ -286,6 +291,11 @@ test_rw_writer(__attribute__((unused)) void *arg) uint64_t offset; - offset = TOTAL_INSERT / 2 + (lcore_id - start_coreid) - * tbl_rw_test_param.num_insert; + for (i = 0; i < rte_lcore_count(); i++) { + if (slave_core_ids[i] == lcore_id) + break; + } + + offset = TOTAL_INSERT / 2 + (i - (start_coreid)) * + tbl_rw_test_param.num_insert; begin = rte_rdtsc_precise(); for (i = offset; i < offset + tbl_rw_test_param.num_insert; i++) { @@ -385,6 +395,6 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm, for (n = 0; n < NUM_TEST; n++) { - unsigned int tot_lcore = rte_lcore_count(); - if (tot_lcore < core_cnt[n] * 2 + 1) + unsigned int tot_slave_lcore = rte_lcore_count() - 1; + if (tot_slave_lcore < core_cnt[n] * 2) goto finish; @@ -416,7 +426,8 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm, /* Test only reader cases */ - for (i = 1; i <= core_cnt[n]; i++) + for (i = 0; i < core_cnt[n]; i++) rte_eal_remote_launch(test_rw_reader, - (void *)(uintptr_t)read_cnt, i); + (void *)(uintptr_t)read_cnt, + slave_core_ids[i]); rte_eal_mp_wait_lcore(); @@ -424,7 +435,8 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm, start_coreid = i; /* Test only writer cases */ - for (; i <= core_cnt[n] * 2; i++) + for (; i < core_cnt[n] * 2; i++) rte_eal_remote_launch(test_rw_writer, - (void *)((uintptr_t)start_coreid), i); + (void *)((uintptr_t)start_coreid), + slave_core_ids[i]); rte_eal_mp_wait_lcore(); @@ -465,20 +477,24 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm, } - start_coreid = core_cnt[n] + 1; + start_coreid = core_cnt[n]; if (reader_faster) { - for (i = core_cnt[n] + 1; i <= core_cnt[n] * 2; i++) + for (i = core_cnt[n]; i < core_cnt[n] * 2; i++) rte_eal_remote_launch(test_rw_writer, - (void *)((uintptr_t)start_coreid), i); - for (i = 1; i <= core_cnt[n]; i++) + (void *)((uintptr_t)start_coreid), + slave_core_ids[i]); + for (i = 0; i < core_cnt[n]; i++) rte_eal_remote_launch(test_rw_reader, - (void *)(uintptr_t)read_cnt, i); + (void *)(uintptr_t)read_cnt, + slave_core_ids[i]); } else { - for (i = 1; i <= core_cnt[n]; i++) + for (i = 0; i < core_cnt[n]; i++) rte_eal_remote_launch(test_rw_reader, - (void *)(uintptr_t)read_cnt, i); - for (; i <= core_cnt[n] * 2; i++) + (void *)(uintptr_t)read_cnt, + slave_core_ids[i]); + for (; i < core_cnt[n] * 2; i++) rte_eal_remote_launch(test_rw_writer, - (void *)((uintptr_t)start_coreid), i); + (void *)((uintptr_t)start_coreid), + slave_core_ids[i]); } @@ -563,11 +579,17 @@ test_hash_readwrite_main(void) */ int use_htm, reader_faster; + unsigned int i = 0, core_id = 0; - if (rte_lcore_count() == 1) { - printf("More than one lcore is required " + if (rte_lcore_count() <= 2) { + printf("More than two lcores are required " "to do read write test\n"); return 0; } + RTE_LCORE_FOREACH_SLAVE(core_id) { + slave_core_ids[i] = core_id; + i++; + } + setlocale(LC_NUMERIC, ""); @@ -611,6 +633,4 @@ test_hash_readwrite_main(void) printf("Results summary:\n"); - int i; - printf("single read: %u\n", htm_results.single_read); printf("single write: %u\n", htm_results.single_write); -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-22 16:47:33.062198462 +0000 +++ 0031-test-hash-fix-r-w-test-with-non-consecutive-cores.patch 2018-11-22 16:47:32.000000000 +0000 @@ -1,14 +1,15 @@ -From b2f1f3c02148af2a490802d271842f1c1e80df3d Mon Sep 17 00:00:00 2001 +From d99b2fd115bf45183960dc085a867c14a2458d2d Mon Sep 17 00:00:00 2001 From: Yipeng Wang Date: Fri, 28 Sep 2018 07:11:07 -0700 Subject: [PATCH] test/hash: fix r/w test with non-consecutive cores +[ upstream commit b2f1f3c02148af2a490802d271842f1c1e80df3d ] + the multi-reader and multi-writer rte_hash unit test does not work correctly with non-consecutive core ids. This commit fixes the issue. Fixes: 0eb3726ebcf1 ("test/hash: add test for read/write concurrency") -Cc: stable@dpdk.org Signed-off-by: Yipeng Wang Tested-by: Bruce Richardson