From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, frode.nordahl@canonical.com,
mattias.ronnblom@ericsson.com, stable@dpdk.org,
"Bruce Richardson" <bruce.richardson@intel.com>,
"Konstantin Ananyev" <konstantin.v.ananyev@yandex.ru>,
"Morten Brørup" <mb@smartsharesystems.com>,
"Chengwen Feng" <fengchengwen@huawei.com>,
"Stephen Hemminger" <stephen@networkplumber.org>
Subject: [PATCH 3/3] eal/x86: defer power intrinsics variable allocation
Date: Thu, 5 Dec 2024 18:57:54 +0100 [thread overview]
Message-ID: <20241205175754.1673888-4-david.marchand@redhat.com> (raw)
In-Reply-To: <20241205175754.1673888-1-david.marchand@redhat.com>
The lcore variable in this code unit is only used through
rte_power_monitor*() public symbols.
Defer the unconditional lcore variable allocation in those symbols.
Fixes: 18b5049ab4fe ("eal/x86: keep power intrinsics state in lcore variable")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
lib/eal/x86/rte_power_intrinsics.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/eal/x86/rte_power_intrinsics.c b/lib/eal/x86/rte_power_intrinsics.c
index e4cb913590..6fc3b2b1cb 100644
--- a/lib/eal/x86/rte_power_intrinsics.c
+++ b/lib/eal/x86/rte_power_intrinsics.c
@@ -22,8 +22,6 @@ struct power_wait_status {
RTE_LCORE_VAR_HANDLE(struct power_wait_status, wait_status);
-RTE_LCORE_VAR_INIT(wait_status);
-
/*
* This function uses UMONITOR/UMWAIT instructions and will enter C0.2 state.
* For more information about usage of these instructions, please refer to
@@ -177,6 +175,9 @@ rte_power_monitor(const struct rte_power_monitor_cond *pmc,
if (pmc->fn == NULL)
return -EINVAL;
+ if (wait_status == NULL)
+ RTE_LCORE_VAR_ALLOC(wait_status);
+
s = RTE_LCORE_VAR_LCORE(lcore_id, wait_status);
/* update sleep address */
@@ -269,6 +270,9 @@ rte_power_monitor_wakeup(const unsigned int lcore_id)
if (lcore_id >= RTE_MAX_LCORE)
return -EINVAL;
+ if (wait_status == NULL)
+ RTE_LCORE_VAR_ALLOC(wait_status);
+
s = RTE_LCORE_VAR_LCORE(lcore_id, wait_status);
/*
@@ -308,7 +312,7 @@ int
rte_power_monitor_multi(const struct rte_power_monitor_cond pmc[],
const uint32_t num, const uint64_t tsc_timestamp)
{
- struct power_wait_status *s = RTE_LCORE_VAR(wait_status);
+ struct power_wait_status *s;
uint32_t i, rc;
/* check if supported */
@@ -318,6 +322,11 @@ rte_power_monitor_multi(const struct rte_power_monitor_cond pmc[],
if (pmc == NULL || num == 0)
return -EINVAL;
+ if (wait_status == NULL)
+ RTE_LCORE_VAR_ALLOC(wait_status);
+
+ s = RTE_LCORE_VAR(wait_status);
+
/* we are already inside transaction region, return */
if (rte_xtest() != 0)
return 0;
--
2.47.0
next prev parent reply other threads:[~2024-12-05 17:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20241205175754.1673888-1-david.marchand@redhat.com>
2024-12-05 17:57 ` [PATCH 1/3] random: defer seeding to EAL init David Marchand
2024-12-06 11:09 ` Mattias Rönnblom
2024-12-16 9:38 ` Burakov, Anatoly
2024-12-05 17:57 ` [PATCH 2/3] power: defer lcore variable allocation David Marchand
2024-12-06 11:29 ` Mattias Rönnblom
2024-12-12 7:57 ` David Marchand
2024-12-13 6:58 ` Mattias Rönnblom
2024-12-16 10:02 ` David Marchand
2024-12-05 17:57 ` David Marchand [this message]
2024-12-06 11:32 ` [PATCH 3/3] eal/x86: defer power intrinsics " Mattias Rönnblom
[not found] ` <20241217085954.3310414-1-david.marchand@redhat.com>
2024-12-17 8:59 ` [PATCH v2 2/5] random: defer seeding to EAL init David Marchand
2024-12-18 16:35 ` Stephen Hemminger
2024-12-18 17:03 ` Mattias Rönnblom
2024-12-17 8:59 ` [PATCH v2 3/5] power: defer lcore variable allocation David Marchand
2024-12-18 11:17 ` Burakov, Anatoly
2024-12-17 8:59 ` [PATCH v2 5/5] eal/x86: defer power intrinsics " David Marchand
2024-12-18 11:17 ` Burakov, Anatoly
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=20241205175754.1673888-4-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=frode.nordahl@canonical.com \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=mattias.ronnblom@ericsson.com \
--cc=mb@smartsharesystems.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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).