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 2223445DEE for ; Fri, 6 Dec 2024 12:32:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8175E40E20; Fri, 6 Dec 2024 12:32:14 +0100 (CET) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id 1E75C40267; Fri, 6 Dec 2024 12:32:12 +0100 (CET) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id DCF171633C; Fri, 6 Dec 2024 12:32:11 +0100 (CET) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id CDA071633B; Fri, 6 Dec 2024 12:32:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,AWL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=4.0.0 X-Spam-Score: -1.2 Received: from [192.168.1.85] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 9AD4D16390; Fri, 6 Dec 2024 12:32:09 +0100 (CET) Message-ID: Date: Fri, 6 Dec 2024 12:32:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/3] eal/x86: defer power intrinsics variable allocation To: David Marchand , dev@dpdk.org Cc: thomas@monjalon.net, frode.nordahl@canonical.com, mattias.ronnblom@ericsson.com, stable@dpdk.org, Bruce Richardson , Konstantin Ananyev , =?UTF-8?Q?Morten_Br=C3=B8rup?= , Chengwen Feng , Stephen Hemminger References: <20241205175754.1673888-1-david.marchand@redhat.com> <20241205175754.1673888-4-david.marchand@redhat.com> Content-Language: en-US From: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= In-Reply-To: <20241205175754.1673888-4-david.marchand@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 2024-12-05 18:57, David Marchand wrote: > 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 > --- > 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; The same kind of structure I suggested for the lib/power patch should be employed here.