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 4FD9BA0C4B; Mon, 8 Nov 2021 23:51:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 098D740151; Mon, 8 Nov 2021 23:51:15 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80040.outbound.protection.outlook.com [40.107.8.40]) by mails.dpdk.org (Postfix) with ESMTP id 5BA3540040 for ; Mon, 8 Nov 2021 23:51:13 +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=sSNqqIApXI78AAjoTYqGAR1xVwfsT0fsmEvxWbY8Kq0=; b=oM6HhiqvBJ1qf+avk9KhFKMlF7xxbFd19SJbqnlM+oPf751Gvnp3Me6627HCR6kYxTjhYb1I00laUAsiZd9fvH/S4q20YruCS7S26jznZnmmbAyzGoHP9icAC4mUNcB3sBsrMp+aPkDxeNqRN+zJjXJ83wPJ6xHpL2XeahZ4pzU= Received: from AM6PR01CA0066.eurprd01.prod.exchangelabs.com (2603:10a6:20b:e0::43) by DBBPR08MB4332.eurprd08.prod.outlook.com (2603:10a6:10:d0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.15; Mon, 8 Nov 2021 22:50:46 +0000 Received: from AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:e0:cafe::80) by AM6PR01CA0066.outlook.office365.com (2603:10a6:20b:e0::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 22:50:46 +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 AM5EUR03FT026.mail.protection.outlook.com (10.152.16.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Mon, 8 Nov 2021 22:50:46 +0000 Received: ("Tessian outbound 4ce13939bd4a:v108"); Mon, 08 Nov 2021 22:50:46 +0000 X-CR-MTA-TID: 64aa7808 Received: from 9d3c686331aa.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id DDFD6BC2-BED2-4D2E-AF6D-1A78898C1F1D.1; Mon, 08 Nov 2021 22:50:36 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9d3c686331aa.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 08 Nov 2021 22:50:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kEK6FujDy1UDLKUypRYQm/JHAVloX/khhgF9N6eNZSI/qWC1WLqaV50QnSMdFkQu73hBd74TxaNnKzwWKkoWwZZwhgBNlcj2+Io/jVVb3L5GjruIPUcRr91QfogsepblYGISJtPrUAUOpGB/MnDdAtDAP+j3pIY9ugMlIPhrZnVBPpCvcW30OSPh9TbuSi6IuEu1AKO/GLW3u1IasxMZR9zVV1uNeExqLAiiuYDLkz9mcryW3jlr8b/JC6mdvHUlFp3dKlXtGpcycvd6/J8qxaBnEwhv98+Cmg5ILXHW6Sw/7duANAxNhyB/ckCuQqipompYh2Tm3Ae1kAQlTXgw5Q== 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=sSNqqIApXI78AAjoTYqGAR1xVwfsT0fsmEvxWbY8Kq0=; b=jydEQ2o4FrKRbTNw1LxdbcO/AUuvGEzDQVgIX6CjQlpYxrAnELyPDe9waw2MNJ+D+F7qnzH2KuA/O+8/F5qH3fcVMZu4Cnxe/BawQhj2tR0zu9K1oSufu1gpWdNApRCvpTWmyFxt5dXxSDb1LNtnylDo4zvAyPeXt50F5zQRdShpAkXvhjTT4401AFjGcbrF/42askPez7dkNFm/7yinWF3f90cMOQ/cm139Da75aC4glvDlA2J07Pwqu+yOaQ5lV04p3wmpMxSSZQf8VMWxEIPdNcZVbiJMCmIGh8iSqnDGVgA4Bgv3GxRbdymW6K5f5E4fTQzo3ecixTc4I0vx6A== 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=sSNqqIApXI78AAjoTYqGAR1xVwfsT0fsmEvxWbY8Kq0=; b=oM6HhiqvBJ1qf+avk9KhFKMlF7xxbFd19SJbqnlM+oPf751Gvnp3Me6627HCR6kYxTjhYb1I00laUAsiZd9fvH/S4q20YruCS7S26jznZnmmbAyzGoHP9icAC4mUNcB3sBsrMp+aPkDxeNqRN+zJjXJ83wPJ6xHpL2XeahZ4pzU= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB6PR0802MB2152.eurprd08.prod.outlook.com (2603:10a6:4:83::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Mon, 8 Nov 2021 22:50:32 +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.4669.016; Mon, 8 Nov 2021 22:50:32 +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 , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v1 01/12] test/pmd_perf: use compiler atomic builtins for polling sync Thread-Index: AQHXh4f6Az8CALN4bEGVTxw5F+sScav60cYA Date: Mon, 8 Nov 2021 22:50:32 +0000 Message-ID: References: <20210802101847.3462-1-joyce.kong@arm.com> <20210802101847.3462-2-joyce.kong@arm.com> In-Reply-To: <20210802101847.3462-2-joyce.kong@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: E805597C2523FA41A2C60152DC462F4F.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: 0648f76a-573d-4516-8e1d-08d9a30a33de x-ms-traffictypediagnostic: DB6PR0802MB2152:|DBBPR08MB4332: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:7691;OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 8yOHNsZ1hfh37JoWrdEo3icucu3SvKi7zTaEjBF5dsQD6/oJobDKY9ZLAm7PVg2zMcscOs1wvwrPOxuPO5gG1wwZyUdmtC0Mxgau/3vrmnqMjXKY4iulZCEwB+/9F7YdADvoi/7o4RXNW2BorhOHm8umgI7N5LON+XVx6/4HZOMusJefzYWEfQfqlk49qYJv5JVqLKB/4k+QIVDcqOsJ8b1anWLyFFMwi3hnN4nRVVlrcgYhvFAZwVpoaaCw1lcyOam/51YeNoDtiCBJFK/dNtvtc5RupPtkBbrwXZnQdmI3Uvb6JE+gy6W87/+RrZOyaSsUpkU3IA9aEM9Hn4idxB20Pec77hPrzuKke/WHE5Fwv5GXEIVzudgKnCETQjAck1Lr3aVbIFiwF9Oq20zivRtknS2UUVCOUMtB3BHJzSPCMnSl/TRnYbb0I5bbJYxdI3fTZ7cYohJveghwc3EiNJA0UeDHcORTFCiQbxHw4R8PZvzTKkIeBJX/Aurpqe2TuKDUWhtaRZep3MX4lqkLNWDCSIsR+67UKRfhpMP0As/mBwKhVofYZIds5Uu/rGRuuMxzazcSQZNOHfUtBiby1iwtJSfc4rnE+zcO4lZLRSrWgweY5nMVzNN99CChGSQCbYLk5GaTWz3PuabFoURAQPxEm/ZkehNUtHI19rJ39NVoprKilqy8p+RUqDuHYBCdQWMgTIhkFvhajNG68nzXDI6WI4YsIedcwpRnGU8dLPU= 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)(83380400001)(33656002)(26005)(71200400001)(4326008)(66946007)(66446008)(9686003)(54906003)(508600001)(8676002)(5660300002)(186003)(64756008)(66476007)(66556008)(76116006)(38070700005)(7696005)(7416002)(122000001)(38100700002)(2906002)(8936002)(316002)(921005)(52536014)(55016002)(6506007)(110136005)(86362001); 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: DB6PR0802MB2152 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: AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: afd5d258-894a-4217-f069-08d9a30a2bc2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V8kl3MbYgflvGl0PE4yoaOcZWvQncrQWFCHnVIjzBETCND9yHpfHp1B03fGSmfdeARo/5j1RLa9VKg9aFs9oDKUDivIfJrWXg8eNI3OaZIYElzGgebFel2TTQX6fWA4EXtK78h4pji4eSzKTPe9baw22Ct1AubzHmR7RbViiHpkBXHun3aa+Zfo6DMNghwmGHIaTJqG6uzyjeWKaTegsKIsHdTkuDhw/aWOu+V3oMaHuv96QaRv9AofUHENnQTp/jdkRBszUB5um3Kox0alcaAULQ4tM9NWNpcZPIaCjgWUsCF7AWfiXswWbc/BqM3udOGYU5zr83s98O5Gg2Mr6XMziuwKTKgDxnU20Kmx/yBwf92GqayQg4uANMey4Q4i3uLJgfPFuo/ikXUwpEGlTGWsluiLL7ejmALdPqTq2bl6rnjB6vLZyCPhw7SCEAxGMZuhc+NecUTsMghlg+LWGGK5T3AfTUTbeClVPRgrUQIuuVmKwYT0aalR7U6k/6WzU900SaaIroINYWt12ZJiqMtJl/gCKaPAwOg3C0hP5hIssqDDfGubLTzo7QFth26BbtQTS5vaVohnfPiqmD9oOvUFNZHrKcULAaiFNy7lo9p6X0vaRG5ZLYBzwAtHwhbLNg9opeFUfHTJEBhzBowBZg7PsITDsYXz9UYHMZ6R/ArIT1fffe2NTpNAJKN/pdchQLt/6Di1Z4rlguTkjNChfeOaxevelMYmDMK3jKxKQ+fw= 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)(52536014)(6506007)(5660300002)(47076005)(4326008)(83380400001)(33656002)(356005)(316002)(82310400003)(70206006)(70586007)(7696005)(8936002)(81166007)(186003)(508600001)(110136005)(86362001)(336012)(8676002)(26005)(55016002)(2906002)(921005)(54906003)(36860700001)(9686003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2021 22:50:46.4319 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0648f76a-573d-4516-8e1d-08d9a30a33de 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: AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4332 Subject: Re: [dpdk-dev] [PATCH v1 01/12] test/pmd_perf: use compiler atomic builtins for polling 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 polling sync i= n > pmd_perf test cases. >=20 > Signed-off-by: Joyce Kong > Reviewed-by: Ruifeng Wang > --- > app/test/test_pmd_perf.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) >=20 > diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index > 3a248d512c..41ef001b90 100644 > --- a/app/test/test_pmd_perf.c > +++ b/app/test/test_pmd_perf.c > @@ -10,7 +10,6 @@ > #include > #include > #include > -#include > #include > #include "packet_burst_generator.h" > #include "test.h" > @@ -526,7 +525,7 @@ main_loop(__rte_unused void *args) > return 0; > } >=20 > -static rte_atomic64_t start; > +static uint64_t start; >=20 > static inline int > poll_burst(void *args) > @@ -564,8 +563,7 @@ poll_burst(void *args) > num[portid] =3D pkt_per_port; > } >=20 > - while (!rte_atomic64_read(&start)) > - ; > + rte_wait_until_equal_64(&start, 1, __ATOMIC_RELAXED); This needs to be ACQUIRE. Please see comments below for function 'exec_burs= t'. >=20 > cur_tsc =3D rte_rdtsc(); > while (total) { > @@ -617,7 +615,7 @@ exec_burst(uint32_t flags, int lcore) > pkt_per_port =3D MAX_TRAFFIC_BURST; > num =3D pkt_per_port * conf->nb_ports; >=20 > - rte_atomic64_init(&start); > + __atomic_store_n(&start, 0, __ATOMIC_RELAXED); >=20 > /* start polling thread, but not actually poll yet */ > rte_eal_remote_launch(poll_burst, > @@ -625,7 +623,7 @@ exec_burst(uint32_t flags, int lcore) >=20 > /* Only when polling first */ > if (flags =3D=3D SC_BURST_POLL_FIRST) > - rte_atomic64_set(&start, 1); > + __atomic_store_n(&start, 1, __ATOMIC_RELAXED); This line can be combined with initialization of 'start'. i.e. if (flags =3D=3D SC_BURST_POLL_FIRST) { __atomic_store_n(&start, 1, __ATOMIC_RELAXED); } else { __atomic_store_n(&start, 0, __ATOMIC_RELAXED); } It is ok to use RELAXED here as it is part of initialization and 'rte_eal_r= emote_launch' will ensure that the store to 'start' is visible to the worke= r thread. >=20 > /* start xmit */ > i =3D 0; > @@ -642,7 +640,7 @@ exec_burst(uint32_t flags, int lcore) >=20 > /* only when polling second */ > if (flags =3D=3D SC_BURST_XMIT_FIRST) > - rte_atomic64_set(&start, 1); > + __atomic_store_n(&start, 1, __ATOMIC_RELAXED); This store should happen after transmitting the packets. It is better to us= e RELEASE here. >=20 > /* wait for polling finished */ > diff_tsc =3D rte_eal_wait_lcore(lcore); > -- > 2.17.1