From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 43273A0C4E; Tue, 16 Nov 2021 21:15:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D8CFC40141; Tue, 16 Nov 2021 21:15:15 +0100 (CET) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40066.outbound.protection.outlook.com [40.107.4.66]) by mails.dpdk.org (Postfix) with ESMTP id 35AD940040 for ; Tue, 16 Nov 2021 21:15:14 +0100 (CET) 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=MPiUKD1jwx1Hx2VRquTx0NLXqUM+SWrV9hO+5gVxC1M=; b=5ku3S89AKylRT9jAcWdYe3/KRuBlNzaOT5clQKWz+bgkW72+lApIHvM+Sf3w4PPFFNjtSZ8tgPknAv36MN834C3Bxrn988sogCXCX7e2ft5VFP7SEgffwdXzoC3r9/NAtKJ/d8PUdRyM7f+FpPwRziwsp7MlkRDStaDgYHF2c6g= Received: from DB9PR05CA0008.eurprd05.prod.outlook.com (2603:10a6:10:1da::13) by PAXPR08MB7156.eurprd08.prod.outlook.com (2603:10a6:102:209::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15; Tue, 16 Nov 2021 20:15:12 +0000 Received: from DB5EUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1da:cafe::d5) by DB9PR05CA0008.outlook.office365.com (2603:10a6:10:1da::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19 via Frontend Transport; Tue, 16 Nov 2021 20:15:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass 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 DB5EUR03FT062.mail.protection.outlook.com (10.152.20.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19 via Frontend Transport; Tue, 16 Nov 2021 20:15:12 +0000 Received: ("Tessian outbound a33f292be81b:v110"); Tue, 16 Nov 2021 20:15:12 +0000 X-CR-MTA-TID: 64aa7808 Received: from 6ce91c4f3429.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id DBE69588-B34A-474B-8C27-A9B1222A7D03.1; Tue, 16 Nov 2021 20:15:05 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6ce91c4f3429.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 16 Nov 2021 20:15:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JOWBqTrBaCNsvCt65v8pcMT4do0S6SAcYlmyJbD8U7/+pU6ofxZyLoJQxRWmzKZ7SA3nn+qf7OvFI3uYNyfIDHA7FuNzVt2HqUZ5yZAjs8/REHSGiqRtinyYksca/SEmupLHjqHngpSgezHUxwaYp4w+Oi4YRkcm/3EedWAmB2BCMUIBllRdkVxFNAn44SS8ggADzO0AcR4vyV+A2qhTNMzVradOq0N9b8CWK4x4ahOP+HfesW5OvrjTZeTcWNZ9N8s5bvfJW34LzDH67nNta9ex8aZy8yartwnPJmAnv2rPru/ZpZoOlQ1g4o+k9gXhaUA6E35ImMvESktxCW6IAg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MPiUKD1jwx1Hx2VRquTx0NLXqUM+SWrV9hO+5gVxC1M=; b=ZSLlHNQMhSFGn7LM8dmif+FqUPUFqrYurIyCxP66/LkCfJ9MNpGeXGqWdHghmxPZyLJmyBEdGbYgkaHziqFXPkOtnUKIYRiqeNRjz5wn3ICIs38hrqxxQaasw3697o6MLyv/2AYfVWUNV6ai3q+++7laEWn+Ek/L4ooJbJkHWxuXxhUPiyMjNbDI2syzZnDrLLQVAncQ7CD0K81hSkD2XTh8n9UTrn0Y95n8IVYxxgNDEfbDWk+4SMKLgbXs7Q4XCbKKK+n9zGB81mHA/SzdqvUayYXdCi+WEIxWwO02Cm3qxeqy8xA8K40+FZtz1UHrvmiQfNigF1EYFOccea0M/w== 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=MPiUKD1jwx1Hx2VRquTx0NLXqUM+SWrV9hO+5gVxC1M=; b=5ku3S89AKylRT9jAcWdYe3/KRuBlNzaOT5clQKWz+bgkW72+lApIHvM+Sf3w4PPFFNjtSZ8tgPknAv36MN834C3Bxrn988sogCXCX7e2ft5VFP7SEgffwdXzoC3r9/NAtKJ/d8PUdRyM7f+FpPwRziwsp7MlkRDStaDgYHF2c6g= Received: from AM8PR08MB5810.eurprd08.prod.outlook.com (2603:10a6:20b:1d2::20) by AM0PR08MB4578.eurprd08.prod.outlook.com (2603:10a6:208:100::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Tue, 16 Nov 2021 20:15:03 +0000 Received: from AM8PR08MB5810.eurprd08.prod.outlook.com ([fe80::21ce:5175:83fd:3368]) by AM8PR08MB5810.eurprd08.prod.outlook.com ([fe80::21ce:5175:83fd:3368%4]) with mapi id 15.20.4713.019; Tue, 16 Nov 2021 20:15:03 +0000 From: Honnappa Nagarahalli To: Joyce Kong CC: "dev@dpdk.org" , nd , Joyce Kong , Ruifeng Wang , nd Subject: RE: [PATCH v2 09/12] app/compress: use compiler atomic builtins for display sync Thread-Topic: [PATCH v2 09/12] app/compress: use compiler atomic builtins for display sync Thread-Index: AQHX2s5mtvNetrhddk6bHWbsLzqy0awGlTBQ Date: Tue, 16 Nov 2021 20:15:02 +0000 Message-ID: References: <20211116094205.750359-1-joyce.kong@arm.com> <20211116094205.750359-10-joyce.kong@arm.com> In-Reply-To: <20211116094205.750359-10-joyce.kong@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 1E4FF4009958F444B3557B44ED76C587.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 8c4d57d6-436b-45cc-bbef-08d9a93dcb92 x-ms-traffictypediagnostic: AM0PR08MB4578:|PAXPR08MB7156: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:206;OLM:206; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 1vdoJsY2zjxodMRhGTPX5P0oSfbPDDxbKYIa/ngGpNV5UJ4GwOXIrWGRI9ZO0g03cL4mKlMP4/XhZnKA3jJarIjANupzaK0wlje3TAhZEY+F796nFGmqrQl70vLwlZDnTAy0kXYCSfNkm7uw6i2EynBJJkdQFEkU/xJoivm6Ex5mpn3z0MwNtvI9KkDkIHqT8uKzj0eqo0Tyw3XrKXoAH9ZtqWGitID2KjicED1ckIdlh2qJOIlxhDbnN3x9Yv3tHD2VvjP2W+f/9N9yaHZF/jfpgeFeFkxCHQZyR+oS8fdxYIGXRsgKBIEqhB0uVBomKzqWu2MAwkApAfJxLZLuq5Xmycsl4biGCumu8BrDi+KAMgHHP8SM5Hyd2GmQTrZHmQhNSCFIX9KjjBj4x5uuCQGqJGogYRe6RsNVZhonQ2pjOl5OiH+ZC1h1HwjRzX1EjyKGX1P2A0DWkxdGkcxo6k7hpNJfDHbjACC/+hsPy6ADFl+XRjUdnOAPP4zMJohrH7wz/iNDSpgOR8apByMyOGa2Z5G2PJENkc5cXfTq4sjBR0P93E6abMgwgd4C+ee685QO0Cr3w6cllIf2fBp3hBdekviB8yWqoz2tWlpfqQPepdK7lYnZUt0BB69vJJXpU9vJtWZYn81/zrYYnqmC3pKFaEPMEnSnRKKTWDlbbenl0k8SWbLIZhrghH6TKLjihsIJeDRs0X/q5NbN8jZbaw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR08MB5810.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(508600001)(76116006)(6862004)(38100700002)(33656002)(66946007)(55016002)(122000001)(86362001)(64756008)(52536014)(66556008)(54906003)(66476007)(66446008)(38070700005)(83380400001)(4326008)(5660300002)(2906002)(316002)(9686003)(7696005)(26005)(8936002)(71200400001)(6506007)(186003)(8676002)(6636002); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4578 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ebc34af9-5c37-4085-b964-08d9a93dc628 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d3bzPbQANOELc6xk5Jx0ActRP57N51R5YfM+3Be39s2ZHLp2yHh2rSrSR7RRgsLjfW6MZTGPAG06TqDQjzCnSIoH4tVX7dra+Oymf716Za0q4ZoI5DiQNMu8Fuq+gaELoTdlVoRQmJyEG4kud0i4ywb++lw7B9hMglm0Tsuzd+QkXRu8N0terJviuNzJyfRf2M8vQsK+vZ4cwzBQ68Baj0KNOWoj5BtYsZ6+sk9j3H81CIw8B6UKCoNZd3LMkZCUXH5pLrrJ4GyeinBXdrZkdC0r5w53PElw3wC+YJZIfjiSLlXs0eX87HmuAcUY7csqMDOtHtvFm0aJvaOFy5lpnX/VZZt6o/9I8mkVGLAR5XG+Sc2lQJWupv0xdrEctoRIAjoPnpq7M+NJFuNA4Mwdh7w7HCbUdpbKIY6MFwn+/LZI0os4FvsC3M183mMI85MGEYDLAM1Au5E6SA1LSIPcPfrNEejbDwoOJ9smkzTGsN2LTMsUSzebD/VXdPMpghh6c144ftC4CRaAZqJzqD0uBpD9H5WBrWSxw5Vxfl7UsJRrcfjoN1xFlAzKHvgs7W8n7APkGvXByCl1PeCUCR1X/AhyI1rdrhpSEyoffXrPrinTzc3ij44x4T7tURS8riwWhV3EN86BVqvezQHchwZc9vpyTO+mhKGuonCZfO+XAqyOdFFq84SR/UhNFh51bZXS0TQ3/isvabWi++aWsT5t2g== 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; SFS:(4636009)(46966006)(36840700001)(70586007)(8936002)(86362001)(83380400001)(70206006)(2906002)(6862004)(9686003)(6506007)(52536014)(7696005)(186003)(508600001)(5660300002)(81166007)(8676002)(336012)(356005)(4326008)(55016002)(33656002)(36860700001)(6636002)(26005)(47076005)(82310400003)(54906003)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2021 20:15:12.3046 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c4d57d6-436b-45cc-bbef-08d9a93dcb92 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: DB5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7156 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org >=20 > Convert rte_atomic_test_and_set usage to compiler atomic CAS operation fo= r > display sync. >=20 > Signed-off-by: Joyce Kong > Reviewed-by: Ruifeng Wang Reviewed-by: Honnappa Nagarahalli > --- > app/test-compress-perf/comp_perf_test_common.h | 2 +- > .../comp_perf_test_cyclecount.c | 15 +++++++-------- > .../comp_perf_test_throughput.c | 10 +++++++--- > app/test-compress-perf/comp_perf_test_verify.c | 6 ++++-- > 4 files changed, 19 insertions(+), 14 deletions(-) >=20 > diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test- > compress-perf/comp_perf_test_common.h > index 72705c6a2b..d039e5a29a 100644 > --- a/app/test-compress-perf/comp_perf_test_common.h > +++ b/app/test-compress-perf/comp_perf_test_common.h > @@ -14,7 +14,7 @@ struct cperf_mem_resources { > uint16_t qp_id; > uint8_t lcore_id; >=20 > - rte_atomic16_t print_info_once; > + uint16_t print_info_once; >=20 > uint32_t total_bufs; > uint8_t *compressed_data; > diff --git a/app/test-compress-perf/comp_perf_test_cyclecount.c b/app/tes= t- > compress-perf/comp_perf_test_cyclecount.c > index c875ddbdac..da55b02b74 100644 > --- a/app/test-compress-perf/comp_perf_test_cyclecount.c > +++ b/app/test-compress-perf/comp_perf_test_cyclecount.c > @@ -466,7 +466,7 @@ cperf_cyclecount_test_runner(void *test_ctx) > struct cperf_cyclecount_ctx *ctx =3D test_ctx; > struct comp_test_data *test_data =3D ctx->ver.options; > uint32_t lcore =3D rte_lcore_id(); > - static rte_atomic16_t display_once =3D RTE_ATOMIC16_INIT(0); > + static uint16_t display_once; > static rte_spinlock_t print_spinlock; > int i; >=20 > @@ -486,10 +486,12 @@ cperf_cyclecount_test_runner(void *test_ctx) >=20 > ctx->ver.mem.lcore_id =3D lcore; >=20 > + uint16_t exp =3D 0; > /* > * printing information about current compression thread > */ > - if (rte_atomic16_test_and_set(&ctx->ver.mem.print_info_once)) > + if (__atomic_compare_exchange_n(&ctx->ver.mem.print_info_once, > &exp, > + 1, 0, __ATOMIC_RELAXED, > __ATOMIC_RELAXED)) > printf(" lcore: %u," > " driver name: %s," > " device name: %s," > @@ -546,9 +548,10 @@ cperf_cyclecount_test_runner(void *test_ctx) > (ctx->ver.mem.total_bufs * test_data->num_iter); >=20 > /* R E P O R T processing */ > - if (rte_atomic16_test_and_set(&display_once)) { > + rte_spinlock_lock(&print_spinlock); >=20 > - rte_spinlock_lock(&print_spinlock); > + if (display_once =3D=3D 0) { > + display_once =3D 1; >=20 > printf("\nLegend for the table\n" > " - Retries section: number of retries for the following > operations:\n" > @@ -576,12 +579,8 @@ cperf_cyclecount_test_runner(void *test_ctx) > "setup/op", > "[C-e]", "[C-d]", > "[D-e]", "[D-d]"); > - > - rte_spinlock_unlock(&print_spinlock); > } >=20 > - rte_spinlock_lock(&print_spinlock); > - > printf("%12u" > "%6u" > "%12zu" > diff --git a/app/test-compress-perf/comp_perf_test_throughput.c b/app/tes= t- > compress-perf/comp_perf_test_throughput.c > index 13922b658c..d3dff070b0 100644 > --- a/app/test-compress-perf/comp_perf_test_throughput.c > +++ b/app/test-compress-perf/comp_perf_test_throughput.c > @@ -329,15 +329,17 @@ cperf_throughput_test_runner(void *test_ctx) > struct cperf_benchmark_ctx *ctx =3D test_ctx; > struct comp_test_data *test_data =3D ctx->ver.options; > uint32_t lcore =3D rte_lcore_id(); > - static rte_atomic16_t display_once =3D RTE_ATOMIC16_INIT(0); > + static uint16_t display_once; > int i, ret =3D EXIT_SUCCESS; >=20 > ctx->ver.mem.lcore_id =3D lcore; >=20 > + uint16_t exp =3D 0; > /* > * printing information about current compression thread > */ > - if (rte_atomic16_test_and_set(&ctx->ver.mem.print_info_once)) > + if (__atomic_compare_exchange_n(&ctx->ver.mem.print_info_once, > &exp, > + 1, 0, __ATOMIC_RELAXED, > __ATOMIC_RELAXED)) > printf(" lcore: %u," > " driver name: %s," > " device name: %s," > @@ -391,7 +393,9 @@ cperf_throughput_test_runner(void *test_ctx) > ctx->decomp_gbps =3D rte_get_tsc_hz() / ctx->decomp_tsc_byte * 8 / > 1000000000; >=20 > - if (rte_atomic16_test_and_set(&display_once)) { > + exp =3D 0; > + if (__atomic_compare_exchange_n(&display_once, &exp, 1, 0, > + __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { > printf("\n%12s%6s%12s%17s%15s%16s\n", > "lcore id", "Level", "Comp size", "Comp ratio [%]", > "Comp [Gbps]", "Decomp [Gbps]"); > diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test- > compress-perf/comp_perf_test_verify.c > index 5e13257b79..f6e21368e8 100644 > --- a/app/test-compress-perf/comp_perf_test_verify.c > +++ b/app/test-compress-perf/comp_perf_test_verify.c > @@ -388,7 +388,7 @@ cperf_verify_test_runner(void *test_ctx) > struct cperf_verify_ctx *ctx =3D test_ctx; > struct comp_test_data *test_data =3D ctx->options; > int ret =3D EXIT_SUCCESS; > - static rte_atomic16_t display_once =3D RTE_ATOMIC16_INIT(0); > + static uint16_t display_once; > uint32_t lcore =3D rte_lcore_id(); >=20 > ctx->mem.lcore_id =3D lcore; > @@ -427,8 +427,10 @@ cperf_verify_test_runner(void *test_ctx) > ctx->ratio =3D (double) ctx->comp_data_sz / > test_data->input_data_sz * 100; >=20 > + uint16_t exp =3D 0; > if (!ctx->silent) { > - if (rte_atomic16_test_and_set(&display_once)) { > + if (__atomic_compare_exchange_n(&display_once, &exp, 1, 0, > + __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { > printf("%12s%6s%12s%17s\n", > "lcore id", "Level", "Comp size", "Comp ratio [%]"); > } > -- > 2.25.1