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 3F4D8A034C; Wed, 21 Dec 2022 11:19:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55C5A42D55; Wed, 21 Dec 2022 11:18:10 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 0479740395 for ; Tue, 20 Dec 2022 03:11:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671502314; x=1703038314; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=V+lCp5dC1xLgol2K7FL9107KJLgAiAqbBYfKDH4T2u4=; b=gYB2anwGHjdH+HC2Z7aBJDTRCmRmFZW++qxJsmtOK4cPsSid3zWb4Tk7 36yqR5YzAbdWVdQM5oUgC7pAUl1v+aKedSD0cwcTwGNGz5S7rjolcvfZ0 EgKb5K6W/vDog6VT0YaFVv7gePuGt+hFpI379uevg+q1tdqFQCETDRNm1 BSOCmS0N6eWdmG1JnLrSYSJXapOes1C9YRCXWnbtFGGRLbhivWT1B6l4a +IUXlZkGR5oyuMBtRdf2Op29MOLcCIN7Np+AWOsbg+ViYTX8U9idwcYED DxIePnntynzjASGuiB8gCnAIClHyA7uFD9Fb8eCHKXqqddXbASQ/8uNRB A==; X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="307184540" X-IronPort-AV: E=Sophos;i="5.96,258,1665471600"; d="scan'208";a="307184540" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2022 18:11:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="683248879" X-IronPort-AV: E=Sophos;i="5.96,258,1665471600"; d="scan'208";a="683248879" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga001.jf.intel.com with ESMTP; 19 Dec 2022 18:11:52 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 19 Dec 2022 18:11:52 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 19 Dec 2022 18:11:51 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Mon, 19 Dec 2022 18:11:51 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.170) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Mon, 19 Dec 2022 18:11:50 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NrcutKUyHaXr1IDYPxUsoWqQopGMnwJ6PL02W7G6LHq+Fcs3ofw7jVGZvtPG2mcuQhlAuZyywx5Oi4yJdeHLLJhMDfp4Q98rVAwrX41PMn9xHsDPPsBJv/6OHnhBC109hTm0/R47SIGN74djC0dOwxXtpw6tzEAO+blKJS/I/opqE0BC0lTdI6Ya2FI0KV9zqMFe/HzIQjTUBT8Lg773mLdzFb5lb7eG0G+QSZYzc73Ua9I/V7Q2t4NULa85WN5Oj9c3q2yRRKJx7QHQ8hmKNPWmIBe+uSJdmnvM3/kcM7Eq0wdtEF1Rdu48tMD5lo6mbJjI0dUD9vEHWtYmgpVphw== 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=JnTSR9RPImGUxSQCVyz401SetRxsAgTOvicRtG1jOOQ=; b=Vl6ZKBgoH7U+mA0RP6Iy8cUQnqDUPSgyK+Pm2aYJQYIqVM/Yjt1B56xRup12hCuWC594ivq2l3xQQ2s9LasbnrK7WIE0vH2f5sSLQze+eVu9fosc29FEe43T8zN5SAWgRSg8iDjirRm7BVDMhLMcRAF0MeMiBuVLpcnlYsYNpN8IC1HhHWwOtb+GuUlwNIG9uvo+V92ng/DagYRHYzhY1Uj+6pAN+1ipcoqK2ng9kfaCCJ6jO2HOMZB8U1jRIFkUO8L9nQYboMVVQ4Wg7YJGvTHio+OjNDw1er3jnGH3igcfv6t9bKDvwUI8fxb9M+e2/PG3UOvuj8kD+MtT2ixWVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from PH0PR11MB4776.namprd11.prod.outlook.com (2603:10b6:510:30::14) by PH7PR11MB6425.namprd11.prod.outlook.com (2603:10b6:510:1f7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 02:11:42 +0000 Received: from PH0PR11MB4776.namprd11.prod.outlook.com ([fe80::e672:dc5c:c1b5:ad5e]) by PH0PR11MB4776.namprd11.prod.outlook.com ([fe80::e672:dc5c:c1b5:ad5e%5]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 02:11:42 +0000 From: "Zhou, Xiangyun" To: Konstantin Ananyev , Tyler Retzlaff CC: "dev@dpdk.org" , "Xu, Bowen" Subject: RE: C++20 report error at file rte_spinlock.h Thread-Topic: C++20 report error at file rte_spinlock.h Thread-Index: AdkOua1eIFFRnwEuTUqVdev5WXYqUQFDXy+AAAC9ZQAAE2YVcA== Date: Tue, 20 Dec 2022 02:11:42 +0000 Message-ID: References: <20221219163011.GA18921@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR11MB4776:EE_|PH7PR11MB6425:EE_ x-ms-office365-filtering-correlation-id: 4730ab2b-c1bd-417f-c10f-08dae22f89bd x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: m6keQWeTCiEnVIloGYNtq2oT25pjHrfQA+AaVJvTa/ZsXkQFT+rRcooF6B/MKkspoItrzTmDnf5udr6nUUQK0zlPmer1q1LbPH1WdS2IfulMc9YNYeTJCpjX3HblRaO1lktO3WmeXu5o90K/qeaWE2vxwWste4h4MdEuFbKJ+73yicMtp+X/117v1ip1BChzZCz8k5WM68j804MmLRk6rOp/mDkhieV4fYxPOMHflHjmnyiCAnlR+FJcbR2gTvAZ0s1nrBoNuP/BOJa1ezmtp4IvBio5+3dJ0D2L4Y6+UrcrrB2ndID+/Y5Pprul0u1JrIFU3o0IAKwbwqcakURFoiNttzlI96FHSAWh+bd/HA0bNzP5CiC9ImKXpzv4BpHxWugsQPpMVwORAmkAqCPB0Ax8oFiZ9AHIQHJ8PcJz5DYi1fF6N194A8Ul9EsDOBTDMEUVhCjl9Kc39tNqeJogIkulSczXA1K0S+BccAoQghNgxPIEj5Hp6OiuOaWWQMOz4tw+XHpDgcs4Ewqjy25YVAEJvFZxl1mAMLVcV5Ymp3dLOgpRsxMkk5Gk/Udl/cVD2O/be3vbOnPZIkWzy/ySnCzDyWkqMynVqX6LDz3jJrEvDWRJbk7gMrg/RgVQtYxnVzir+T9pZwFtSFIhoOlhhTHLI+hHjCvnNQvkNUlNM0HYN7Du78Mev+Km4eYnujbLSPXi/VaPEGzuxMpAj31fqA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB4776.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(39860400002)(366004)(346002)(136003)(376002)(451199015)(66476007)(66946007)(8936002)(66446008)(66556008)(4326008)(64756008)(52536014)(83380400001)(76116006)(8676002)(41300700001)(316002)(54906003)(110136005)(55016003)(38070700005)(38100700002)(122000001)(82960400001)(33656002)(5660300002)(2906002)(86362001)(9686003)(71200400001)(186003)(26005)(53546011)(478600001)(7696005)(6506007)(107886003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?2jVIH3V6CiCf4gvq3rPxhuPYPQc8LdXIrv+DC3CaPfgAESceG7rdZkOyDYr6?= =?us-ascii?Q?MYE5+tGyvEvCBWH5klCcMjMnSI9jDDLcqz+9oY4H00dzQQg8/7ymc/01T01u?= =?us-ascii?Q?Wv1zeORFJI5QygBEMDAcyA4JvaGGhOBeExSXdkBi+PQxiYr0Ydhowq3+nqfq?= =?us-ascii?Q?YFfTqYVlLzdoisvJDVnE5DVUBOB1P0YQXK47lRasHbW3MTw7an3GYwacla+U?= =?us-ascii?Q?RcW0PrA6xdkmS8SKhP33WgsoJ+4wNFna560xm9Job4o6pZQ3DLL6+KG2Axl4?= =?us-ascii?Q?FQF6RYqslAMrJce8FDzKma7rwYCYdQDPCay+9/DU2Uq4jbxy4cmI9qn79Jm7?= =?us-ascii?Q?TRwNZy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=?us-ascii?Q?YlV82STpSt94X2lYSL3ryAcJVQUyDV3cuTYnmIx5291edFda0BjH9E4+xpc/?= =?us-ascii?Q?SQgnOaqrV7a3jLDR8k4qoMuarqjBeMwGN25a8MYySHvvJ+Dkcij6lt3NLns6?= =?us-ascii?Q?YqQnPkTwNtlYxMPRC+isL0KD2ogp+LtgPsqESQGZvCsTm1AeYvNfwdCpKJ4w?= =?us-ascii?Q?1v2Nd7ceMWcfRKzRNJ0lXTl/Q27OCu2n1PMZsqtwSHDY828b/3mk72TBpX2S?= =?us-ascii?Q?ieM8dyZBSJ2rQSj/tIV0qhZEXElBHs8efXOOqL/ZUzbC/gb5uiMvegSLZyhj?= =?us-ascii?Q?9N/UV/bPoDQpctN8UKW0i4sOzD6tMA2H2nwk017E?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB4776.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4730ab2b-c1bd-417f-c10f-08dae22f89bd X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2022 02:11:42.8444 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8y36pdHETt5tR9avHRWGHejqxTuljEcUckk/SkdKTvsxMNBSiVjgyAdESm0Nw8BLt+rMdCPVqhaSP3274PEaLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB6425 X-OriginatorOrg: intel.com X-Mailman-Approved-At: Wed, 21 Dec 2022 11:17:53 +0100 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 Thanks very much for Konstantin and Tyler's analyzing. I agree that removal of 'volatile' is enough. A spinlock has already used t= o protect these variables. -----Original Message----- From: Konstantin Ananyev =20 Sent: Tuesday, December 20, 2022 12:51 AM To: Tyler Retzlaff ; Zhou, Xiangyun Cc: dev@dpdk.org; Xu, Bowen Subject: RE: C++20 report error at file rte_spinlock.h > On Tue, Dec 13, 2022 at 06:11:06AM +0000, Zhou, Xiangyun wrote: > > Dear dpdk dev, > > > > I'm using dpdk 21.11 LTS, when compile my program with CPP flag=20 > > "-std=3Dc++20", the compiler report below errors. After checking file > rte_spinlock.h, I think the error report by compiler is valid, there=20 > should be a potential issue when using functions=20 > rte_spinlock_recursive_lock, rte_spinlock_recursive_unlock and=20 > rte_spinlock_recursive_trylock in multi-thread, we could either remove "v= olatile" definition to ask users to handle the multi-thread issue, or using= atomic operatings instead of self-increment and self-decrement. > > > > > > /home/dpdk/lib/eal/include/generic/rte_spinlock.h:221:12: error:=20 > > increment of object of volatile-qualified type 'volatile int' is > deprecated [-Werror,-Wdeprecated-volatile] > > slr->count++; > > ^ > > /home/dpdk/lib/eal/include/generic/rte_spinlock.h:231:6: error:=20 > > decrement of object of volatile-qualified type 'volatile int' is > deprecated [-Werror,-Wdeprecated-volatile] > > if (--(slr->count) =3D=3D 0) { > > ^ > > /home/dpdk/lib/eal/include/generic/rte_spinlock.h:255:12: error:=20 > > increment of object of volatile-qualified type 'volatile int' is > deprecated [-Werror,-Wdeprecated-volatile] > > slr->count++; > > >=20 > i have work in progress to optionally use standard atomics but in the=20 > meantime the correct thing to do here is to use the gcc builtins that=20 > match the requirements of the c++11 memory model. >=20 > the code should be converted to use __atomic_fetch_{add,sub} or=20 > __atomic_{add,sub}_fetch as appropriate. >=20 > ty. >From looking at the code, I don't think it is necessary: both 'user' and 'count' supposed to be protected by 'sl'. In fact, it looks safe just to remove 'volatile' qualifier here. =20