From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 509B4A00E6 for ; Sat, 15 Jun 2019 08:43:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F1761D534; Sat, 15 Jun 2019 08:43:09 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id BF3771D536; Sat, 15 Jun 2019 08:43:07 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CA6459451; Sat, 15 Jun 2019 06:43:07 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.205.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id D64DA5C1A1; Sat, 15 Jun 2019 06:43:00 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, aconole@redhat.com, msantana@redhat.com, Dharmik Thakkar , stable@dpdk.org, Yipeng Wang , Sameh Gobriel , Bruce Richardson , Pablo de Lara Date: Sat, 15 Jun 2019 08:42:20 +0200 Message-Id: <1560580950-16754-6-git-send-email-david.marchand@redhat.com> In-Reply-To: <1560580950-16754-1-git-send-email-david.marchand@redhat.com> References: <1559638792-8608-1-git-send-email-david.marchand@redhat.com> <1560580950-16754-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sat, 15 Jun 2019 06:43:07 +0000 (UTC) Subject: [dpdk-dev] [PATCH v2 05/15] test/hash: rectify slaveid to point to valid cores X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Dharmik Thakkar This patch rectifies slave_id to point to valid core indexes rather than core ranks in read-write lock-free concurrency test. It also replaces a 'for' loop with RTE_LCORE_FOREACH API. Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency") Cc: stable@dpdk.org Signed-off-by: Dharmik Thakkar Reviewed-by: Ruifeng Wang Signed-off-by: David Marchand Acked-by: Yipeng Wang --- app/test/test_hash_readwrite_lf.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index f9f233a..5644361 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -126,11 +126,9 @@ struct { uint32_t i = 0; uint16_t core_id; uint32_t max_cores = rte_lcore_count(); - for (core_id = 0; core_id < RTE_MAX_LCORE && i < max_cores; core_id++) { - if (rte_lcore_is_enabled(core_id)) { - enabled_core_ids[i] = core_id; - i++; - } + RTE_LCORE_FOREACH(core_id) { + enabled_core_ids[i] = core_id; + i++; } if (i != max_cores) { @@ -738,7 +736,7 @@ struct { enabled_core_ids[i]); for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -810,7 +808,7 @@ struct { if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -886,7 +884,7 @@ struct { if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -962,7 +960,7 @@ struct { if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -1037,7 +1035,7 @@ struct { if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -1132,12 +1130,12 @@ struct { for (i = rwc_core_cnt[n] + 1; i <= rwc_core_cnt[m] + rwc_core_cnt[n]; i++) - rte_eal_wait_lcore(i); + rte_eal_wait_lcore(enabled_core_ids[i]); writer_done = 1; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -1221,7 +1219,7 @@ struct { writer_done = 1; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = -- 1.8.3.1