From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60080.outbound.protection.outlook.com [40.107.6.80]) by dpdk.org (Postfix) with ESMTP id 043FB5699 for ; Fri, 26 Oct 2018 02:32:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HplBRAUzFJnMA5SnvJjadKZA7Nl0KPEav3IDU394S3g=; b=rsFFlFNgvGOVPcRiWMe7sCpQlcErgrzUPOHRBEfUx3Jw+zZ5TaT7V8v5BEHbxKtktaf3Z5TVQU5pgcs1mqNsTCPkprpBRXnhOJphUcpZpCr7gR/7VjdhfK9fHZ7AVCYgbK/EAfMvuja+GfVZN20N13HT74uoGDBdwMO/yNnY4Cs= Received: from AM6PR08MB3672.eurprd08.prod.outlook.com (20.177.115.29) by AM6PR08MB3863.eurprd08.prod.outlook.com (20.178.90.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.20; Fri, 26 Oct 2018 00:32:34 +0000 Received: from AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::c1a0:51bf:cd33:2b27]) by AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::c1a0:51bf:cd33:2b27%5]) with mapi id 15.20.1250.032; Fri, 26 Oct 2018 00:32:33 +0000 From: Honnappa Nagarahalli To: Yipeng Wang , "bruce.richardson@intel.com" CC: "stephen@networkplumber.org" , "dev@dpdk.org" , "sameh.gobriel@intel.com" , nd Thread-Topic: [PATCH v2 3/4] test/hash: add readwrite test for ext table Thread-Index: AQHUbAAicGON2FakdEObwvm8fdvGo6UwT5iQ Date: Fri, 26 Oct 2018 00:32:33 +0000 Message-ID: References: <1540404570-102126-1-git-send-email-yipeng1.wang@intel.com> <1540404570-102126-4-git-send-email-yipeng1.wang@intel.com> In-Reply-To: <1540404570-102126-4-git-send-email-yipeng1.wang@intel.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=Honnappa.Nagarahalli@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR08MB3863; 6:BefCMoheGA2C51vX564MO3ScOFDVwAsTkxA8enHVXxAaZ8n1ZBJyHl/F0ElfgdqObgDvEpJPoLxqyqrA0hNwcCUo/xbA9EVAQ3vjf7n0ES30ifDVsa9tH+ZwGNv49Dgk8vb8EYF7LgD8WzrpTvn0tfeQ+4O7Y2dnnUNQkf7Zj/Y3BGhhbocb6z9yNDw3sL/Nar9ilgsUxmtEtCuacqEG0tTSj7WoId4iBVBBQE2j6VTKIdIle4DBzz6mmYE6hU24ery5qignZQMidlrJ4jp/pbQwcpkz26WceYnMDyJHmc44CbWfZbZy439RLYxuC5SlLt1Y4PPsY/oKdOWVJF8Gr16qLfwX+KddJb013wWBbruRBa7wIr1uPpP/j8BDiojvmVGyPYC5Y79qUkmwgcRY+BeE0rUrbgb9ChcVt5CpfQvj5xeVKAcrmhjw8o8wNWYJ43B8ZG2Y9WjcQ/3NQ51B/Q==; 5:kMq2QbKVYWXQm7pIRoCPX/wdilzdeFs5FDYVwRAoRXdXFO/8YA4AU5/y6lvj5qTPA9niMm7vY8A1mi+mnmkie5f3xNPPIVQIYHUiKQxL4NyCDlMnHmim8RTZ4LRFlmsYFP/l7z8cHhkzxOlwbCWyh5wC7NIXK1Z9ufjpFir4Wns=; 7:BbjPFLS5IL+/PipOdc3WJCyG8HYr+RkSKuKwd88CjEl9pJJvTuZ0DSyf2QSUc2yPY6vZrSUSqpnQwsORBqQszSW4WKu/Q8hqzidDZPocKKZJf2pQn+ey3VQCJiKtUe+n1mlPwqFC9WSjDEdi7wyszg== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 1db81586-d446-4716-c6f9-08d63ada85ad x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR08MB3863; x-ms-traffictypediagnostic: AM6PR08MB3863: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231355)(944501410)(52105095)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM6PR08MB3863; BCL:0; PCL:0; RULEID:; SRVR:AM6PR08MB3863; x-forefront-prvs: 083751FCA6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(366004)(39860400002)(346002)(376002)(199004)(189003)(2501003)(8936002)(5660300001)(33656002)(102836004)(106356001)(186003)(3846002)(6116002)(26005)(68736007)(105586002)(66066001)(316002)(2900100001)(4326008)(54906003)(110136005)(53936002)(6436002)(6506007)(99286004)(9686003)(72206003)(76176011)(55016002)(7696005)(25786009)(476003)(14454004)(97736004)(446003)(74316002)(2906002)(256004)(11346002)(5250100002)(86362001)(478600001)(6246003)(229853002)(71200400001)(486006)(81166006)(305945005)(71190400001)(7736002)(81156014)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB3863; H:AM6PR08MB3672.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ofuBwiJT8F2QJHtUH6EfYr+e/cbAMyKvuPq3Zw7VIP0nyqwT2q3wafOkc1YCEXEd6rB1sjRCNhfLmjstabO1KCw+PHBqAmSgvu0SuC1lAFyCgClEUL1VTM3EP4xSMy2jocnA/A5HUuLZARXZuLSmFay+WPsRpkvGTmUi09H2hsDBqo+KZxOmi4WlMMOxzqvvOjXqrSF3m97CKojZkavRjI/N+0KwEx1TDid3UK8VvoDVAMy7CKmv3a7GIOYC/4eHtrkJO8b4eWl9M4GliJ2hveM0ZmrtmnRWXYVJB/kGnLbGpXBl8p1A1pRCz4WODzDFtro1JaRnFsS1gNjK+tReY5qaGfeStnSft0jpQ9UMYrY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1db81586-d446-4716-c6f9-08d63ada85ad X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Oct 2018 00:32:33.9075 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3863 Subject: Re: [dpdk-dev] [PATCH v2 3/4] test/hash: add readwrite test for ext table 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: , X-List-Received-Date: Fri, 26 Oct 2018 00:32:35 -0000 > Subject: [PATCH v2 3/4] test/hash: add readwrite test for ext table >=20 > This commit improves the readwrite test to consider extendable table > feature and add more functional tests to cover more corner cases. >=20 I think the part covering the more corner cases should go into a separate c= ommit. > Signed-off-by: Yipeng Wang > --- > test/test/test_hash_readwrite.c | 70 > ++++++++++++++++++++++++++++++++++------- > 1 file changed, 58 insertions(+), 12 deletions(-) >=20 > diff --git a/test/test/test_hash_readwrite.c > b/test/test/test_hash_readwrite.c index a8fadd0..13c28e0 100644 > --- a/test/test/test_hash_readwrite.c > +++ b/test/test/test_hash_readwrite.c > @@ -21,6 +21,8 @@ > #define TOTAL_ENTRY (16*1024*1024) > #define TOTAL_INSERT (15*1024*1024) >=20 > +#define TOTAL_INSERT_EXT (16*1024*1024) > + > #define NUM_TEST 3 > unsigned int core_cnt[NUM_TEST] =3D {2, 4, 8}; >=20 > @@ -59,8 +61,10 @@ test_hash_readwrite_worker(__attribute__((unused)) > void *arg) > uint64_t i, offset; > uint32_t lcore_id =3D rte_lcore_id(); > uint64_t begin, cycles; > - int ret; > + int *ret; >=20 > + ret =3D rte_malloc(NULL, sizeof(int) * > + tbl_rw_test_param.num_insert, 0); This memory needs to be freed. > for (i =3D 0; i < rte_lcore_count(); i++) { > if (slave_core_ids[i] =3D=3D lcore_id) > break; > @@ -79,13 +83,30 @@ test_hash_readwrite_worker(__attribute__((unused)) > void *arg) > tbl_rw_test_param.keys + i) > 0) > break; >=20 > - ret =3D rte_hash_add_key(tbl_rw_test_param.h, > + ret[i - offset] =3D rte_hash_add_key(tbl_rw_test_param.h, > tbl_rw_test_param.keys + i); > - if (ret < 0) > + if (ret[i - offset] < 0) > + break; > + > + /* lookup a random key */ > + uint32_t rand =3D rte_rand() % (i + 1 - offset); > + > + if (rte_hash_lookup(tbl_rw_test_param.h, > + tbl_rw_test_param.keys + rand) !=3D ret[rand]) > + break; > + > + > + if (rte_hash_del_key(tbl_rw_test_param.h, > + tbl_rw_test_param.keys + rand) !=3D ret[rand]) > + break; > + > + ret[rand] =3D rte_hash_add_key(tbl_rw_test_param.h, > + tbl_rw_test_param.keys + rand); > + if (ret[rand] < 0) > break; >=20 > if (rte_hash_lookup(tbl_rw_test_param.h, > - tbl_rw_test_param.keys + i) !=3D ret) > + tbl_rw_test_param.keys + rand) !=3D ret[rand]) > break; > } >=20 > @@ -100,7 +121,7 @@ test_hash_readwrite_worker(__attribute__((unused)) > void *arg) } >=20 > static int > -init_params(int use_htm, int use_jhash) > +init_params(int use_ext, int use_htm, int use_jhash) > { > unsigned int i; >=20 > @@ -129,6 +150,13 @@ init_params(int use_htm, int use_jhash) > RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; >=20 > + if (use_ext) > + hash_params.extra_flag |=3D > + RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > + else > + hash_params.extra_flag &=3D > + ~RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > + > hash_params.name =3D "tests"; >=20 > handle =3D rte_hash_create(&hash_params); @@ -167,7 +195,7 @@ > init_params(int use_htm, int use_jhash) } >=20 > static int > -test_hash_readwrite_functional(int use_htm) > +test_hash_readwrite_functional(int use_ext, int use_htm) > { > unsigned int i; > const void *next_key; > @@ -178,6 +206,7 @@ test_hash_readwrite_functional(int use_htm) > uint32_t lost_keys =3D 0; > int use_jhash =3D 1; > int slave_cnt =3D rte_lcore_count() - 1; > + uint32_t tot_insert =3D 0; >=20 > rte_atomic64_init(&gcycles); > rte_atomic64_clear(&gcycles); > @@ -185,11 +214,16 @@ test_hash_readwrite_functional(int use_htm) > rte_atomic64_init(&ginsertions); > rte_atomic64_clear(&ginsertions); >=20 > - if (init_params(use_htm, use_jhash) !=3D 0) > + if (init_params(use_ext, use_htm, use_jhash) !=3D 0) > goto err; >=20 > + if (use_ext) > + tot_insert =3D TOTAL_INSERT_EXT; > + else > + tot_insert =3D TOTAL_INSERT; > + > tbl_rw_test_param.num_insert =3D > - TOTAL_INSERT / slave_cnt; > + tot_insert / slave_cnt; >=20 > tbl_rw_test_param.rounded_tot_insert =3D > tbl_rw_test_param.num_insert > @@ -345,7 +379,7 @@ test_hash_readwrite_perf(struct perf *perf_results, > int use_htm, > rte_atomic64_init(&gwrite_cycles); > rte_atomic64_clear(&gwrite_cycles); >=20 > - if (init_params(use_htm, use_jhash) !=3D 0) > + if (init_params(0, use_htm, use_jhash) !=3D 0) > goto err; >=20 > /* > @@ -579,7 +613,7 @@ test_hash_readwrite_main(void) > * than writer threads. This is to timing either reader threads or > * writer threads for performance numbers. > */ > - int use_htm, reader_faster; > + int use_htm, use_ext, reader_faster; > unsigned int i =3D 0, core_id =3D 0; >=20 > if (rte_lcore_count() <=3D 2) { > @@ -602,7 +636,13 @@ test_hash_readwrite_main(void) > printf("Test read-write with Hardware transactional > memory\n"); >=20 > use_htm =3D 1; > - if (test_hash_readwrite_functional(use_htm) < 0) > + use_ext =3D 0; > + > + if (test_hash_readwrite_functional(use_ext, use_htm) < 0) > + return -1; > + > + use_ext =3D 1; > + if (test_hash_readwrite_functional(use_ext, use_htm) < 0) > return -1; >=20 > reader_faster =3D 1; > @@ -621,8 +661,14 @@ test_hash_readwrite_main(void) >=20 > printf("Test read-write without Hardware transactional memory\n"); > use_htm =3D 0; > - if (test_hash_readwrite_functional(use_htm) < 0) > + use_ext =3D 0; > + if (test_hash_readwrite_functional(use_ext, use_htm) < 0) > return -1; > + > + use_ext =3D 1; > + if (test_hash_readwrite_functional(use_ext, use_htm) < 0) > + return -1; > + > reader_faster =3D 1; > if (test_hash_readwrite_perf(&non_htm_results, use_htm, > reader_faster) < 0) > -- > 2.7.4