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 6C67541B28; Mon, 28 Aug 2023 11:29:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 000AD4026D; Mon, 28 Aug 2023 11:29:21 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 9B6714021E for ; Mon, 28 Aug 2023 11:29:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693214960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yPSHISC8v5jMzlKFk+G8uxiGd7AxyzGzYFDmQfKd0s8=; b=QQ/eTTAiGo3vXKKNeMAMQv20BJmDhWv0ploWtt3gS5D4ct+FwhnHneAQBX/6LNz7vrfPlo pISWDNGNnTgjkcCnh7nkOvR35EH0bf5b8QLyaDBonrFBr3PkaMwUVcUraHxNOkZcSAtP/J IIq3VKskSpWzMJNp0RuHCt8SQYmjy5Y= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-9Hw4QwJGPaKQLVdV4UKFUA-1; Mon, 28 Aug 2023 05:29:18 -0400 X-MC-Unique: 9Hw4QwJGPaKQLVdV4UKFUA-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-500ac71f353so2546641e87.2 for ; Mon, 28 Aug 2023 02:29:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693214957; x=1693819757; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yPSHISC8v5jMzlKFk+G8uxiGd7AxyzGzYFDmQfKd0s8=; b=Sxks6W9/o08wLgtv4GNs1uBOPkqMN78mcLJL3aIIpenrjr8NykSHhQ3XC2W8eLjX5R f9myilCuTGme72XpE5e+e7n9urr1AYd1VDKvuuoth7uWpTzNizliMyZrUzrBU36Xpn6o t9jwQmsxboMr4a0Jb5ftYR695QB2NCOz4cEU7yu4nlpHSCeHzLK2gDPVaf5MWoh2Yeec aLq73l6njt9BnEaATEF2ystL4nnAy+r6E7TRPsUyjlX/1Mw1ZqvhOJ6UcmuW1FdxOVkN YxbS96OLMkcW4QdB0u6F5VzCsu24L7d42RDqLifq7pnG6PZsID+S8qvThI6RKaAtc3lM 6HdA== X-Gm-Message-State: AOJu0Yy07Ai8Hz1BiZgeAJPE52vfdcs9k+BJbebqCwrBtH950i84Vbbi jMMWJ7cWdwlf9+9lTFpeLpOQD2kfSu/1nUtdM6pCNHp8z3k8dGoBj/nmccj/n99qI+7g9ERJ3Et jJ3Owj6aTgETnmZn6YO8= X-Received: by 2002:a05:6512:3b92:b0:4fe:7e1f:b044 with SMTP id g18-20020a0565123b9200b004fe7e1fb044mr20396660lfv.15.1693214957102; Mon, 28 Aug 2023 02:29:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCicLxm8Lnu4hdx7jffnXduolR64fITPLyCOD7mXSYcrBJr+aRyMSuI4JM81K7GWCZu6YCOPdXIOoye3FZnR0= X-Received: by 2002:a05:6512:3b92:b0:4fe:7e1f:b044 with SMTP id g18-20020a0565123b9200b004fe7e1fb044mr20396647lfv.15.1693214956805; Mon, 28 Aug 2023 02:29:16 -0700 (PDT) MIME-Version: 1.0 References: <20230825152850.1107690-1-bruce.richardson@intel.com> In-Reply-To: <20230825152850.1107690-1-bruce.richardson@intel.com> From: David Marchand Date: Mon, 28 Aug 2023 11:29:05 +0200 Message-ID: Subject: Re: [PATCH] eal/x86: fix build on systems with WAITPKG support To: Bruce Richardson Cc: dev@dpdk.org, mb@smartsharesystems.com, roretzla@linux.microsoft.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Fri, Aug 25, 2023 at 5:29=E2=80=AFPM Bruce Richardson wrote: > > 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. > > ../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); > | ~~~^~~~~~ > > 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. As Morten, I prefer an explicit cast (keeping your comments) as it seems we are exploiting an implementation detail of RTE_PTR_ADD. > We also ensure comments are correct for each leg of the > ifdef..else..endif block. Thanks.. I had fixed other places but I have missed this one. > > Fixes: 60943c04f3bc ("eal/x86: use intrinsics for power management") > Cc: roretzla@linux.microsoft.com > > Signed-off-by: Bruce Richardson > --- > lib/eal/x86/rte_power_intrinsics.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/lib/eal/x86/rte_power_intrinsics.c b/lib/eal/x86/rte_power_i= ntrinsics.c > index 4066d1392e..4f0404bfb8 100644 > --- a/lib/eal/x86/rte_power_intrinsics.c > +++ b/lib/eal/x86/rte_power_intrinsics.c > @@ -103,15 +103,15 @@ rte_power_monitor(const struct rte_power_monitor_co= nd *pmc, > rte_spinlock_lock(&s->lock); > s->monitor_addr =3D pmc->addr; > > - /* > - * we're using raw byte codes for now as only the newest compiler > - * versions support this instruction natively. > - */ > - > /* set address for UMONITOR */ > #if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__) > - _umonitor(pmc->addr); > + /* use RTE_PTR_ADD to cast away "volatile" when using the intrins= ic */ > + _umonitor(RTE_PTR_ADD(pmc->addr, 0)); > #else > + /* > + * we're using raw byte codes for compiler versions which > + * don't support this instruction natively. > + */ > asm volatile(".byte 0xf3, 0x0f, 0xae, 0xf7;" > : > : "D"(pmc->addr)); Tested-by: David Marchand An additional question, would Intel CI catch such issue? Or was it caught only because you are blessed with bleeding edge hw? :-) --=20 David Marchand