From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org, david.marchand@redhat.com
Cc: Anatoly Burakov <anatoly.burakov@intel.com>,
David Hunt <david.hunt@intel.com>,
Pavan Nikhilesh <pbhagavatula@marvell.com>,
Shijith Thotton <sthotton@marvell.com>,
Sivaprasad Tummala <sivaprasad.tummala@amd.com>,
Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH 1/2] power: fix use of rte stdatomic
Date: Mon, 16 Oct 2023 11:53:09 -0700 [thread overview]
Message-ID: <1697482390-32106-2-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1697482390-32106-1-git-send-email-roretzla@linux.microsoft.com>
* rte stdatomic functions operate on RTE_ATOMIC(T) specified types not
regular T add missing specifier for amd_pstate_power_info state field
* use rte_memory_order_xxx instead of __ATOMIC_XXX
Fixes: 1ed04d33cf19 ("power: support amd-pstate cpufreq driver")
Cc: sivaprasad.tummala@amd.com
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
lib/power/power_amd_pstate_cpufreq.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/power/power_amd_pstate_cpufreq.c b/lib/power/power_amd_pstate_cpufreq.c
index ee58395..dbd9d2b 100644
--- a/lib/power/power_amd_pstate_cpufreq.c
+++ b/lib/power/power_amd_pstate_cpufreq.c
@@ -47,7 +47,7 @@ enum power_state {
*/
struct amd_pstate_power_info {
uint32_t lcore_id; /**< Logical core id */
- uint32_t state; /**< Power in use state */
+ RTE_ATOMIC(uint32_t) state; /**< Power in use state */
FILE *f; /**< FD of scaling_setspeed */
char governor_ori[28]; /**< Original governor name */
uint32_t curr_idx; /**< Freq index in freqs array */
@@ -370,7 +370,7 @@ struct amd_pstate_power_info {
*/
if (!rte_atomic_compare_exchange_strong_explicit(&(pi->state),
&exp_state, POWER_ONGOING,
- __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) {
+ rte_memory_order_acquire, rte_memory_order_relaxed)) {
RTE_LOG(INFO, POWER, "Power management of lcore %u is "
"in use\n", lcore_id);
return -1;
@@ -408,12 +408,12 @@ struct amd_pstate_power_info {
RTE_LOG(INFO, POWER, "Initialized successfully for lcore %u "
"power management\n", lcore_id);
- rte_atomic_store_explicit(&(pi->state), POWER_USED, __ATOMIC_RELEASE);
+ rte_atomic_store_explicit(&(pi->state), POWER_USED, rte_memory_order_release);
return 0;
fail:
- rte_atomic_store_explicit(&(pi->state), POWER_UNKNOWN, __ATOMIC_RELEASE);
+ rte_atomic_store_explicit(&(pi->state), POWER_UNKNOWN, rte_memory_order_release);
return -1;
}
@@ -448,7 +448,7 @@ struct amd_pstate_power_info {
*/
if (!rte_atomic_compare_exchange_strong_explicit(&(pi->state),
&exp_state, POWER_ONGOING,
- __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) {
+ rte_memory_order_acquire, rte_memory_order_relaxed)) {
RTE_LOG(INFO, POWER, "Power management of lcore %u is "
"not used\n", lcore_id);
return -1;
@@ -468,12 +468,12 @@ struct amd_pstate_power_info {
RTE_LOG(INFO, POWER, "Power management of lcore %u has exited from "
"'userspace' mode and been set back to the "
"original\n", lcore_id);
- rte_atomic_store_explicit(&(pi->state), POWER_IDLE, __ATOMIC_RELEASE);
+ rte_atomic_store_explicit(&(pi->state), POWER_IDLE, rte_memory_order_release);
return 0;
fail:
- rte_atomic_store_explicit(&(pi->state), POWER_UNKNOWN, __ATOMIC_RELEASE);
+ rte_atomic_store_explicit(&(pi->state), POWER_UNKNOWN, rte_memory_order_release);
return -1;
}
--
1.8.3.1
next prev parent reply other threads:[~2023-10-16 18:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 18:53 [PATCH 0/2] fix enable_stdatomic=true build with clang Tyler Retzlaff
2023-10-16 18:53 ` Tyler Retzlaff [this message]
2023-10-16 18:53 ` [PATCH 2/2] event/cnxk: remove single use of rte stdatomic Tyler Retzlaff
2023-10-16 19:07 ` [PATCH 0/2] fix enable_stdatomic=true build with clang David Marchand
2023-10-17 6:50 ` 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=1697482390-32106-2-git-send-email-roretzla@linux.microsoft.com \
--to=roretzla@linux.microsoft.com \
--cc=anatoly.burakov@intel.com \
--cc=david.hunt@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=pbhagavatula@marvell.com \
--cc=sivaprasad.tummala@amd.com \
--cc=sthotton@marvell.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).