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 B407945B34; Mon, 14 Oct 2024 09:53:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 921C040655; Mon, 14 Oct 2024 09:53:08 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2042.outbound.protection.outlook.com [40.107.104.42]) by mails.dpdk.org (Postfix) with ESMTP id 06BBA402D3 for ; Mon, 14 Oct 2024 09:53:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CRY6AQjRLfOpt2wzlCA51JPmMhrGO2TWDp3NAM+VzIqxJtrYVCP8VRfzSwpJvzPcjVZ+poHk1jXvpwBjFTRFKTCs6ozPQnXo4mzJzFhw2gyjmCBV3SsanWBioC9RPQButWfoQhbMNx4BakqQkjwTm3KJD0tZtycb7My6QEI9FtqJIQFUeD0n8brJZ3t0Iqt9Kzq52SGfu/Xc8icqmT8QFVxHiglcFq7WLVN2juTEfgut3pUnwHvZTHvGb2gr/ScbXby2emWvkLm3MqnGv02nMGo/2LTZ0gHo+ZDGWJGliuJqL4GH3BOPdR6iXwKCgmtnfvyZoTalt8WLYfu1u4/JHA== 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=PTgJESNpXPAbYyilhrJD+JxRLMhMHZz2uCopWS6Fc6Y=; b=Hdbtce/+6v64YZgPbsi+/fm+ICxp8abf7m7zwKa7PAeB/Ekv8oINR4Plj3jbIXdCR+v76SlABjyDw00GPgbUnXqPul6J3r831gD0XdbbfXdWqclfiw7o8rln5zU2zmm+gvje5IC3lEUslLVC58mLqXNKcTwv5QBuWAOoAnjI3ymcDDaCE4aQanwVgZUK8d5dqQeZ+rBHsJvkJbVY5qcZguaTv2hP9VnwPg6PCkKnhkMJ5QhV522SHaFPMdzUhJIh16rG12uazOgtnhaYQGunuFEJj/QV5v3fk1nal/lvawlZZ3nnt2lmLSFd3NxlQlGxKV65/qUKxIwvqfOGIveLKw== 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=PTgJESNpXPAbYyilhrJD+JxRLMhMHZz2uCopWS6Fc6Y=; b=OwsC8ItX3dRMlXJ/JGKNrNTPVYolfdCV/SUlqBkevLya5tCaDDNcO9bOHj9McsrOWBsza/O2EswPv154GNCwM5MJ2m9P+glexZZCo+JCZRF4Ytc0BeMUHvRHD2sNX7T6VjwP8/gMD07JVklncTcxFh41Yh7YPo9cMrVTf+BVWR7+y7ybrDOqQGjL2vw7xF+b9R+abKiEp7hMbpGaimQOZnAiomIpccQPk0ty+ARRKpaBVb7kBn2FN3MGspcya0H/6oaHnUV7iFpRAv3YDz+HNnLLozGJ72jVVcy0RUqBfgLUpAgyJjGbX0tPWldOOckYU2OYRExJFVp3ri6OMLE6GA== Received: from DUZPR01CA0224.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b4::20) by AS8PR07MB7125.eurprd07.prod.outlook.com (2603:10a6:20b:251::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 07:52:56 +0000 Received: from DU2PEPF00028CFD.eurprd03.prod.outlook.com (2603:10a6:10:4b4:cafe::66) by DUZPR01CA0224.outlook.office365.com (2603:10a6:10:4b4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Mon, 14 Oct 2024 07:52:56 +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 DU2PEPF00028CFD.mail.protection.outlook.com (10.167.242.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.13 via Frontend Transport; Mon, 14 Oct 2024 07:52:56 +0000 Received: from seliicinfr00050.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.68) with Microsoft SMTP Server id 15.2.1544.11; Mon, 14 Oct 2024 09:52:54 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id A99511C0070; Mon, 14 Oct 2024 09:52:54 +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 v11 7/7] eal: keep per-lcore power intrinsics state in lcore variable Date: Mon, 14 Oct 2024 09:43:48 +0200 Message-ID: <20241014074348.821962-8-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241014074348.821962-1-mattias.ronnblom@ericsson.com> References: <20241011081901.816211-2-mattias.ronnblom@ericsson.com> <20241014074348.821962-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: DU2PEPF00028CFD:EE_|AS8PR07MB7125:EE_ X-MS-Office365-Filtering-Correlation-Id: c81d0b91-8e33-4728-4529-08dcec25370b 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?RXVNL01pWitadGZzQ2t5RzM3Ym14VTl0ZU14L0xUKzJlWnZ6ZW91Q1dyQWs5?= =?utf-8?B?YWR2djMxQm5BdTlqK0ZnbUdnazJTSzl1dTdiQzdzdUVoUGx2Z1FKUVVwbC9U?= =?utf-8?B?Tlk5QTRGQzFzKzVxY0RaZm9YV0lPd1g4TmZrTW80a2pQM2JvUDNwVE1tbXZl?= =?utf-8?B?WXJvcyt0SEl4dyttVXdlRU8wQk4zNW1qSWx3S2xucmJubk5PYzcvRHpDQmx5?= =?utf-8?B?NkF4WjFHR3NsSU1YSDY4SlpMUnM3ejFxZGx3RldEb1orNGVkb1Y0eUM4OWhY?= =?utf-8?B?Sm9wQVY4aUJXVXJVQzk4RkhzTzFtYjVDZis2MlIrMnJLVmFueHJEWE5NMHlT?= =?utf-8?B?UXNyK2VGdnNWdGttRm9scGFkdk5leWJPZmRUWWFFSlRZU1YxN0xidU9lWmww?= =?utf-8?B?dGJ1dEYwOEQrdXFPQzBCMjRTbFpMRTZHQXlubTY2eE04N0hITnNVd0tlaDdn?= =?utf-8?B?Mmx2MFBUQ2crMXRSaVk5dGRCN1RlSVcwQU9BdnZNbk03b0kvWmN3NFE5ME01?= =?utf-8?B?MUxUbElKUUN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?B?WGlhZzdyU2JGdW51VmE0aFhHOWY5OHlpU2tsK2oyT2Z6MWk4M0hoUUlzL1NU?= =?utf-8?B?U1hpZVJCWlJkVGtnV05VU01sYmlSd3h1QVcrRHgvUnMvUnVDTjZ1QTN2cDlw?= =?utf-8?B?alhpd1VtSWtlZzF3ZmxLVWcyS1hhL09mNXNpMlBzZ0tWRzcxTUt4SGM1NEg3?= =?utf-8?B?YjFWZVRaVTFpQVBWSkkxa0ZyL0FXTjh6MWJjQ2VXQ2lSaUFoOFUzNVJQLzRR?= =?utf-8?B?VWRPbEFSdE1qS2FPTm96cXViOVV5TUlDc3ZuM09xWWlpenRuWUVlbGZPTkpK?= =?utf-8?B?QXhQYmFObzNUZGxMNkdtNGxVNWFUa0RnaDFZMDY5bGRRLzgxQ2VlVHljcVR0?= =?utf-8?Q?ugswjIXHh3OyuI+92UMJ3mBz8WhfbaCGPBg8I=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: 14 Oct 2024 07:52:56.0417 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c81d0b91-8e33-4728-4529-08dcec25370b 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: DU2PEPF00028CFD.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7125 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..f4ba2c8ecb 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_VALUE(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_VALUE(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_VALUE(wait_status); + uint32_t i, rc; /* check if supported */ -- 2.43.0