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 3AC6AA0526; Thu, 23 Jul 2020 04:36:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C2911BFD7; Thu, 23 Jul 2020 04:36:35 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130077.outbound.protection.outlook.com [40.107.13.77]) by dpdk.org (Postfix) with ESMTP id 404E02C6E for ; Thu, 23 Jul 2020 04:36:34 +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=wcsBCUbRoDcLf0pOTngIPyFwaRYPLnJvWk+7dmOaBWg=; b=DirqVP8Ht4Zrvxgx3FaPufMsgYDZkHeriHE9qJImFcNBZfj1ZLuOKKZzvitp2/jg0/tuOijtes0xMkCRnFujX8ZDBcYIoc4n5714A6UBQdAS6Lnm/PD50kDNTAiYq6JKP2rTp0uz2m+WgT7tesVMgxO5mduimuQMXmYm7ZdBfGk= Received: from MR2P264CA0145.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:1::8) by HE1PR0801MB2043.eurprd08.prod.outlook.com (2603:10a6:3:4d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.22; Thu, 23 Jul 2020 02:36:31 +0000 Received: from VE1EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:501:1:cafe::1d) by MR2P264CA0145.outlook.office365.com (2603:10a6:501:1::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Thu, 23 Jul 2020 02:36:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT013.mail.protection.outlook.com (10.152.19.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.10 via Frontend Transport; Thu, 23 Jul 2020 02:36:30 +0000 Received: ("Tessian outbound c4059ed8d7bf:v62"); Thu, 23 Jul 2020 02:36:30 +0000 X-CR-MTA-TID: 64aa7808 Received: from a8644d5fafc2.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C5FD9306-E622-4108-B421-C20A9687839A.1; Thu, 23 Jul 2020 02:36:25 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a8644d5fafc2.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Jul 2020 02:36:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YESGmr0D3+uOyQ2FkJnNWHVDHBdMY4mxp8Wg03KaZLj3hkQwnkCev1fUC9VCr2P8OyfdshCPq1BwVi8i+3mOdNdrD3kagQrHDUenFpOWn8/G9H1vSt76zmhs00dwCZ/AhwdJ4eP/A1e8QXIaUTW2v31CnnGsMP36DbF+jf4Ue0UA7Cc6YhmfTRbtMVSnX7YUs4rsJOSJInNhiHiCbiFXh/mcU8b5XTJBm1M4gzSvB7DXE3ZUwiG93htdMxGtZf99JeKHHVNmO5nErl6Q/U8Ypgt12Jm10iIC1GWScb8zES0gdQOkGj+Lm89aN6bzEt7+AVzJ1iZDziQBXyee2+pnlQ== 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=wcsBCUbRoDcLf0pOTngIPyFwaRYPLnJvWk+7dmOaBWg=; b=gZytQRpPW+OFMjH0Q4ZuSUuqXdqIItUKA8hy5HB6/wJJHX+ZyNt3PC+eUlrSij6DNMEmnFgCdsMhTCNNKYXbFkPp+XQVrf2NmRy9RKREyhvWMZTcAuk4MwlXmDuXNZrx7hr5YBF/mVvmDkw53GVs6JjDimJeLXC1K4a7VFnQaPGnzchLYwGWlwMdg8TVBzXF22mhxZ/gHAeOBZDszdL2e0x0jLb8hN75q35Ge1CvzENFUwRuJ8kvxvPGOSKOiLzWKRZJhAeMn47pIGwYHUurSHSM4qsFIfqfhXV3VG5ZIuFWzwV/3mcsYByQzik32MacBncBxtNsUjadwKVdnVM0Qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none 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=wcsBCUbRoDcLf0pOTngIPyFwaRYPLnJvWk+7dmOaBWg=; b=DirqVP8Ht4Zrvxgx3FaPufMsgYDZkHeriHE9qJImFcNBZfj1ZLuOKKZzvitp2/jg0/tuOijtes0xMkCRnFujX8ZDBcYIoc4n5714A6UBQdAS6Lnm/PD50kDNTAiYq6JKP2rTp0uz2m+WgT7tesVMgxO5mduimuQMXmYm7ZdBfGk= Received: from VE1PR08MB4640.eurprd08.prod.outlook.com (2603:10a6:802:b2::11) by VI1PR08MB3231.eurprd08.prod.outlook.com (2603:10a6:803:4a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 02:36:23 +0000 Received: from VE1PR08MB4640.eurprd08.prod.outlook.com ([fe80::28a3:3a4e:65ca:5707]) by VE1PR08MB4640.eurprd08.prod.outlook.com ([fe80::28a3:3a4e:65ca:5707%3]) with mapi id 15.20.3216.023; Thu, 23 Jul 2020 02:36:23 +0000 From: Phil Yang To: Phil Yang , "aconole@redhat.com" , "maicolgabriel@hotmail.com" , "dev@dpdk.org" CC: "david.marchand@redhat.com" , "drc@linux.vnet.ibm.com" , Honnappa Nagarahalli , Ruifeng Wang , nd , nd Thread-Topic: [dpdk-dev] [PATCH 1/2] test/mcslock: move performance test to perf tests Thread-Index: AQHWAMnYm7NykaF2kkyi0p8gncsAvakVIgfg Date: Thu, 23 Jul 2020 02:36:23 +0000 Message-ID: References: <1584936978-11899-1-git-send-email-phil.yang@arm.com> In-Reply-To: <1584936978-11899-1-git-send-email-phil.yang@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 5c800c62-0e86-45d9-b8b7-c140160b00ff.0 x-checkrecipientchecked: true Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [203.126.0.113] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b4debb58-bad0-4115-84da-08d82eb134fa x-ms-traffictypediagnostic: VI1PR08MB3231:|HE1PR0801MB2043: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:1775;OLM:1775; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: lqDz3z7WyTFNC9cPryQZJpiyaTQT4r3TprNMmzlzZVjKQ4BlOszKRWyXKogel2zvpwymm0jZe6A0E4726upg2QZqx2dFtafGMfEVRPp4Mzmrmv2wrKVugS6ay8OM757RDNjX+8BZD5WwHDZwvwUPgQRD/GHhSdLCFM9Msb/IqDwQfO8+VK1tCGQkq4S46iEjsmF45MqD7hiJxwiGnIQqmbnw/63NyIqNYzH7BQmDyoEMwUwT+HDHqqxQKfF1zucMHIjkVtfgrOeGB4NZOkyK4shJUJW+pkSolklL4tjAjX5JYUscoMXWtPKEcW6NWiUyfmZUWOjdFMItvt4bhYzYsw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4640.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(396003)(366004)(346002)(376002)(136003)(33656002)(54906003)(26005)(316002)(110136005)(71200400001)(8936002)(2906002)(86362001)(5660300002)(4326008)(66556008)(64756008)(52536014)(7696005)(478600001)(55016002)(9686003)(186003)(76116006)(66946007)(83380400001)(66476007)(6506007)(66446008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: tX599yo4Po8MwB9nV5XIZKQMZ1qT/y/tYc0W9FsYm2YXBdwoHi/Q+wUGTmXf7iCggFgsjfYQUsgvUrEMZGAFE+v5x9L6QaGJYmStWhh2s9GFmeyMDEIAATcJ+Y8hsyN46VGtyAPI9i3MdfwZpOjwvuP6xBQbAvUqbE9jGpSCU1+8vlAQ+fQBEnE+Ewkj9+0J6v2OWPCJmMzZM5dKnMZPIkR9mKjXrVSea6bVPJ/Ya2ip3cs6e3myJijtzkCg08lDdODXVfInVG0oGZIeFFtvPOponqxYNbJkAPEyOMbiWyD+pg4eBeTvrlvuhDkYVjU+Z6fgVTGaQCwMJ8Zpxf7kIyCR3A02OZafqei5//r0FsD7p4L+8uhuAgGduIboOcKhcGcdGB6RloCl1pR0XJGQcn3MRnuqRMYRKYjvSK+J7OC1pN8E//BQbhu5tvX4n4Q34Oq31zOkrFaoGtPR+BNpZnc+HWaSSjsP6dLyyB1736s= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3231 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 05ebb4ff-e02e-49dd-ca9b-08d82eb130b3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DJyWNbGJfhHaBu5rSJ/edE21t3j3UuGEIuiCmWamk4+CuA0VUQuVtvffh0rJR8EoJxubm8a/d0Lail5p7q8x8laRDtKtNl9BBY6oSjxuavtZ5WXkwrwzIRnA3PW6sC9pcxtRXInKgm4BvtN383SLHMOzSAKm/+wSgf1ZKHcgTfXcyorMEEbQT9b5tMEw5UlDDaJh4tGJ5NQ5Bb2Ma/Sv604oswMy54iEX7f9Sb+E0Vm7Babf7NDkci/WP9OovL+oJVhaHwzbkop04huaLO4DViCdq8sAN3e1LWen7wlLybP3WNR6A1mysDWXBPSHfM/Kb9zp2q7/z4MMkJFEOtrYEiuDV1FZcQep5o1EPTw+9LZiFnCOMSryiUk+hvKGTl9PUbM97GTvQ8tl2VkoctacGw== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(396003)(376002)(136003)(346002)(46966005)(9686003)(55016002)(81166007)(70586007)(70206006)(82740400003)(7696005)(356005)(47076004)(33656002)(336012)(82310400002)(86362001)(4326008)(110136005)(54906003)(6506007)(83380400001)(2906002)(30864003)(52536014)(186003)(26005)(5660300002)(8936002)(478600001)(36906005)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 02:36:30.4748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4debb58-bad0-4115-84da-08d82eb134fa X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2043 Subject: Re: [dpdk-dev] [PATCH 1/2] test/mcslock: move performance test to perf tests 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 Aaron, It seems Travis CI cannot capture this timeout issue. But the local test records these two cases as TIMEOUT under the default tim= eout configuration. 1. The test results on x86 server (72 lcores online@ 2.60GHz) are: a. Default setting: $ sudo meson test -C build_test --suite DPDK:fast-tests 3/92 DPDK:fast-tests / atomic_autotest TIMEOUT 10.= 32s 39/92 DPDK:fast-tests / mcslock_autotest TIMEOUT 10.32= s b. Extend timeout: $ sudo meson test -C build_test --suite DPDK:fast-tests -t 30 3/92 DPDK:fast-tests / atomic_autotest OK 173= .01s 39/92 DPDK:fast-tests / mcslock_autotest OK 12.19= s 2. The test results on aarch64 server (56 lcore online @ 2.0GHz) are: a. Default setting: $ sudo meson test -C build_test --suite DPDK:fast-tests 3/92 DPDK:fast-tests / atomic_autotest TIMEOUT 10.47 s 39/92 DPDK:fast-tests / mcslock_autotest TIMEOUT 10.47 s b. Extend timeout: $ sudo meson test -C build_test --suite DPDK:fast-tests -t 60 3/92 DPDK:fast-tests / atomic_autotest OK 431.89 s 39/92 DPDK:fast-tests / mcslock_autotest OK 21.25 s So I think these two patches can resolve this issue. I'd love to hear your = thoughts. Thanks, Phil > Subject: [dpdk-dev] [PATCH 1/2] test/mcslock: move performance test to > perf tests >=20 > The MCS lock performance test takes more than 10 seconds and leads > to meson test timeout on some platforms. Move the performance test > into perf tests. >=20 > Signed-off-by: Phil Yang > Reviewed-by: Gavin Hu > --- > MAINTAINERS | 1 + > app/test/Makefile | 1 + > app/test/autotest_data.py | 6 +++ > app/test/meson.build | 2 + > app/test/test_mcslock.c | 88 ------------------------------- > app/test/test_mcslock_perf.c | 121 > +++++++++++++++++++++++++++++++++++++++++++ > 6 files changed, 131 insertions(+), 88 deletions(-) > create mode 100644 app/test/test_mcslock_perf.c >=20 > diff --git a/MAINTAINERS b/MAINTAINERS > index db235c2..411bdeb 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -247,6 +247,7 @@ MCSlock - EXPERIMENTAL > M: Phil Yang > F: lib/librte_eal/common/include/generic/rte_mcslock.h > F: app/test/test_mcslock.c > +F: app/test/test_mcslock_perf.c >=20 > Ticketlock > M: Joyce Kong > diff --git a/app/test/Makefile b/app/test/Makefile > index 1f080d1..97de3ac 100644 > --- a/app/test/Makefile > +++ b/app/test/Makefile > @@ -65,6 +65,7 @@ SRCS-y +=3D test_barrier.c > SRCS-y +=3D test_malloc.c > SRCS-y +=3D test_cycles.c > SRCS-y +=3D test_mcslock.c > +SRCS-y +=3D test_mcslock_perf.c > SRCS-y +=3D test_spinlock.c > SRCS-y +=3D test_ticketlock.c > SRCS-y +=3D test_memory.c > diff --git a/app/test/autotest_data.py b/app/test/autotest_data.py > index 7b1d013..2a4619d 100644 > --- a/app/test/autotest_data.py > +++ b/app/test/autotest_data.py > @@ -784,6 +784,12 @@ > "Func": default_autotest, > "Report": None, > }, > + { > + "Name": "MCS Lock performance autotest", > + "Command": "mcslock_perf_autotest", > + "Func": default_autotest, > + "Report": None, > + }, > # > # Please always make sure that ring_perf is the last test! > # > diff --git a/app/test/meson.build b/app/test/meson.build > index 0a2ce71..335a869 100644 > --- a/app/test/meson.build > +++ b/app/test/meson.build > @@ -82,6 +82,7 @@ test_sources =3D files('commands.c', > 'test_meter.c', > 'test_metrics.c', > 'test_mcslock.c', > + 'test_mcslock_perf.c', > 'test_mp_secondary.c', > 'test_per_lcore.c', > 'test_pmd_perf.c', > @@ -270,6 +271,7 @@ perf_test_names =3D [ > 'rand_perf_autotest', > 'hash_readwrite_perf_autotest', > 'hash_readwrite_lf_perf_autotest', > + 'mcslock_perf_autotest', > ] >=20 > driver_test_names =3D [ > diff --git a/app/test/test_mcslock.c b/app/test/test_mcslock.c > index e9359df..15f9751 100644 > --- a/app/test/test_mcslock.c > +++ b/app/test/test_mcslock.c > @@ -32,23 +32,16 @@ > * > * - The function takes the global lock, display something, then relea= ses > * the global lock on each core. > - * > - * - A load test is carried out, with all cores attempting to lock a sin= gle > - * lock multiple times. > */ >=20 > RTE_DEFINE_PER_LCORE(rte_mcslock_t, _ml_me); > RTE_DEFINE_PER_LCORE(rte_mcslock_t, _ml_try_me); > -RTE_DEFINE_PER_LCORE(rte_mcslock_t, _ml_perf_me); >=20 > rte_mcslock_t *p_ml; > rte_mcslock_t *p_ml_try; > -rte_mcslock_t *p_ml_perf; >=20 > static unsigned int count; >=20 > -static rte_atomic32_t synchro; > - > static int > test_mcslock_per_core(__attribute__((unused)) void *arg) > { > @@ -63,85 +56,8 @@ test_mcslock_per_core(__attribute__((unused)) void > *arg) > return 0; > } >=20 > -static uint64_t time_count[RTE_MAX_LCORE] =3D {0}; > - > #define MAX_LOOP 1000000 >=20 > -static int > -load_loop_fn(void *func_param) > -{ > - uint64_t time_diff =3D 0, begin; > - uint64_t hz =3D rte_get_timer_hz(); > - volatile uint64_t lcount =3D 0; > - const int use_lock =3D *(int *)func_param; > - const unsigned int lcore =3D rte_lcore_id(); > - > - /**< Per core me node. */ > - rte_mcslock_t ml_perf_me =3D RTE_PER_LCORE(_ml_perf_me); > - > - /* wait synchro */ > - while (rte_atomic32_read(&synchro) =3D=3D 0) > - ; > - > - begin =3D rte_get_timer_cycles(); > - while (lcount < MAX_LOOP) { > - if (use_lock) > - rte_mcslock_lock(&p_ml_perf, &ml_perf_me); > - > - lcount++; > - if (use_lock) > - rte_mcslock_unlock(&p_ml_perf, &ml_perf_me); > - } > - time_diff =3D rte_get_timer_cycles() - begin; > - time_count[lcore] =3D time_diff * 1000000 / hz; > - return 0; > -} > - > -static int > -test_mcslock_perf(void) > -{ > - unsigned int i; > - uint64_t total =3D 0; > - int lock =3D 0; > - const unsigned int lcore =3D rte_lcore_id(); > - > - printf("\nTest with no lock on single core...\n"); > - rte_atomic32_set(&synchro, 1); > - load_loop_fn(&lock); > - printf("Core [%u] Cost Time =3D %"PRIu64" us\n", > - lcore, time_count[lcore]); > - memset(time_count, 0, sizeof(time_count)); > - > - printf("\nTest with lock on single core...\n"); > - lock =3D 1; > - rte_atomic32_set(&synchro, 1); > - load_loop_fn(&lock); > - printf("Core [%u] Cost Time =3D %"PRIu64" us\n", > - lcore, time_count[lcore]); > - memset(time_count, 0, sizeof(time_count)); > - > - printf("\nTest with lock on %u cores...\n", (rte_lcore_count())); > - > - rte_atomic32_set(&synchro, 0); > - rte_eal_mp_remote_launch(load_loop_fn, &lock, SKIP_MASTER); > - > - /* start synchro and launch test on master */ > - rte_atomic32_set(&synchro, 1); > - load_loop_fn(&lock); > - > - rte_eal_mp_wait_lcore(); > - > - RTE_LCORE_FOREACH(i) { > - printf("Core [%u] Cost Time =3D %"PRIu64" us\n", > - i, time_count[i]); > - total +=3D time_count[i]; > - } > - > - printf("Total Cost Time =3D %"PRIu64" us\n", total); > - > - return 0; > -} > - > /* > * Use rte_mcslock_trylock() to trylock a mcs lock object, > * If it could not lock the object successfully, it would > @@ -240,10 +156,6 @@ test_mcslock(void) > ret =3D -1; > rte_mcslock_unlock(&p_ml, &ml_me); >=20 > - /* mcs lock perf test */ > - if (test_mcslock_perf() < 0) > - return -1; > - > return ret; > } >=20 > diff --git a/app/test/test_mcslock_perf.c b/app/test/test_mcslock_perf.c > new file mode 100644 > index 0000000..6948344 > --- /dev/null > +++ b/app/test/test_mcslock_perf.c > @@ -0,0 +1,121 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2019 Arm Limited > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "test.h" > + > +/* > + * RTE MCS lock perf test > + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + * > + * These tests are derived from spin lock perf test cases. > + * > + * - A load test is carried out, with all cores attempting to lock a sin= gle > + * lock multiple times. > + */ > + > +RTE_DEFINE_PER_LCORE(rte_mcslock_t, _ml_perf_me); > +rte_mcslock_t *p_ml_perf; > + > +static rte_atomic32_t synchro; > +static uint64_t time_count[RTE_MAX_LCORE] =3D {0}; > + > +#define MAX_LOOP 1000000 > + > +static int > +load_loop_fn(void *func_param) > +{ > + uint64_t time_diff =3D 0, begin; > + uint64_t hz =3D rte_get_timer_hz(); > + volatile uint64_t lcount =3D 0; > + const int use_lock =3D *(int *)func_param; > + const unsigned int lcore =3D rte_lcore_id(); > + > + /**< Per core me node. */ > + rte_mcslock_t ml_perf_me =3D RTE_PER_LCORE(_ml_perf_me); > + > + /* wait synchro */ > + while (rte_atomic32_read(&synchro) =3D=3D 0) > + ; > + > + begin =3D rte_get_timer_cycles(); > + while (lcount < MAX_LOOP) { > + if (use_lock) > + rte_mcslock_lock(&p_ml_perf, &ml_perf_me); > + > + lcount++; > + if (use_lock) > + rte_mcslock_unlock(&p_ml_perf, &ml_perf_me); > + } > + time_diff =3D rte_get_timer_cycles() - begin; > + time_count[lcore] =3D time_diff * 1000000 / hz; > + return 0; > +} > + > +/* > + * Test rte_eal_get_lcore_state() in addition to mcs locks > + * as we have "waiting" then "running" lcores. > + */ > +static int > +test_mcslock_perf(void) > +{ > + unsigned int i; > + uint64_t total =3D 0; > + int lock =3D 0; > + const unsigned int lcore =3D rte_lcore_id(); > + > + printf("\nTest with no lock on single core...\n"); > + rte_atomic32_set(&synchro, 1); > + load_loop_fn(&lock); > + printf("Core [%u] Cost Time =3D %"PRIu64" us\n", > + lcore, time_count[lcore]); > + memset(time_count, 0, sizeof(time_count)); > + > + printf("\nTest with lock on single core...\n"); > + lock =3D 1; > + rte_atomic32_set(&synchro, 1); > + load_loop_fn(&lock); > + printf("Core [%u] Cost Time =3D %"PRIu64" us\n", > + lcore, time_count[lcore]); > + memset(time_count, 0, sizeof(time_count)); > + > + printf("\nTest with lock on %u cores...\n", (rte_lcore_count())); > + > + rte_atomic32_set(&synchro, 0); > + rte_eal_mp_remote_launch(load_loop_fn, &lock, SKIP_MASTER); > + > + /* start synchro and launch test on master */ > + rte_atomic32_set(&synchro, 1); > + load_loop_fn(&lock); > + > + rte_eal_mp_wait_lcore(); > + > + RTE_LCORE_FOREACH(i) { > + printf("Core [%u] Cost Time =3D %"PRIu64" us\n", > + i, time_count[i]); > + total +=3D time_count[i]; > + } > + > + printf("Total Cost Time =3D %"PRIu64" us\n", total); > + > + return 0; > +} > + > +REGISTER_TEST_COMMAND(mcslock_perf_autotest, test_mcslock_perf); > -- > 2.7.4