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 426AC45B04; Thu, 10 Oct 2024 16:31:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1801402A3; Thu, 10 Oct 2024 16:31:24 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2078.outbound.protection.outlook.com [40.107.21.78]) by mails.dpdk.org (Postfix) with ESMTP id EB8A240689 for ; Thu, 10 Oct 2024 16:31:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=URLL0+ERPfJFS6PVOkqCcNT4EJKNahNi0235wYPD7rXt+ge9fE9DDqDTXrKaqauSWW4qiHDKfS+SJbiGv0CFlFsYfzjJiP/GhXsaCQS1JVSbq2LxZJ6CAHhjXRtNNFDXU5DT3XcnhJ6+Yme/4AW/JR3+c+HY3fIWU3epFWHKe/jDD7FZOt1yEs4OTA76m7LDDgNuP+byugmtfscTGWRPq1YZWXs/sQj1pOvrJMqNcbn8fy0ETUBVcVYS17cA99h9PqRQSqX7TrjU8HE7wBf3b5CMCH7owLP+IKBzWkwGxdIlECkYu52i5mm1Pr2iw6giPG7GTde/9/pt6livdwN1Eg== 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=gwtjBfb/JeYYE6WdnIJYUxeF5oNo2ZqgdZQ8+aWmBse75tJajNFLts9BvgbdcuGxCa8aa5V2rh0PRIMo8kH7qyb7ezNcvK0891MT0ygaWZVUPK6VWVLAodEfHc2vyxPa3V2it2vfIqVAe4BABHHjBaBgTdkpPBJ4lNN0vHsmHuK8TYBude7uGlu5zU0DDcP3L2ElmONgvbJfOT3vtDsZJ80hLzq3pP+1V+3u5AFEEHhhK30kqm0XhnXKIN2Y+o2+XcNGH7LXs1HI7QDDAprJ+6xF3T8dgM2y2u85FJfTgbAzy1AaoJd94+YmMm8UbnlzxcodaBvQdrEIIgvQvasMnw== 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=srlS+OO37T51bosygH7/UMWOApGZ+EyJAFFzbA+JPVU+9rLR47O9xIKK4USXKL1hu64G3ydd/XnDo7+AeLRHGA/0azL2dGnCvfyswjD7vBuVqHbebh95LRLOJI8i3uhXVo9GrEx8hHsJNlugyUd8yDGkn45QneO71GbE+YhLVI/e3KG86fxopO5Iay4/xiKq8Ap4vlbvXZhJ1Sm0g0sNlApuE2ix2Kvkex7zRE+9Oyh5TI8Q4fxkLmDKYg+aN5wMg7Mv4bZPwPl54VqMWNH83uXhHCtuC+1me/YcLIYYL+wUQVZTCHXk6rxv3+YoWIR6V1HKlI8EhwB9rM+8mMuysA== Received: from DUZPR01CA0049.eurprd01.prod.exchangelabs.com (2603:10a6:10:469::9) by AS8PR07MB7816.eurprd07.prod.outlook.com (2603:10a6:20b:352::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 14:31:15 +0000 Received: from DB5PEPF00014B92.eurprd02.prod.outlook.com (2603:10a6:10:469:cafe::19) by DUZPR01CA0049.outlook.office365.com (2603:10a6:10:469::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18 via Frontend Transport; Thu, 10 Oct 2024 14:31:15 +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 DB5PEPF00014B92.mail.protection.outlook.com (10.167.8.230) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 14:31:15 +0000 Received: from seliicinfr00049.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; Thu, 10 Oct 2024 16:31:12 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 60C2D380070; Thu, 10 Oct 2024 16:31:12 +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 v9 7/7] eal: keep per-lcore power intrinsics state in lcore variable Date: Thu, 10 Oct 2024 16:22:05 +0200 Message-ID: <20241010142205.813134-8-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010142205.813134-1-mattias.ronnblom@ericsson.com> References: <20241010141349.813088-2-mattias.ronnblom@ericsson.com> <20241010142205.813134-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: DB5PEPF00014B92:EE_|AS8PR07MB7816:EE_ X-MS-Office365-Filtering-Correlation-Id: bf02d31c-4e05-4966-e8c3-08dce9383267 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?B?U3RaemZLdzJEamJoNFFySFF5cW1DOXR5WHNjdElXSC9jS05mbG84NzZHL01v?= =?utf-8?B?dHR0VFRGTFdQUTgrVUoraWZPWHBUVXF0WVJxb2VQYkxEVklLRTIyWjNmZGM5?= =?utf-8?B?UlA2SnR2UXQydExHQ1RlanVoSjJRZnB6OWk5enNDUHdNSUxsRG4yQ1hHUjFr?= =?utf-8?B?ZVJGSG1XR2xoOWNpNk5MQTYybUpQOU9FZkl0OHBZWjRWQ2c5R1ZWaHEzSlJi?= =?utf-8?B?ZGpJN0MwLzFIamZHM0xtRnd3TWh6SG9wbWNxUWxTOE1ISHplVTQ2RnlFUFB2?= =?utf-8?B?c0g1dGgwVjlPeWl0MmM2eFEwcUFqSEQ3QjFRRDM4bkhVNUtDblpDOVQxUG1p?= =?utf-8?B?S0l4RDk4VzV6R1p2RzdHckNOTEcwSXIrUGRONHREZEZqUmJEZXVYcGQ3OVps?= =?utf-8?B?UFhBTWVhK2x1Yy8zbDlvQmJtdVhMR0Q0d3FIVUhJbDE5N1p0MmhOUWZwbGxk?= =?utf-8?B?SDhqZDRpbjcvdFlRSGhpTzI1VWtuTVRGaG5jQ3NpNzNQWmpHQjhmalZFMnpJ?= =?utf-8?B?Y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?= =?utf-8?B?NWhHNUowbHcvYi9CYmVRK0h3VHRtMzlhUWxJaUlDWmdWbDN0Nnl1Q2dJT3JS?= =?utf-8?B?S2Z0c25KVXdDVGZtY0dPN0ZQOGZTOXBmRzRTSUppeko2eU5ZdSticGJqcTQ2?= =?utf-8?B?OVNDdVVHNE1LSWMvWFU3UURIU2NyU1JpdUtZMHpOSVNpUXI2d0twS1N3SmJC?= =?utf-8?B?U3FLOElaMWN4WXFyM0d0ZWp2OWtsSURlQlkvS3E0ZURRYW5pR1Z1dE9mUDFY?= =?utf-8?B?Q05RWENDNHp3cGgvS2orVFRwQmtBR2hZRG5CQ25oVzZwT3ZVcXJyc0Q3TWVk?= =?utf-8?B?UlVLcDNxZmVHd29KTXI3My9jdE1Sa2h0NWpBTEFSeFk1dVl2bzBPMndwTkNG?= =?utf-8?Q?mUB5RAUQgy2fklqTLg9d/NsWXE31ctf70puAg=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)(376014)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 14:31:15.2097 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf02d31c-4e05-4966-e8c3-08dce9383267 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: DB5PEPF00014B92.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7816 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