From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Bruce Richardson" <bruce.richardson@intel.com>, <dev@dpdk.org>
Cc: <david.marchand@redhat.com>, <roretzla@linux.microsoft.com>
Subject: RE: [PATCH] eal/x86: fix build on systems with WAITPKG support
Date: Fri, 25 Aug 2023 18:07:48 +0200 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D87B42@smartserver.smartshare.dk> (raw)
In-Reply-To: <20230825152850.1107690-1-bruce.richardson@intel.com>
> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Friday, 25 August 2023 17.29
>
> 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=discarded-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.
> We also ensure comments are correct for each leg of the
> ifdef..else..endif block.
>
> Fixes: 60943c04f3bc ("eal/x86: use intrinsics for power management")
> Cc: roretzla@linux.microsoft.com
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
[...]
> - _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ørup <mb@smartsharesystems.com>
next prev parent reply other threads:[~2023-08-25 16:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 15:28 Bruce Richardson
2023-08-25 16:07 ` Morten Brørup [this message]
2023-08-28 7:08 ` David Marchand
2023-08-28 8:05 ` David Marchand
2023-08-28 9:29 ` David Marchand
2023-08-28 10:29 ` Bruce Richardson
2023-08-28 10:42 ` Stephen Hemminger
2023-08-28 11:03 ` Bruce Richardson
2023-08-28 14:31 ` Ferruh Yigit
2023-08-28 15:56 ` Tyler Retzlaff
2023-08-28 10:39 ` [PATCH v2] " Bruce Richardson
2023-08-28 14:39 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=98CBD80474FA8B44BF855DF32C47DC35D87B42@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=bruce.richardson@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=roretzla@linux.microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).