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 E47AA45B40; Tue, 15 Oct 2024 09:04:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF1424065B; Tue, 15 Oct 2024 09:04:25 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2053.outbound.protection.outlook.com [40.107.22.53]) by mails.dpdk.org (Postfix) with ESMTP id 9BB70402E3 for ; Tue, 15 Oct 2024 09:04:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dVKP8X+gVO7/JO0bMwH/jeAll5rHdEWENKzgzdlITEY/w8BuysEbhhIJ5wMVlsD4JlzxZTiqmZLc+2tVIpGt4ONUY2iPy+5V9LVjHxGHelWtq7RZdKds7v9+lAw8LZt0qWdbLv9MgYYCozgY/CuHrRjLo7nphYNwFmqtXocTv3L/eagpDz6DGOCf/ELshbuUjvTAG1myH8ZTM932qUEaKMCL+wf41HOUJmxNXsuV6Z4ZmXmgZOZtxqLd7r7Mdpa8VSsPqVVpLrxXc/6a995MqyWBDQd19s+tc3tc5wS+yuS/SUTC6Y0lB1zkrE+Som/8ZabvoUOHYYnLtqJK7T8t6Q== 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=N8iAKmC+ku8rv7GAWpwdC564IaZkc5cJUh5dQQec21h/FIHIgdfMddtILvNlLQc4hL3d0KCWNNYrmhINyIAPDEKRxF8l5V5+zqXTMAEr7iJHSvgZdIcqNWZ2APywkP3brktVqMQotJmN1XFRWHEj89H8cII5n2TYK7pXfBBMqKnh7o02VdXxYFZ40vyltxI0sHf9FUtF3BqR/HHnBYIdDbxLWLJ70xr2Tg6zt0H+TL307yp/BSUfNAM8N7/xbFlaxeZLZxgWSoXwL4z6ov6QV0cufvvUlhxL4tx0+hQKtqLE9DeJ05Iyf5UM7OJnoG+EuEiykGGzKl6dYj0O3oCklA== 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=S08ogru2fYkKbqMzNWySm9tkRIR1hPu2RPCLh8VbMlM7qqcQA4pBsYNPcG2jzDVY+zxT5a+c1G4t9fDYXsseasL/LBzzS2QIY8J8MIMWlGXT8HeoExOZmJCaRo0aBC1pJbUIeJcup7MVN5VPsXpPPXqNSubpmaiHzhsEhQ/gdQayMmVTkw2cRZn336BsBfFzu+eL9grR3KGxwL/w8+fP5OoaOSK+o3h3heXCyb30Xchl2u7/ufKlNRaIJTPHBEgfEdDnEs+6Bq+P8ahHQhByYYOvCNhVdSGploCALrEHvHFkMnPWWNw2sWbz1eFurl2wNhGEGxSldqVn5HtDdeQThA== Received: from DUZPR01CA0198.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::29) by DBAPR07MB6584.eurprd07.prod.outlook.com (2603:10a6:10:18a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 07:04:14 +0000 Received: from DB1PEPF000509EC.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::a1) by DUZPR01CA0198.outlook.office365.com (2603:10a6:10:4b6::29) 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 07:04:14 +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 DB1PEPF000509EC.mail.protection.outlook.com (10.167.242.70) 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 07:04:14 +0000 Received: from seliicinfr00050.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.60) with Microsoft SMTP Server id 15.2.1544.11; Tue, 15 Oct 2024 09:04:11 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id AD8D61C006B; Tue, 15 Oct 2024 09:04:11 +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 v12 7/7] eal: keep per-lcore power intrinsics state in lcore variable Date: Tue, 15 Oct 2024 08:55:05 +0200 Message-ID: <20241015065505.823840-8-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015065505.823840-1-mattias.ronnblom@ericsson.com> References: <20241014074348.821962-2-mattias.ronnblom@ericsson.com> <20241015065505.823840-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: DB1PEPF000509EC:EE_|DBAPR07MB6584:EE_ X-MS-Office365-Filtering-Correlation-Id: da939472-45f8-4bdb-09c9-08dcece793d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?B?QTVmam9yWmd5S0RvQ29aWFZseWFGcGhSeGlwMFhDNThoTXNRMVlJcUgyT29K?= =?utf-8?B?N0pxRlp3UkZmK2R1TDZibGt5NkwrcEtEbDJqVk8wODgxRFJucGNIcmxzSyty?= =?utf-8?B?OEtTVTJ6N1B5cmE2SWZGUGFVNW9oN21FMXplOUIvS2JJMjNvQnpqcVd6cHN3?= =?utf-8?B?RGZncWx1K0JyWVZMVlFoaVNoZ2VnMVBFdEpuci8rdGFJN3BmSFAzbE5nMHdk?= =?utf-8?B?RWErdW5ZOGJmejhtUDBIZkpUUnpnaU5ZRzRyUHJ2QmU5RlFhZmUwMW1HcVpr?= =?utf-8?B?WVJsS1VIMlozN0JwYXZTTGR2NVdsVHdQNk0wRnZVeis0TXc1cUZ3TGxwZGhi?= =?utf-8?B?azlQRFNhY3hFaXpkWXNUamJuVnNvWGhGME5jWFBlTXQrUCtiT2szQ081L1g2?= =?utf-8?B?Um9mTWhIWjdVRWlQSDF3U1JteVhlck8yaG9yYmNwRVczZlBBMVBmcW5pTCtw?= =?utf-8?B?UTd6UVMzeStTQWYrV1lTWFFMbG85ZWkyaUNBQXp3L2xTMHlhOExqNFlNY0Ew?= =?utf-8?B?STcxWGladno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U5?= =?utf-8?B?clhkdnRMNG0rMUl5Z0tsSVJDZTZZb2RaMFRWcVZzaGd2RnVGVXZmWE5sNkh4?= =?utf-8?B?Z2pLNmRiVFdoYU44L0pCRzN5N25wN2k4K2l0RExSazRnMWlOOTdNMWxtK3JW?= =?utf-8?B?TllpdDgrOUxMQ2RaVHkxVVF6SVU4cjJrUmdodG12U1pjMjlraXR1WVkyUzEy?= =?utf-8?B?bk9UK3pqWHkxdVhuM2ZZSlJ3U0pwOEZmZEJmWkpRbEQzdXJtOXo5WjlMenhG?= =?utf-8?B?VVNWd2o4aTlOVHBvS1A3ZTJmRTFNeHV3NFdMaitHU3JmdTVuT0N5eFNMWkV1?= =?utf-8?B?eVFIZVFNbUVoK1c4U2E5WXFWLy9kRXdmemkveVhqWUJmcE5mYlJCVGQzWGxt?= =?utf-8?Q?5iFe81NIy7atRDKRgmLWy12Tw9EpBvfWuI+Sc=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)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 07:04:14.0733 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da939472-45f8-4bdb-09c9-08dcece793d4 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: DB1PEPF000509EC.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR07MB6584 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