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 BD375A0096 for ; Tue, 4 Jun 2019 11:00:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 518A11BBE2; Tue, 4 Jun 2019 11:00:36 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 3F6931BB78; Tue, 4 Jun 2019 11:00:35 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0E8FC1EB1E1; Tue, 4 Jun 2019 09:00:34 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-116-185.ams2.redhat.com [10.36.116.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34EB418674; Tue, 4 Jun 2019 09:00:28 +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: Tue, 4 Jun 2019 10:59:43 +0200 Message-Id: <1559638792-8608-6-git-send-email-david.marchand@redhat.com> In-Reply-To: <1559638792-8608-1-git-send-email-david.marchand@redhat.com> References: <1559638792-8608-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 04 Jun 2019 09:00:34 +0000 (UTC) Subject: [dpdk-dev] [PATCH 05/14] 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 --- 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