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 E96B643102; Fri, 25 Aug 2023 18:07:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E064840A7A; Fri, 25 Aug 2023 18:07:52 +0200 (CEST) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id E164E400D5 for ; Fri, 25 Aug 2023 18:07:51 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id B165020433; Fri, 25 Aug 2023 18:07:51 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH] eal/x86: fix build on systems with WAITPKG support Date: Fri, 25 Aug 2023 18:07:48 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D87B42@smartserver.smartshare.dk> In-Reply-To: <20230825152850.1107690-1-bruce.richardson@intel.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] eal/x86: fix build on systems with WAITPKG support Thread-Index: AdnXaPG4foFIC/xETJSw9Bh63sCFtQAA/mEQ References: <20230825152850.1107690-1-bruce.richardson@intel.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Bruce Richardson" , Cc: , 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 > From: Bruce Richardson [mailto:bruce.richardson@intel.com] > Sent: Friday, 25 August 2023 17.29 >=20 > When doing a build for a system with WAITPKG support and a modern > compiler, we get build errors for the "_umonitor" intrinsic, due to = the > casting away of the "volatile" on the parameter. >=20 > ../lib/eal/x86/rte_power_intrinsics.c: In function = 'rte_power_monitor': > ../lib/eal/x86/rte_power_intrinsics.c:113:22: error: passing argument = 1 > of '_umonitor' discards 'volatile' qualifier from pointer target type > [-Werror=3Ddiscarded-qualifiers] > 113 | _umonitor(pmc->addr); > | ~~~^~~~~~ >=20 > We can avoid this issue by using RTE_PTR_ADD(..., 0) to cast the = pointer > through "uintptr_t" and thereby remove the volatile without warning. > We also ensure comments are correct for each leg of the > ifdef..else..endif block. >=20 > Fixes: 60943c04f3bc ("eal/x86: use intrinsics for power management") > Cc: roretzla@linux.microsoft.com >=20 > Signed-off-by: Bruce Richardson > --- [...] > - _umonitor(pmc->addr); > + /* use RTE_PTR_ADD to cast away "volatile" when using the > intrinsic */ Yes. Having a comment here is good, so people don't wonder why the magic = has been added. > + _umonitor(RTE_PTR_ADD(pmc->addr, 0)); I think that (void *)(uintptr_t)p is more readable than RTE_PTR_ADD(p, = 0), but it's a matter of taste. Regardless, Acked-by: Morten Br=F8rup