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 4F46745B42; Tue, 15 Oct 2024 11:43:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB25D40671; Tue, 15 Oct 2024 11:43:07 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2088.outbound.protection.outlook.com [40.107.22.88]) by mails.dpdk.org (Postfix) with ESMTP id DBE7A400D7 for ; Tue, 15 Oct 2024 11:43:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kP8+zNXIAQ1DhWAsdgv7iuca0PxafSvAiK22B7ME87eRqA5gjVQpisdwo8IcwwWxUch4XpW1/INNd+R1gsc+nngI6FkXpCqUdXExKwIdoeBsiq2hPnPTTyhGVtF9Ozp9UWa1AFGPyJWqL/sFHmgcdGOi+cYr2tcMWE/afzmaPwr9BiBls3YJpfU1k0RwPltSwvWJzgeT+RVw62wXNUKNeG+ib51kTfgZLrLRGIAsk6/TAMRa+Zk9w6X193UAJ1Zy0OV8sNsf1FxJufszi3iCkhCw/oQhrRcyw0AbAKu5tUqstfPLTBAKMKQWZcpUr1WFFaAl2PRcz9GjZau9oPD+gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cX4ufj1pN9MGR3XnbJ9151fWBNDYFHNFptwEX85LFw4=; b=dO59jUB/yBOHEDUU5/BMmGBiq/LdVIBqx6JW9hyhhzX3FpCuDhY1s7uyNqftlMdcyXQHpFNRsm948PN/xirsQk5EfW3u0psF8CyEvLGME+fSCjcxAnRFFwGIc7zD+oROS6jsSDC3xZluV+w9qG0msA1cfS2SbnsbVKMVrCc1zlgJV1691dIG5JnkXVZ4HMDWNYgh/8PYqUEg+PN4MSjILTrj9hbdDlrHcuyD0sCT8YZF1xuFDYmxplUjqv6xRVIxbsJXOrrcpcGbm81wfomsTItuuMtYJZxkP2CXCpDSa0WQJ/WtRuzLj84pRIVgCnOSQq1ulfpUgKWAT8JfzDZefg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=dpdk.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cX4ufj1pN9MGR3XnbJ9151fWBNDYFHNFptwEX85LFw4=; b=vTSd5N9tUazQ71Tk3zvCFcnyc+gBZsavlFWw/ePWEF09t4u/FR4LgPZy9mYm1BPKB+PvWfiktNDN9YvM141HwZTI6bTBZ594izq9cEN34qC4e++9RQV5qg+ICnTPTE9uL/ATmRpHA5FPGFmdtb94seK/AyVCfQzUQbVExjH2YWT6NMQM3mYsRJAzmAYbKcwy/Fe/c1D8hhjnDs6c7D9jrAYLfFV6MQcdzUuqa5SUuDto3p72GgLclID0HAGSQAtp20jTDlhxT+JYPqqVXq4l0Y96WX70LrSW1G7m0wGbjsCppm7+Ds4uUUKHDB14YzR479zrRLndARf1PI0UkyEmlQ== Received: from DUZPR01CA0111.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bb::12) by PAWPR07MB9465.eurprd07.prod.outlook.com (2603:10a6:102:34e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 09:43:01 +0000 Received: from DU6PEPF0000B61F.eurprd02.prod.outlook.com (2603:10a6:10:4bb:cafe::9) by DUZPR01CA0111.outlook.office365.com (2603:10a6:10:4bb::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Tue, 15 Oct 2024 09:43:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by DU6PEPF0000B61F.mail.protection.outlook.com (10.167.8.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 09:43:01 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.63) with Microsoft SMTP Server id 15.2.1544.11; Tue, 15 Oct 2024 11:42:59 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 820E4380070; Tue, 15 Oct 2024 11:42:59 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: CC: , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Stephen Hemminger , Konstantin Ananyev , David Marchand , Jerin Jacob , Luka Jankovic , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Konstantin Ananyev , Chengwen Feng Subject: [PATCH v13 7/7] eal: keep per-lcore power intrinsics state in lcore variable Date: Tue, 15 Oct 2024 11:33:44 +0200 Message-ID: <20241015093344.824073-8-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015093344.824073-1-mattias.ronnblom@ericsson.com> References: <20241015065505.823840-2-mattias.ronnblom@ericsson.com> <20241015093344.824073-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU6PEPF0000B61F:EE_|PAWPR07MB9465:EE_ X-MS-Office365-Filtering-Correlation-Id: a5aa4e57-22c7-480a-0411-08dcecfdc255 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?B?dm9rSmY0NE90cVVpMVJZTHBERkxJc3orU1c3TitEemJScUVia29YVFhDZ1pF?= =?utf-8?B?MW5hZkkraDZxUXdzekE3OTR2N2lHNDhPM1oyREIvY0pNNmxBaTFpRkxFSWFv?= =?utf-8?B?UFRJdXRpYlBtWk1hY1JZMVowVmlDWWVPWUJIb1pvNTNpLzQ3d2dOblh2SDRS?= =?utf-8?B?T2VMenVkakhnZkdSMkMxZVlpblhaRWp1NkxISkh0Yk4xeXA1d21UcHdsVjQ5?= =?utf-8?B?SlpDUVN4UXlnVnZsVFZRNlY1RjdkV2hVMEtYcjhkdFVscEkwa3VrTHYrK3pJ?= =?utf-8?B?cm5iR1BTUkhPbm1Rb2s4b2doYnNCSW02OWd1OUV1cWpZWm5nQnJYbm4vbnlB?= =?utf-8?B?WU8xWmQrRHJXckJyWTY4RUdzekl4Njg1bWoyR3RDcXVIVFpQZ0VwRTgwNm5a?= =?utf-8?B?T0RCZGFxd0Z0M0hFZ25nVG9JVWlta094MnRiV21sUEtOWkxMdm9UNENLRUUz?= =?utf-8?B?cGpmZXM5dHRDemJaYWgxaGJOM0xQU013R0s4eW9YQWYvK2RJSFFOSmtkYkpV?= =?utf-8?B?RlNiakNsNjJpT2ozRn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iR0VRaVMrMlB6cWsyQ3R2b2t4SnI3RnlQVUxac2F5TmRIdENiU3Jqdy9m?= =?utf-8?B?L3F1c3VndmU2MkwzQTMwYlpuM3EyMVhoRUtNOUk3WnpyOE04cm9KVGhiUVU1?= =?utf-8?B?dEVabkFKMUR1N3I0NUxCemE4cWplcXBWRm5kbWVrcGFkbVFaZ3ZnRzl1dGVv?= =?utf-8?B?cFIyaWllM1U1eWk1cHNBL05IMjZGOWJFMUNvblltYXJ4eVppQ3pHUEJrV3U5?= =?utf-8?B?WllkWlFUTnkwcGpScUZmc2d4SGFpbFFiaWlEcVFhTGhTTm9nU1c5b3BBWnpj?= =?utf-8?B?b2lPQUVMZFFCUHdIS2pqZjFNUVI0S3YxaTE3b21kbTZRV0dEdGp1WHRlajJj?= =?utf-8?Q?Y1q06WhW6lRJTfV8RkHxN1u9NWNXLvy4DDeYA=3D?= X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 09:43:01.0219 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5aa4e57-22c7-480a-0411-08dcecfdc255 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: DU6PEPF0000B61F.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR07MB9465 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Keep per-lcore power intrinsics state in a lcore variable to reduce cache working set size and avoid any CPU next-line-prefetching causing false sharing. Signed-off-by: Mattias Rönnblom Acked-by: Morten Brørup Acked-by: Konstantin Ananyev Acked-by: Chengwen Feng Acked-by: Stephen Hemminger --- lib/eal/x86/rte_power_intrinsics.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/eal/x86/rte_power_intrinsics.c b/lib/eal/x86/rte_power_intrinsics.c index 6d9b64240c..98a2cbc611 100644 --- a/lib/eal/x86/rte_power_intrinsics.c +++ b/lib/eal/x86/rte_power_intrinsics.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -14,10 +15,14 @@ /* * Per-lcore structure holding current status of C0.2 sleeps. */ -static alignas(RTE_CACHE_LINE_SIZE) struct power_wait_status { +struct power_wait_status { rte_spinlock_t lock; volatile void *monitor_addr; /**< NULL if not currently sleeping */ -} wait_status[RTE_MAX_LCORE]; +}; + +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. @@ -172,7 +177,7 @@ rte_power_monitor(const struct rte_power_monitor_cond *pmc, if (pmc->fn == NULL) return -EINVAL; - s = &wait_status[lcore_id]; + s = RTE_LCORE_VAR_LCORE(lcore_id, wait_status); /* update sleep address */ rte_spinlock_lock(&s->lock); @@ -264,7 +269,7 @@ rte_power_monitor_wakeup(const unsigned int lcore_id) if (lcore_id >= RTE_MAX_LCORE) return -EINVAL; - s = &wait_status[lcore_id]; + s = RTE_LCORE_VAR_LCORE(lcore_id, wait_status); /* * There is a race condition between sleep, wakeup and locking, but we @@ -303,8 +308,8 @@ int rte_power_monitor_multi(const struct rte_power_monitor_cond pmc[], const uint32_t num, const uint64_t tsc_timestamp) { - const unsigned int lcore_id = rte_lcore_id(); - struct power_wait_status *s = &wait_status[lcore_id]; + struct power_wait_status *s = RTE_LCORE_VAR(wait_status); + uint32_t i, rc; /* check if supported */ -- 2.43.0