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 90783A034F; Tue, 9 Nov 2021 22:54:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 417AA40E03; Tue, 9 Nov 2021 22:54:25 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60068.outbound.protection.outlook.com [40.107.6.68]) by mails.dpdk.org (Postfix) with ESMTP id 961294068B for ; Tue, 9 Nov 2021 22:54:23 +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=1P2P4XZIDDHv3fqgcA7PJYNTXq0ZKCICqlDGud/B7Fs=; b=zMNhlSf+aQ7dx7yEnmmlY+USjN5R8ni95deWENagCX+VivKjDaTT3O0YeilXgSJ05V8Up9CwE4DisDWLhnZn3X0hr5LTgc7WOv8cFI4AjqyqQGBbklJHnDWOcXCtoFkDBDgppVH76EypAEtq51JfZU63ML+iljrGlTNmg2FbHAY= Received: from AS9PR06CA0055.eurprd06.prod.outlook.com (2603:10a6:20b:463::6) by VI1PR08MB3534.eurprd08.prod.outlook.com (2603:10a6:803:85::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.15; Tue, 9 Nov 2021 21:54:21 +0000 Received: from AM5EUR03FT015.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:463:cafe::58) by AS9PR06CA0055.outlook.office365.com (2603:10a6:20b:463::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Tue, 9 Nov 2021 21:54:21 +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 AM5EUR03FT015.mail.protection.outlook.com (10.152.16.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Tue, 9 Nov 2021 21:54:21 +0000 Received: ("Tessian outbound 4ce13939bd4a:v108"); Tue, 09 Nov 2021 21:54:19 +0000 X-CR-MTA-TID: 64aa7808 Received: from e687e80b2cf1.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 83523C1C-8F9D-41A7-9AD1-0E8BCEABA367.1; Tue, 09 Nov 2021 21:54:12 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e687e80b2cf1.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 09 Nov 2021 21:54:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TpLKdrlsP+K0vSMPlBq0DUU8iV+QHb6PEs0rHbOfyLMVd3t/jZEGvAdONAOZEqA4uC6SpnVMAgDxO9TudRlZ2ZncIJi1TBmIxqX8H64G7xaMAeaLC4vgHD6xio9k//YHJL9zQQfOphOnRPBaSeItDBhC5eqdLmUvC+m17DG5VLCmt1AIL2NxqgpuMnt5ejAC/V5W9GBXeRIgLaoC3KTG2eOwKn2vi5tWqYzeaMhosJUQpKwigaz5o+Km5ikwxFpr3ngEJ4Wxzv25A94ram4VsGrzM92tDfSv/OPsm6hril2wuoUCgci0JMYUKZAbgOHd9E0Cy1SvkZf3MDh6p67pUQ== 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=1P2P4XZIDDHv3fqgcA7PJYNTXq0ZKCICqlDGud/B7Fs=; b=bPmU5LNyb42Ua/2jPwPlMku0Vxk0VY3fzWZ9ykE2uMHwDI6YPKMOTiaRVj3yFNhzf77KWLgJM9/e2iDJ22F3yoBkZof2+jxUVgLq9KLEytpqNzRKJYFZhjv09e57OENr6YNjUXE9gmvTsmLJq2EMK1sZUuNNnMG6+Qhk1MW0kr8LXhPRnqh5upBeEUutoGh4u62/SbUbH40q4QJP+IPB0WKGkNV0xFvPv/8sYdPDMgtHMFLjJZAYnunS/Mf/AytUzyHI+wS/Fyf0ZkeiVb+YuZex8YAGB9EI2NpO/aG+bNQxilz4tcd9VZ3UDt9zNvGQp4pQ+C1ZFb8uW1bUk6a3MQ== 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=1P2P4XZIDDHv3fqgcA7PJYNTXq0ZKCICqlDGud/B7Fs=; b=zMNhlSf+aQ7dx7yEnmmlY+USjN5R8ni95deWENagCX+VivKjDaTT3O0YeilXgSJ05V8Up9CwE4DisDWLhnZn3X0hr5LTgc7WOv8cFI4AjqyqQGBbklJHnDWOcXCtoFkDBDgppVH76EypAEtq51JfZU63ML+iljrGlTNmg2FbHAY= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB8PR08MB5241.eurprd08.prod.outlook.com (2603:10a6:10:e2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Tue, 9 Nov 2021 21:54:10 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::8501:86ca:a393:17b7]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::8501:86ca:a393:17b7%9]) with mapi id 15.20.4690.015; Tue, 9 Nov 2021 21:54:10 +0000 From: Honnappa Nagarahalli To: Joyce Kong , "thomas@monjalon.net" , "david.marchand@redhat.com" , Ruifeng Wang , "konstantin.ananyev@intel.com" , "rsanford@akamai.com" , "erik.g.carrillo@intel.com" , "olivier.matz@6wind.com" , "yipeng1.wang@intel.com" , "sameh.gobriel@intel.com" , "bruce.richardson@intel.com" , "vladimir.medvedkin@intel.com" , "anatoly.burakov@intel.com" , "andrew.rybchenko@oktetlabs.ru" , "jerinj@marvell.com" , "declan.doherty@intel.com" , "ciara.power@intel.com" , "xiaoyun.li@intel.com" , "nicolas.chautru@intel.com" , "maryam.tahhan@intel.com" , "reshma.pattan@intel.com" , "cristian.dumitrescu@intel.com" CC: "dev@dpdk.org" , nd , nd Thread-Topic: [PATCH v1 06/12] test/func_reentrancy: use compiler atomic for data sync Thread-Index: AQHXh4gaQl45llHvX0eIEioAgxQBaqv8WK9Q Date: Tue, 9 Nov 2021 21:54:09 +0000 Message-ID: References: <20210802101847.3462-1-joyce.kong@arm.com> <20210802101847.3462-7-joyce.kong@arm.com> In-Reply-To: <20210802101847.3462-7-joyce.kong@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 1CDE22E74475AC4BB8B7E16016595383.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: 13302633-28fc-4fe2-da12-08d9a3cb7c94 x-ms-traffictypediagnostic: DB8PR08MB5241:|VI1PR08MB3534: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:4303;OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 7GwYEn3KNO8RbUgmjNKSukd/GilFc/hoI16Yb1TOzvAoVoz+rhv8ahoNZMY4IHvx70qQO/x5MNpuUSp7WN8uVD8dMRVHukSK+kTtOcrs8HlVMbz/g/Tk6sk36Fs7ntXHGk/IcAMFCo3/qbQ2DiB2E624G8eYH0UV891NVop9alB5/IdiH78VU4XAPVJbtttutWco3jqPQzOFNhqg/AcoWsP7H8fPI1jbCS0rOiIrsGWKlbqwQ7LmNTY9BajNpqf78PUZesL3OgTHh03piyjIcopimTk6rX+XDBjor3pdrwOfaXR51xpWI7m933DKISn2UETUSzfyCdKGOVFTLQFBJ7DWRP2x7jBfPGSzlq9INDiIACBwroTBrZq0+2AZZUlQlYeQlQa8r2ATiOUPJKwqxJ/YUPTU3i5nUprY85QTFsRgz5OZ5uC6j9AuYUksHXADFMDueOyYJO5S2KUrgFce8Rs5KhndOnqOCO45RiGv+QuftSquP8mQ9WZRWNDGWSbTnflxWS+Yfxth4SswfYecYqpztgcyt2qXxf/xCcaNh/HsFUjKQd5ka1/kaonTrHjXVIfHlR5t4lb+etJChrNIJNCleb0aaAw9kMUSKVM79I8RsLXgbUgG29JiCdhao6z76pVbkJPEvKA1d0ve6odCchCxlL9rQa9KieclAn/PZtz2JfHq1zzuuLw7elj7xj+rHeXPYhWX/YZly0ZT0Vi1QoElSBqe0IbYoH0Oxa+oPAs= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(8676002)(6506007)(33656002)(921005)(76116006)(9686003)(122000001)(38100700002)(8936002)(508600001)(110136005)(55016002)(2906002)(26005)(316002)(54906003)(7416002)(66946007)(64756008)(66446008)(86362001)(66556008)(66476007)(5660300002)(7696005)(4326008)(38070700005)(52536014)(71200400001)(83380400001); 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: DB8PR08MB5241 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: AM5EUR03FT015.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 7b4fe845-7001-4d66-f772-08d9a3cb75d1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7/w38FTVfTJRzTJoyxG09MRWGQca0FGI7qDR9HML2+sMnLZMZEmqp+uF2qkrUGnjgFqF179b6/3J6Rn9GcXo7a0FVL+JWUC+eCk1H5zt0IOChu6+3QDUxsLvUiI7t2a+pN/QwNgQo/LjgbxPdeG2qyfP9CnPakreyncuha9uaqVfGj/UBGFmE2gKNgxJccseR2wgKBNGmm/tTBZO7RI3+M8hng3sifCZuq1PXYLb3q0ZcO+TRDvQt3nLD/Fbvt+VR99HFqkM4wckvNxFJ+BfGSeqzRy4QruS5nvVWnj/T7UY5quuF+kRs3uQXsnubJelC/Au/+w3gyJXaAew/R3mFkgmMHDyJ9xqprKVS0UdeIkWX0HPG4Sr+4wL3Vxwrwvfz7KEUYDbHI+Me7TZuX4nb4G3QuR3i1yITu89QH1m9QIf9HxlGmhW2dbZlbsJhobt1zPjKoIvvY+DLsNBubAOw+sBzMAFYg0At59K/JDytbkE7sTx++gh+zM0TU1IEP6u+ahmpxaZAV9jyqOWS9NSjF/yFOajzZQyoEFjrU6MmEpLxlZ6pgwyXfaejYllFVuTvU2ppMg6yQKhXrb9IqIdlrvARBoAHJlsrMEyPq6N52ulHSjpKCrztrJg52neDVUurvqris0Qy58Kq8CvOExGYm9J6G3VK5K6PUskBcGX1PDvvB6AlTSCbMX8P8bl1V9GoFlXA4CI2EpGwksPCxsHC7LeoAF6JzJ8lAP+VplBtCA= 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)(36840700001)(46966006)(2906002)(52536014)(33656002)(4326008)(86362001)(7696005)(8676002)(82310400003)(6506007)(921005)(186003)(70586007)(356005)(8936002)(26005)(9686003)(83380400001)(81166007)(5660300002)(55016002)(336012)(316002)(70206006)(508600001)(110136005)(54906003)(47076005)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2021 21:54:21.2914 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13302633-28fc-4fe2-da12-08d9a3cb7c94 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: AM5EUR03FT015.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3534 Subject: Re: [dpdk-dev] [PATCH v1 06/12] test/func_reentrancy: use compiler atomic for data sync 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 Sender: "dev" >=20 > Convert rte_atomic usages to compiler atomic built-ins for data sync in > func_reentrancy test cases. >=20 > Signed-off-by: Joyce Kong > Reviewed-by: Ruifeng Wang Looks good. Reviewed-by: Honnappa Nagarahalli > --- > app/test/test_func_reentrancy.c | 27 +++++++++++++-------------- > 1 file changed, 13 insertions(+), 14 deletions(-) >=20 > diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentra= ncy.c > index 231c99a9eb..c00ecb8110 100644 > --- a/app/test/test_func_reentrancy.c > +++ b/app/test/test_func_reentrancy.c > @@ -20,7 +20,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -54,12 +53,12 @@ typedef void (*case_clean_t)(unsigned lcore_id); >=20 > #define MAX_LCORES (RTE_MAX_MEMZONE / (MAX_ITER_MULTI * 4U)) >=20 > -static rte_atomic32_t obj_count =3D RTE_ATOMIC32_INIT(0); -static > rte_atomic32_t synchro =3D RTE_ATOMIC32_INIT(0); > +static uint32_t obj_count; > +static uint32_t synchro; >=20 > #define WAIT_SYNCHRO_FOR_WORKERS() do { \ > if (lcore_self !=3D rte_get_main_lcore()) \ > - while (rte_atomic32_read(&synchro) =3D=3D 0); \ > + rte_wait_until_equal_32(&synchro, 1, __ATOMIC_RELAXED); \ > } while(0) >=20 > /* > @@ -72,7 +71,7 @@ test_eal_init_once(__rte_unused void *arg) >=20 > WAIT_SYNCHRO_FOR_WORKERS(); >=20 > - rte_atomic32_set(&obj_count, 1); /* silent the check in the caller */ > + __atomic_store_n(&obj_count, 1, __ATOMIC_RELAXED); /* silent the > check > +in the caller */ > if (rte_eal_init(0, NULL) !=3D -1) > return -1; >=20 > @@ -112,7 +111,7 @@ ring_create_lookup(__rte_unused void *arg) > for (i =3D 0; i < MAX_ITER_ONCE; i++) { > rp =3D rte_ring_create("fr_test_once", 4096, SOCKET_ID_ANY, > 0); > if (rp !=3D NULL) > - rte_atomic32_inc(&obj_count); > + __atomic_fetch_add(&obj_count, 1, > __ATOMIC_RELAXED); > } >=20 > /* create/lookup new ring several times */ @@ -176,7 +175,7 @@ > mempool_create_lookup(__rte_unused void *arg) > my_obj_init, NULL, > SOCKET_ID_ANY, 0); > if (mp !=3D NULL) > - rte_atomic32_inc(&obj_count); > + __atomic_fetch_add(&obj_count, 1, > __ATOMIC_RELAXED); > } >=20 > /* create/lookup new ring several times */ @@ -239,7 +238,7 @@ > hash_create_free(__rte_unused void *arg) > for (i =3D 0; i < MAX_ITER_ONCE; i++) { > handle =3D rte_hash_create(&hash_params); > if (handle !=3D NULL) > - rte_atomic32_inc(&obj_count); > + __atomic_fetch_add(&obj_count, 1, > __ATOMIC_RELAXED); > } >=20 > /* create mutiple times simultaneously */ @@ -303,7 +302,7 @@ > fbk_create_free(__rte_unused void *arg) > for (i =3D 0; i < MAX_ITER_ONCE; i++) { > handle =3D rte_fbk_hash_create(&fbk_params); > if (handle !=3D NULL) > - rte_atomic32_inc(&obj_count); > + __atomic_fetch_add(&obj_count, 1, > __ATOMIC_RELAXED); > } >=20 > /* create mutiple fbk tables simultaneously */ @@ -365,7 +364,7 @@ > lpm_create_free(__rte_unused void *arg) > for (i =3D 0; i < MAX_ITER_ONCE; i++) { > lpm =3D rte_lpm_create("fr_test_once", SOCKET_ID_ANY, > &config); > if (lpm !=3D NULL) > - rte_atomic32_inc(&obj_count); > + __atomic_fetch_add(&obj_count, 1, > __ATOMIC_RELAXED); > } >=20 > /* create mutiple fbk tables simultaneously */ @@ -427,8 +426,8 @@ > launch_test(struct test_case *pt_case) > if (pt_case->func =3D=3D NULL) > return -1; >=20 > - rte_atomic32_set(&obj_count, 0); > - rte_atomic32_set(&synchro, 0); > + __atomic_store_n(&obj_count, 0, __ATOMIC_RELAXED); > + __atomic_store_n(&synchro, 0, __ATOMIC_RELAXED); >=20 > RTE_LCORE_FOREACH_WORKER(lcore_id) { > if (cores =3D=3D 1) > @@ -437,7 +436,7 @@ launch_test(struct test_case *pt_case) > rte_eal_remote_launch(pt_case->func, pt_case->arg, > lcore_id); > } >=20 > - rte_atomic32_set(&synchro, 1); > + __atomic_store_n(&synchro, 1, __ATOMIC_RELAXED); >=20 > if (pt_case->func(pt_case->arg) < 0) > ret =3D -1; > @@ -454,7 +453,7 @@ launch_test(struct test_case *pt_case) > pt_case->clean(lcore_id); > } >=20 > - count =3D rte_atomic32_read(&obj_count); > + count =3D __atomic_load_n(&obj_count, __ATOMIC_RELAXED); > if (count !=3D 1) { > printf("%s: common object allocated %d times (should be > 1)\n", > pt_case->name, count); > -- > 2.17.1