From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BACEEA10DA for ; Fri, 2 Aug 2019 02:04:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7298D1C1BA; Fri, 2 Aug 2019 02:04:27 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130071.outbound.protection.outlook.com [40.107.13.71]) by dpdk.org (Postfix) with ESMTP id 6E0C91C1BA for ; Fri, 2 Aug 2019 02:04:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e5zTrWxg/x6N3tP5kMMus+vDzuzqZ5jd1oqxf71d+J4cP97nXyjACiHn/pPjcsrKZp+9eb072mX0co7fBMZw9rOb6lwGw+s7yF+GQSJNw72QlJpKWKwB9w5c4B+Yjg3I/9bU6I8XxIzRoZdV+UI4ExFxnH4WiV6X/UA6jrI4QLVzIQadJxQI27INlO57RzZh/9BCmFAt/FS8edjIhoDYJvBrUe0sXraRoEDND04xhotjC6tPJcJHbVSwyn52D7R6F0MmNoT7xi8GryMUNHnBiQVyZy3fdWWTcvRmT6czBYGD+5UhwBYPKLx4p7UwhC1zRsNhx6OrsYMNxY8gFS3Mlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uCYk7fCKiNbZ4LYRvVu3Qw+V0Z87acIU7lou8FupQdI=; b=WclENathSnIGXxEGyGGtFersILeSDyvAXGrx+drBPcDTvtsWuZfXU85E1c5ba1SWfZjYnMRLpgeq6EV42e7atEAKkJtnOVcEA/T89Pxp7K+RO82FjikPbZYi8J4i5EELJozXN3k7SgHH7+uaJ0irtlNHnBHZk4xNdd7BrMlGKa6D95NdjC0GG42ICs3FDkfCH5mQjOU4OcNYby3xhC+2vcTTarQqj2Sq18TkaWPxp9tVzAqU9+c6mLowgNWZ8yqQY7pPVc9EURGteexANL5NiIwJQq1x4gexSqKx30u3HRxycLXAJwih4gH1/E+z9aH1SxeBfSFlNsqIK0tgrNuIEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=mellanox.com;dmarc=pass action=none header.from=mellanox.com;dkim=pass header.d=mellanox.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uCYk7fCKiNbZ4LYRvVu3Qw+V0Z87acIU7lou8FupQdI=; b=cvAo6ZqnJGGrhng8fONNlkzgAtEPYNd0hLFOQntuWpwsVGGCxYExWhvtyi/ArqA6q+gqnDf/T1fiIt62b9JY4k7QWwoNDlh7vO0OVDfnYK4w/9enx0TmtkK9TtIW1w3G908V74pPJRqNFUvYq4cABtERY5O4oewobhV3rqwsfRQ= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4089.eurprd05.prod.outlook.com (52.134.68.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.15; Fri, 2 Aug 2019 00:04:25 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::589a:a9d4:5426:d194]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::589a:a9d4:5426:d194%6]) with mapi id 15.20.2136.010; Fri, 2 Aug 2019 00:04:25 +0000 From: Yongseok Koh To: Joyce Kong CC: "stable@dpdk.org" , "nd@arm.com" Thread-Topic: [dpdk-stable] [PATCH 17.11] test/rwlock: benchmark on all available cores Thread-Index: AQHVQrVHZvrsMs3800OhAgaT48oy6abnBkQA Date: Fri, 2 Aug 2019 00:04:25 +0000 Message-ID: References: <1564037421-47103-1-git-send-email-joyce.kong@arm.com> In-Reply-To: <1564037421-47103-1-git-send-email-joyce.kong@arm.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=yskoh@mellanox.com; x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cb94fb1c-065f-449d-3bde-08d716dcfac4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB3PR0502MB4089; x-ms-traffictypediagnostic: DB3PR0502MB4089: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:361; x-forefront-prvs: 011787B9DD x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(346002)(376002)(366004)(39860400002)(136003)(189003)(199004)(14444005)(5660300002)(7736002)(6486002)(81156014)(81166006)(6916009)(486006)(33656002)(6436002)(3846002)(53936002)(6116002)(256004)(8936002)(99286004)(476003)(2616005)(2906002)(25786009)(229853002)(6512007)(66946007)(54906003)(305945005)(102836004)(53546011)(91956017)(76116006)(26005)(4326008)(66556008)(6506007)(66446008)(478600001)(64756008)(76176011)(66476007)(186003)(86362001)(71200400001)(71190400001)(14454004)(66066001)(11346002)(316002)(36756003)(6246003)(446003)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4089; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: b5ObbAnhbXiHR7NJ2XFQLomLzdSLwtHqKaMwEr+QHfTNZ4dXpIlgdvRD+zelzK6EGPx4Dl45Zboo3a2zHEyOWDJFU03AUIwKiH9GEkWAINhdJGrxhbtoOUzNu8aR8AbQK9PFStYfGjBZ3gzuur1YclJLVSuwNxbPVWkHxtMaWHvy3vzmJnZVLDJPyqClXF/PnjCY5SjSH5dKk6BdIG53ifOtCasyCU/IClIubfI+oJp3KNh/mC1TdoihFJUaKq1LzHq2rbMLIXeFKUeI884wOfXeF0sygIZVIUluElzc3qKL8lCF5N2cs0FLE1VuQCJuaeuPHwNZ2ViPorWfPjRRmDN44i3o3F3Dxft7lGuly0ywXSko92pW2ivuXBAWu4COTAVoevMGjTivib33KHaekIyi78IGYLc41uieWacoxPY= Content-Type: text/plain; charset="us-ascii" Content-ID: <031A372E3182BE4B8C8F661CD54B9AB4@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb94fb1c-065f-449d-3bde-08d716dcfac4 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Aug 2019 00:04:25.0625 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: yskoh@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4089 Subject: Re: [dpdk-stable] [PATCH 17.11] test/rwlock: benchmark on all available cores 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" > On Jul 24, 2019, at 11:50 PM, Joyce Kong wrote: >=20 > [ backported from upstream commit fe252fb695efa9deb95f2e6b7baf6f805996a5b= 0 ] >=20 > Add performance test on all available cores to benchmark > the scaling up performance of rw_lock. >=20 > Fixes: af75078fece3 ("first public release") >=20 > Suggested-by: Gavin Hu > Signed-off-by: Joyce Kong > Acked-by: Konstantin Ananyev > --- applied to stable/17.11 Thanks, > test/test/test_rwlock.c | 75 ++++++++++++++++++++++++++++++++++++++++++++= +++++ > 1 file changed, 75 insertions(+) >=20 > diff --git a/test/test/test_rwlock.c b/test/test/test_rwlock.c > index 08685d3..1f327fe 100644 > --- a/test/test/test_rwlock.c > +++ b/test/test/test_rwlock.c > @@ -73,6 +73,7 @@ >=20 > static rte_rwlock_t sl; > static rte_rwlock_t sl_tab[RTE_MAX_LCORE]; > +static rte_atomic32_t synchro; >=20 > static int > test_rwlock_per_core(__attribute__((unused)) void *arg) > @@ -94,6 +95,77 @@ test_rwlock_per_core(__attribute__((unused)) void *arg= ) > return 0; > } >=20 > +static rte_rwlock_t lk =3D RTE_RWLOCK_INITIALIZER; > +static volatile uint64_t rwlock_data; > +static uint64_t lock_count[RTE_MAX_LCORE] =3D {0}; > + > +#define TIME_MS 100 > +#define TEST_RWLOCK_DEBUG 0 > + > +static int > +load_loop_fn(__attribute__((unused)) void *arg) > +{ > + uint64_t time_diff =3D 0, begin; > + uint64_t hz =3D rte_get_timer_hz(); > + uint64_t lcount =3D 0; > + const unsigned int lcore =3D rte_lcore_id(); > + > + /* wait synchro for slaves */ > + if (lcore !=3D rte_get_master_lcore()) > + while (rte_atomic32_read(&synchro) =3D=3D 0) > + ; > + > + begin =3D rte_rdtsc_precise(); > + while (time_diff < hz * TIME_MS / 1000) { > + rte_rwlock_write_lock(&lk); > + ++rwlock_data; > + rte_rwlock_write_unlock(&lk); > + > + rte_rwlock_read_lock(&lk); > + if (TEST_RWLOCK_DEBUG && !(lcount % 100)) > + printf("Core [%u] rwlock_data =3D %"PRIu64"\n", > + lcore, rwlock_data); > + rte_rwlock_read_unlock(&lk); > + > + lcount++; > + /* delay to make lock duty cycle slightly realistic */ > + rte_pause(); > + time_diff =3D rte_rdtsc_precise() - begin; > + } > + > + lock_count[lcore] =3D lcount; > + return 0; > +} > + > +static int > +test_rwlock_perf(void) > +{ > + unsigned int i; > + uint64_t total =3D 0; > + > + printf("\nRwlock Perf Test on %u cores...\n", rte_lcore_count()); > + > + /* clear synchro and start slaves */ > + rte_atomic32_set(&synchro, 0); > + if (rte_eal_mp_remote_launch(load_loop_fn, NULL, SKIP_MASTER) < 0) > + return -1; > + > + /* start synchro and launch test on master */ > + rte_atomic32_set(&synchro, 1); > + load_loop_fn(NULL); > + > + rte_eal_mp_wait_lcore(); > + > + RTE_LCORE_FOREACH(i) { > + printf("Core [%u] count =3D %"PRIu64"\n", i, lock_count[i]); > + total +=3D lock_count[i]; > + } > + > + printf("Total count =3D %"PRIu64"\n", total); > + > + return 0; > +} > + > static int > test_rwlock(void) > { > @@ -124,6 +196,9 @@ test_rwlock(void) >=20 > rte_eal_mp_wait_lcore(); >=20 > + if (test_rwlock_perf() < 0) > + return -1; > + > return 0; > } >=20 > --=20 > 2.7.4 >=20