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 E471445E3B for ; Thu, 5 Dec 2024 18:58:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF27140DD6; Thu, 5 Dec 2024 18:58:53 +0100 (CET) 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 A016440DDD for ; Thu, 5 Dec 2024 18:58:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733421532; 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=vabxz1Jrf9NOL3LcO+kOFQZu39q6QLZEI5hJfUjJYRE=; b=bEK0Fl5bYu/1oGU1VKTR2X4VbT2FqrLEHugm2nKyowoz+9Y48dm2w74lukFvW/TJy/IF4z x/mqgqlc68LeXvi9M9jfx/4ro/LQWbBwuZzcp9mg+79lhjIjDjxVuD1z698sRHmktX+ytk 76+o4knC+P2lTSz+clyz8J1Rp2PMqn0= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-202-wTP_fhWeOBmFHUuL6t735w-1; Thu, 05 Dec 2024 12:58:49 -0500 X-MC-Unique: wTP_fhWeOBmFHUuL6t735w-1 X-Mimecast-MFC-AGG-ID: wTP_fhWeOBmFHUuL6t735w Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 68E0219560BC; Thu, 5 Dec 2024 17:58:46 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.225.129]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9022D1956095; Thu, 5 Dec 2024 17:58:41 +0000 (UTC) From: David Marchand To: 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=20Br=C3=B8rup?= , Chengwen Feng , Stephen Hemminger Subject: [PATCH 3/3] eal/x86: defer power intrinsics variable allocation Date: Thu, 5 Dec 2024 18:57:54 +0100 Message-ID: <20241205175754.1673888-4-david.marchand@redhat.com> In-Reply-To: <20241205175754.1673888-1-david.marchand@redhat.com> References: <20241205175754.1673888-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 5BLaoQwLO7_qo_1VRvQiGumeMJAFD5bCTBmMY0Gx1_0_1733421527 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 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; -- 2.47.0