From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140040.outbound.protection.outlook.com [40.107.14.40]) by dpdk.org (Postfix) with ESMTP id 266AE1B4CF; Thu, 20 Dec 2018 02:45:34 +0100 (CET) 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=d/5IMj8rsOVqXMrc7VmezcOTQKM2GDD8rikA9t+xFAw=; b=EdmJ4+FJH/nZKhdgjkxfTDvHaRvLgXD/ylOtaW1z1zcXBuvPxGj3zr4z7ZBk9kS9/QJXWL4QWoxVpiNW5PXWLVxa+610KjdjgQSjFO0MuzxGoJwS+BiEgBbncwK0dwgXHVNgpFEN9JF/XExR6CSb2QQIy5Kes2NEmJxXinyCSvA= Received: from AM6PR08MB3672.eurprd08.prod.outlook.com (20.177.115.29) by AM6PR08MB3703.eurprd08.prod.outlook.com (20.177.199.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1446.17; Thu, 20 Dec 2018 01:45:32 +0000 Received: from AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::78ab:2bf4:5476:6c3e]) by AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::78ab:2bf4:5476:6c3e%2]) with mapi id 15.20.1446.018; Thu, 20 Dec 2018 01:45:32 +0000 From: Honnappa Nagarahalli To: "Gavin Hu (Arm Technology China)" , "Ananyev, Konstantin" , "Joyce Kong (Arm Technology China)" , "dev@dpdk.org" CC: nd , "thomas@monjalon.net" , "hemant.agrawal@nxp.com" , "stable@dpdk.org" , "chaozhu@linux.vnet.ibm.com" , "jerinj@marvell.com" , nd Thread-Topic: [dpdk-dev] [PATCH v1 1/2] test/rwlock: add perf test case Thread-Index: AQHUkpU+Fs7VnpUhKUCljxbAcgsSxKWGwbsAgAAXKICAAAwPAA== Date: Thu, 20 Dec 2018 01:45:32 +0000 Message-ID: References: <1544672265-219262-1-git-send-email-joyce.kong@arm.com> <1544672265-219262-2-git-send-email-joyce.kong@arm.com> <2601191342CEEE43887BDE71AB977258010D8BCD43@IRSMSX106.ger.corp.intel.com> In-Reply-To: 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; AM6PR08MB3703; 6:pDCwgDLGGLKUOC7Sr0eDnTudwEaDKn4Dza9brTMcJYA6CRfucKzWb1/M07PbDvifRMxSV4sap2MJQp97hDc9SJFrfBmgP2wSBMVFeEYfTSgzYRNk3qfBv5FQqzCTFBhzamPhZxYchzy6KHSabc5nW6lMs7/XGjVI382I5gn4ST5aQRXYy3wp3k0CrwDiZ8uEU2Laoul5iDNNR/oX0itqhEUFGbZ68qYYmZKPP3EWcPSRhz71knVX/L50R2bhif5M+jul16WTe3vzD3nr26DTrmhdlBY0kvV5dN9OpRQRSBmsVE+N9ZC3F4KkHhnbnxDHar2CPddf5Ns31kqBOjzsN+SFLqogX/msUe6KWjGQ6ZFg8BfqDuzLoQJH9MaYcWw/Z7TodEvU67ZFODDGbOJVGWz9T3tCgijA2uLwV/Ky8VSGdnyR8+IsQt09wU5tGI5kK2vV5HBw/pyP/U9ZskeHKw==; 5:pQUph8MjgRUcVGHBe6cktN2rnIO8HykTjAPHFmGJXDlqXykQEiT6pNavRgKzZuyniZqmfOuj4ojT28IfaPyJKb86stHdpY6leepx35wjsb95JBNTDorY4RhOVxwsh0/WKSEmh2SgltQJ0mm+jcVyqrcsTixbxbgBexSklnoNyPc=; 7:mRs3uXO4O5kt0VfjfMezAe2oFfmHCwxkNH9gsThVXUKXusMeOoNmPg6MWNb+bGl1wmLPhr7PXt7lZdcbXmbT51yUa91WbU76Vh2GH9nOlHqZctP0KIQXT11F/H/gim5JX3SMjHywD4v99wRTgGzjeg== x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-correlation-id: 6cc137f6-de1a-402b-59d5-08d6661cd471 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM6PR08MB3703; x-ms-traffictypediagnostic: AM6PR08MB3703: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(999002)(5005026)(6040522)(2401047)(8121501046)(3002001)(10201501046)(3231475)(944501520)(52105112)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:AM6PR08MB3703; BCL:0; PCL:0; RULEID:; SRVR:AM6PR08MB3703; x-forefront-prvs: 0892FA9A88 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(396003)(39860400002)(376002)(136003)(366004)(199004)(189003)(72206003)(7736002)(14454004)(478600001)(71190400001)(71200400001)(256004)(66066001)(106356001)(105586002)(55016002)(99286004)(2906002)(81166006)(486006)(8676002)(8936002)(86362001)(11346002)(81156014)(14444005)(9686003)(2501003)(5660300001)(68736007)(74316002)(6116002)(3846002)(316002)(54906003)(33656002)(93886005)(110136005)(476003)(186003)(6246003)(26005)(446003)(305945005)(97736004)(102836004)(7696005)(53936002)(229853002)(76176011)(6506007)(25786009)(6436002)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB3703; 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: C8wbP4cw071/pbDWSMg9UKh4sYanSAJQocQMsxeNmic7/GAI4O/CIqU5sx8FmN+1UWwQI15Cp5x4yWFw3iRrWKjOidluevHZxJQfLVsYyUyKjqRmghwu4V+dR4Ktd+OX/53ZwvnLvzGhQUhD+9BrCOcApmZdEsKBKi1zaG9PKCwszoY4l5wDN0Y6h5TfWRSs4T2nFdE8yvAZSusXslU+DFSXerrHen6du3JNr/xfZR0UtFfMp0HoMacRJbg1+3taDXTfCqhyrPh/oekhTyS4A2xHWfPewKY7yBRRt55VG48WNuDoltZ+blZI/JyXxqno 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: 6cc137f6-de1a-402b-59d5-08d6661cd471 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2018 01:45:32.7868 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3703 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v1 1/2] test/rwlock: add perf test case 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: , X-List-Received-Date: Thu, 20 Dec 2018 01:45:34 -0000 > > > > Hi, > > > > > > > > Add performance test on all available cores to benchmark the scaling > > > up performance and fairness of rw_lock. > > > > > > Fixes: af75078faf ("first public release") > > > Cc: stable@dpdk.org > > > > > > Suggested-by: Gavin Hu > > > Signed-off-by: Joyce Kong > > > Reviewed-by: Honnappa Nagarahalli > > > Reviewed-by: Ola Liljedahl > > > Reviewed-by: Gavin Hu > > > Reviewed-by: Ruifeng Wang > > > --- > > > test/test/test_rwlock.c | 71 > > > +++++++++++++++++++++++++++++++++++++++++++++++++ > > > 1 file changed, 71 insertions(+) > > > > > > diff --git a/test/test/test_rwlock.c b/test/test/test_rwlock.c index > > > 29171c4..4766c09 100644 > > > --- a/test/test/test_rwlock.c > > > +++ b/test/test/test_rwlock.c > > > @@ -4,6 +4,7 @@ > > > > > > #include > > > #include > > > +#include > > > #include > > > #include > > > > > > @@ -44,6 +45,7 @@ > > > > > > static rte_rwlock_t sl; > > > static rte_rwlock_t sl_tab[RTE_MAX_LCORE]; > > > +static rte_atomic32_t synchro; > > > > > > static int > > > test_rwlock_per_core(__attribute__((unused)) void *arg) @@ -65,6 > > > +67,72 @@ test_rwlock_per_core(__attribute__((unused)) void *arg) > > > return 0; > > > } > > > > > > +static rte_rwlock_t lk =3D RTE_RWLOCK_INITIALIZER; static uint64_t > > > +lock_count[RTE_MAX_LCORE] =3D {0}; > > > + > > > +#define TIME_MS 100 > > > + > > > +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); > > > + rte_pause(); > > > > Wouldn't it be more realistic to write/read some shared data here? > > Again extra checking could be done in that case that lock behaves as > > expected. > Will do it in v2, thanks! > > > > > + rte_rwlock_write_unlock(&lk); > > > + rte_rwlock_read_lock(&lk); > > > + rte_rwlock_read_lock(&lk); > > > > Wonder what is the point of double rdlock here? > > Konstantin > Double rd lock is to check rd locks will not block each other. > Anyway I will remove it in v2 if no concerns here. > > > > > + rte_pause(); > > > + rte_rwlock_read_unlock(&lk); > > > + rte_rwlock_read_unlock(&lk); > > > + lcount++; > > > + /* delay to make lock duty cycle slightly realistic */ > > > + rte_pause(); > > > + time_diff =3D rte_rdtsc_precise() - begin; > > > + } Should we change the way the measurement is done? We are measuring 'how man= y locks/unlocks per '. This introduces more over head due to = rte_rdtsc_precise call for every iteration. If we do, 'how many cycles it t= akes to do ', the over head of rte_rdtsc_p= recise can be amortized and will be very little. > > > + lock_count[lcore] =3D lcount; > > > + return 0; > > > +} > > > +