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 95C01A05D3 for ; Wed, 22 May 2019 18:26:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B28575589; Wed, 22 May 2019 18:26:03 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10047.outbound.protection.outlook.com [40.107.1.47]) by dpdk.org (Postfix) with ESMTP id 0FE864C80; Wed, 22 May 2019 18:26:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QS5lM92qxjq3cBhGDI6D3q3kuN8IPS+du1/Q+lXHsqQ=; b=r1l6cp7hLVVTNudLRvP2oMmEk6wK+KACao15xUL0GYgiZR3eNrB7SD0shzx87oTr/oSJ/TzK21PIgtFAQB2zA/3El8vaD5g3AyD5ze5JqNOY+Lvv6hfvvZADlE8LXbiv4gLvUb+z8nN7AeCJWVbM1o7G7ejAtS+UM7zSrMIAoZ8= Received: from AM0PR08MB3379.eurprd08.prod.outlook.com (20.177.109.142) by AM0PR08MB5266.eurprd08.prod.outlook.com (20.179.39.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.16; Wed, 22 May 2019 16:26:01 +0000 Received: from AM0PR08MB3379.eurprd08.prod.outlook.com ([fe80::1163:3f6:3219:55ed]) by AM0PR08MB3379.eurprd08.prod.outlook.com ([fe80::1163:3f6:3219:55ed%3]) with mapi id 15.20.1900.020; Wed, 22 May 2019 16:26:01 +0000 From: Dharmik Thakkar To: David Marchand CC: "dev@dpdk.org" , "thomas@monjalon.net" , Stephen Hemminger , "maxime.coquelin@redhat.com" , "stable@dpdk.org" , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Pablo de Lara , nd Thread-Topic: [PATCH v2 1/2] test/hash: use existing lcore API Thread-Index: AQHVELBHveV4sz8jtkC3zeQ0ToSAAKZ3VLWA Date: Wed, 22 May 2019 16:26:01 +0000 Message-ID: <9B028D36-C801-49AC-B529-C8721F0B7D8C@arm.com> References: <1557907020-1548-1-git-send-email-david.marchand@redhat.com> <1558537617-27813-1-git-send-email-david.marchand@redhat.com> In-Reply-To: <1558537617-27813-1-git-send-email-david.marchand@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Dharmik.Thakkar@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0d5777a2-3099-4f3e-096c-08d6ded22e2d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR08MB5266; x-ms-traffictypediagnostic: AM0PR08MB5266: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 0045236D47 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(376002)(346002)(136003)(396003)(39860400002)(366004)(54534003)(189003)(199004)(54906003)(102836004)(66476007)(64756008)(5660300002)(66446008)(76176011)(99286004)(25786009)(76116006)(91956017)(73956011)(66946007)(6506007)(66556008)(82746002)(6486002)(256004)(53546011)(6512007)(14444005)(476003)(81156014)(486006)(446003)(8936002)(81166006)(2616005)(14454004)(478600001)(8676002)(11346002)(72206003)(7416002)(6436002)(36756003)(6916009)(7736002)(316002)(6246003)(229853002)(26005)(186003)(305945005)(71190400001)(71200400001)(86362001)(4326008)(6116002)(66066001)(3846002)(83716004)(68736007)(53936002)(33656002)(2906002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB5266; H:AM0PR08MB3379.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: nbLTkfX3E7lT0QZplXkOItvXn2+jui+IPBoAxI32yMDemaZuijElDNjO6joTGef6swY2hbDPvuABntM4KQuT1qhZ43sHMSzVw0trrdH6r2JmTY1qjo0VSntJ/QPE+m3ycSC17MOiBW6TZw+f4mwmMh8DDu/tX1oucnjsjNJIKdew9vLYi8fp//Utw4x5juX8d5Pjuwi3i7VrEGnEPmQFQg4O7iYsDzBQFD5IDas6GMgNx+CqWKZhDT8ZDANbcy79ocewVlpn4X+71RT3WWOEFJOqbGGX/oYvx9fpk7wQxxKIifWt931tbII6SvFfDXHBM9EhOEI/8t/g9Zc8T1A4yxSAD7Tbth09aXIMTHU3OBrTKvXIzkAxQxaEPJegXF+WBXXWWHKJvyJ5OuZlfdWmnSg9/bdzD54xWsZ/7Alp3kY= Content-Type: text/plain; charset="us-ascii" Content-ID: <56D433EA5700DA41ADDCA0F4CF935871@eurprd08.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d5777a2-3099-4f3e-096c-08d6ded22e2d X-MS-Exchange-CrossTenant-originalarrivaltime: 22 May 2019 16:26:01.7806 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5266 Subject: Re: [dpdk-dev] [PATCH v2 1/2] test/hash: use existing lcore API 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" Hi David, Thank you for the patch! Some comments inlined. > On May 22, 2019, at 10:06 AM, David Marchand = wrote: >=20 > Prefer the existing apis rather than direct access the configuration > structure. >=20 > test_hash_multi_add_lookup() currently starts n readers and N writers > using rte_eal_remote_launch(). > It then waits for the N writers to complete with a custom > multi_writer_done[] array to synchronise over. > Jump on the occasion to use rte_eal_wait_lcore() so that the code is > more straightforward: > - we start n readers with rte_eal_remote_launch(), > - we start N writers with rte_eal_remote_launch(), > - we wait for N writers to join with rte_eal_wait_lcore(), > - we wait for n readers to join with rte_eal_wait_lcore(), >=20 > Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency") > Fixes: 3f9aab961ed3 ("test/hash: check lock-free extendable bucket") > Cc: stable@dpdk.org >=20 > Signed-off-by: David Marchand > --- > app/test/test_hash_readwrite_lf.c | 41 ++++++++++++++++++----------------= ----- > 1 file changed, 19 insertions(+), 22 deletions(-) >=20 > --- > Changelog since v1: > - fixed test hang in test_hash_multi_add_lookup() reported by Wang, Yipen= g >=20 > diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readw= rite_lf.c > index 4ab4c8e..343a338 100644 > --- a/app/test/test_hash_readwrite_lf.c > +++ b/app/test/test_hash_readwrite_lf.c > @@ -86,7 +86,6 @@ struct { > static rte_atomic64_t greads; >=20 > static volatile uint8_t writer_done; > -static volatile uint8_t multi_writer_done[4]; >=20 > uint16_t enabled_core_ids[RTE_MAX_LCORE]; >=20 > @@ -690,7 +689,6 @@ struct { > for (i =3D offset; i < offset + tbl_rwc_test_param.single_insert; i++) > rte_hash_add_key(tbl_rwc_test_param.h, > tbl_rwc_test_param.keys_ks + i); > - multi_writer_done[pos_core] =3D 1; > return 0; > } >=20 > @@ -738,10 +736,9 @@ struct { > rte_eal_remote_launch(test_rwc_reader, > (void *)(uintptr_t)read_type, > enabled_core_ids[i]); > - rte_eal_mp_wait_lcore(); >=20 > for (i =3D 1; i <=3D rwc_core_cnt[n]; i++) > - if (lcore_config[i].ret < 0) > + if (rte_eal_wait_lcore(i) < 0) if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) (There are similar changes in other functions too. I realize that this is a separate issue than what the patch is aimed for. If you see fit, please integrate it, else I will put out a patch once your = patch has been merged.) > goto err; >=20 > unsigned long long cycles_per_lookup =3D > @@ -758,6 +755,7 @@ struct { > return 0; >=20 > err: > + rte_eal_mp_wait_lcore(); > rte_hash_free(tbl_rwc_test_param.h); > return -1; > } > @@ -808,12 +806,11 @@ struct { > enabled_core_ids[i]); > ret =3D write_keys(write_type); > writer_done =3D 1; > - rte_eal_mp_wait_lcore(); >=20 > if (ret < 0) > goto err; > for (i =3D 1; i <=3D rwc_core_cnt[n]; i++) > - if (lcore_config[i].ret < 0) > + if (rte_eal_wait_lcore(i) < 0) if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) > goto err; >=20 > unsigned long long cycles_per_lookup =3D > @@ -830,6 +827,7 @@ struct { > return 0; >=20 > err: > + rte_eal_mp_wait_lcore(); > rte_hash_free(tbl_rwc_test_param.h); > return -1; > } > @@ -884,12 +882,11 @@ struct { > write_type =3D WRITE_KEY_SHIFT; > ret =3D write_keys(write_type); > writer_done =3D 1; > - rte_eal_mp_wait_lcore(); >=20 > if (ret < 0) > goto err; > for (i =3D 1; i <=3D rwc_core_cnt[n]; i++) > - if (lcore_config[i].ret < 0) > + if (rte_eal_wait_lcore(i) < 0) if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) > goto err; >=20 > unsigned long long cycles_per_lookup =3D > @@ -906,6 +903,7 @@ struct { > return 0; >=20 > err: > + rte_eal_mp_wait_lcore(); > rte_hash_free(tbl_rwc_test_param.h); > return -1; > } > @@ -960,12 +958,11 @@ struct { > write_type =3D WRITE_KEY_SHIFT; > ret =3D write_keys(write_type); > writer_done =3D 1; > - rte_eal_mp_wait_lcore(); >=20 > if (ret < 0) > goto err; > for (i =3D 1; i <=3D rwc_core_cnt[n]; i++) > - if (lcore_config[i].ret < 0) > + if (rte_eal_wait_lcore(i) < 0) if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) > goto err; >=20 > unsigned long long cycles_per_lookup =3D > @@ -982,6 +979,7 @@ struct { > return 0; >=20 > err: > + rte_eal_mp_wait_lcore(); > rte_hash_free(tbl_rwc_test_param.h); > return -1; > } > @@ -1035,12 +1033,11 @@ struct { > write_type =3D WRITE_KEY_SHIFT; > ret =3D write_keys(write_type); > writer_done =3D 1; > - rte_eal_mp_wait_lcore(); >=20 > if (ret < 0) > goto err; > for (i =3D 1; i <=3D rwc_core_cnt[n]; i++) > - if (lcore_config[i].ret < 0) > + if (rte_eal_wait_lcore(i) < 0) if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) > goto err; >=20 > unsigned long long cycles_per_lookup =3D > @@ -1056,6 +1053,7 @@ struct { > return 0; >=20 > err: > + rte_eal_mp_wait_lcore(); > rte_hash_free(tbl_rwc_test_param.h); > return -1; > } > @@ -1108,8 +1106,6 @@ struct { >=20 > rte_hash_reset(tbl_rwc_test_param.h); > writer_done =3D 0; > - for (i =3D 0; i < 4; i++) > - multi_writer_done[i] =3D 0; > write_type =3D WRITE_NO_KEY_SHIFT; > if (write_keys(write_type) < 0) > goto err; > @@ -1133,15 +1129,15 @@ struct { > } >=20 > /* Wait for writers to complete */ > - for (i =3D 0; i < rwc_core_cnt[m]; i++) > - while > - (multi_writer_done[i] =3D=3D 0); > - writer_done =3D 1; > + for (i =3D rwc_core_cnt[n] + 1; > + i <=3D rwc_core_cnt[m] + rwc_core_cnt[n]; > + i++) > + rte_eal_wait_lcore(i); rte_eal_wait_lcore(enabled_core_ids[i]); >=20 > - rte_eal_mp_wait_lcore(); > + writer_done =3D 1; >=20 > for (i =3D 1; i <=3D rwc_core_cnt[n]; i++) > - if (lcore_config[i].ret < 0) > + if (rte_eal_wait_lcore(i) < 0) if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) > goto err; >=20 > unsigned long long cycles_per_lookup =3D > @@ -1160,6 +1156,7 @@ struct { > return 0; >=20 > err: > + rte_eal_mp_wait_lcore(); > rte_hash_free(tbl_rwc_test_param.h); > return -1; > } > @@ -1222,10 +1219,9 @@ struct { > } > } > writer_done =3D 1; > - rte_eal_mp_wait_lcore(); >=20 > for (i =3D 1; i <=3D rwc_core_cnt[n]; i++) > - if (lcore_config[i].ret < 0) > + if (rte_eal_wait_lcore(i) < 0) if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) > goto err; >=20 > unsigned long long cycles_per_lookup =3D > @@ -1242,6 +1238,7 @@ struct { > return 0; >=20 > err: > + rte_eal_mp_wait_lcore(); > rte_hash_free(tbl_rwc_test_param.h); > return -1; > } > --=20 > 1.8.3.1 >=20 Thank you, Dharmik Thakkar