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 B062E459BF; Tue, 17 Sep 2024 16:42:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E416940EDF; Tue, 17 Sep 2024 16:42:03 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2058.outbound.protection.outlook.com [40.107.20.58]) by mails.dpdk.org (Postfix) with ESMTP id 6A3ED40261 for ; Tue, 17 Sep 2024 16:42:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=udpw3wixq0PTZ159eWQam29CGNdXmJVZOOnNc7dzSZUnNq8SkLd9x1XL/Qqc32oxUr7E4/Iux791fVUQRbrnlv4OalUwh9S7NS7hBZS76y5rxqPt2XgY5+k7BeJ5BHpDfdU5OvGNFvEfAYdBpbuNLQ4mG7msdMuELfE4txCGTyY0Tz45JgxW+yHqf56WIjmynmJ3eNmCe3aot40fZu6W9ESBp8ZOQ1PPW2DEuGPHDpa7gYqeD9Pdt7p/w8nuur5UPUla2Syi4F/DEu1z8Iqvr0reS8n7VZAHkdRyFXN8RXyYJ3zHO8q7l0T91w2UItBaP2athcmnBCYWtSHmYSQANw== 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=8QXQ77grbyJlmyNASwM1pAhDRu4Dnhbhux/JOhk2I5Y=; b=nYTAyi37If410l9s751NEBHhxB2Y2YCmmlM/IssG69HTCJc3618TUiHqHvFt9fZYgygXbV0qhbG+FzSTJRN4wHv+9LBNNE3I4Nz5UNyvCxgoisssorssddFMaX/J7GZgfaVcDs5KUpduihv+rNB8ojoaOrFInlkDZCmInSgaSIxHsH1h//rRIttIdpPO6p2RSgIPjvulrLSCLcvwmaO8lcESemsn+u0eR+wkbfuirCo8+EQOVLjR6bIb/vVqgAcO2aBAA06V1aeTl72Fh/q94/CoCwVsWbEfJ9i9wAPJDsQOrbBQSrB2QNtUZHNfJfKDxX7ObvuAwlalHBvspYyO0w== 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=8QXQ77grbyJlmyNASwM1pAhDRu4Dnhbhux/JOhk2I5Y=; b=YNypC4WoERRKvim9Nsrdf8h/oJwp+fvlGs9hmJAqijwuvW1MY+7MgOsIrWrZTFnF3e8DGTWrioRmTT+O9S5D0pv2jIUQulYFcOIqh6IgPnEcaVcQRTJ4Jl/yGmvwqWkAk3mBTXUhXIDfdNEbVz8Ub0GDiecvQX/KgSijWpYYfYabO7OFt2Ob4h1rel5CAoH4TYaIS/UMMo4EqZY8jSRzHx9J7XQbfEuLHOJA4yv0Qe24MazIpAtpqmCbAOCLl/7CtU/ZwktW5kLOh2EIQhgjoSqZtlVN7jTjVFNpc+K5bQ6Oq/BVGS4ipgsrdnDyanT0eETDETjnlvwS3s6Bl0Hu/Q== Received: from DUZPR01CA0244.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b5::13) by PR3PR07MB6857.eurprd07.prod.outlook.com (2603:10a6:102:71::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Tue, 17 Sep 2024 14:41:58 +0000 Received: from DB5PEPF00014B95.eurprd02.prod.outlook.com (2603:10a6:10:4b5:cafe::2f) by DUZPR01CA0244.outlook.office365.com (2603:10a6:10:4b5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Tue, 17 Sep 2024 14:41:58 +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 DB5PEPF00014B95.mail.protection.outlook.com (10.167.8.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Tue, 17 Sep 2024 14:41:58 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.69) with Microsoft SMTP Server id 15.2.1544.11; Tue, 17 Sep 2024 16:41:57 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 1FC9A380061; Tue, 17 Sep 2024 16:41:57 +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 , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Konstantin Ananyev Subject: [PATCH v5 7/7] eal: keep per-lcore power intrinsics state in lcore variable Date: Tue, 17 Sep 2024 16:32:39 +0200 Message-ID: <20240917143239.724069-8-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240917143239.724069-1-mattias.ronnblom@ericsson.com> References: <20240916105210.721315-2-mattias.ronnblom@ericsson.com> <20240917143239.724069-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: DB5PEPF00014B95:EE_|PR3PR07MB6857:EE_ X-MS-Office365-Filtering-Correlation-Id: 1416b4f2-0bdf-4e7e-50cd-08dcd726e211 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?B?dGdUS09wK3RybG0waFdJaCtKSUZPSlZ2d0lyVmlVTzV5WWUwYiszU3VEZ2ZB?= =?utf-8?B?NXZ3T3RWZzZOZndFaGZXRWdTRjlhYUUyeFphNVI2eUlmUzRaWE40ajN4YXR1?= =?utf-8?B?K0JUbWJGQW91Y0taeU9EN2VYL0dpckdhN2xzQmIwdGtWWUE4cHEwMkw4UGZt?= =?utf-8?B?MjhpR0p3dmJZa1FBZS9NUFRxNFMyWmRTZDB5SW5DU0Z6aVpkeTViYklUaDFN?= =?utf-8?B?bGh1VytFQnpObFljQzhEejVHMFlPcnFIQjlqaXZsQTh3REgvbFI1L0g0Z0lF?= =?utf-8?B?bUZ5bHM4dW1xcTRPVkgzNWhqTDVWbWFHbEhZK2pMK0t1RElUNGhiR0JBbDha?= =?utf-8?B?aDFXZVNTTzBrS3J3UExScVViWmt6azc0Z2ovRllheHZLVTBIY204Q05UQkpx?= =?utf-8?B?Qmc1MngvYTFPLzFRZzdOMWFkeTNqMG1Qc2dZaGFabk5KYnlOU2tKQjgvUGJW?= =?utf-8?B?NUFwYjlLb2M4RkpkZm1tRW4zRGM3K0pDTXUxbzFiWWorTDl5NkZ3WVlsallz?= =?utf-8?B?WWZpcmxtaUpSVjl5ZUN5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1FraWc5UUl5SHR0Ui9qQnllZzdEbTJ6NUFUeU1waXRIeEVGZENL?= =?utf-8?B?U050VndXYktDZm9lWUxuSTVrTFk3eWVTWjlkcGNscEdDamJ4RFRCT2F1Q1Fq?= =?utf-8?B?WXNMN3ZUMlAzQUtDR1NzU1VWSGRhei9VTTBjSHdFSWJTN3FmdWdRakRLZ0pm?= =?utf-8?B?ckwzUEs5Q2t4bXlMUHZwOGFYTzhRUWdEc2ozVWYyMlVZRTNWbWFJc2xoYWZp?= =?utf-8?B?QWdzY2IrRDBmQzRRNkJWSTd2cXVxTkNrckZuNTJCekFMS2RCdjUrUnduS2hs?= =?utf-8?B?WEV6a0xiVitoNC9zc2lWRExQdHFWQllFVDhIRURUSmlRTXFhMlVuWTh4am9N?= =?utf-8?Q?ZItMzJ10WShKkuaJZ9Bfls8+kNsNXB9vVEEi4=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)(376014)(1800799024)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2024 14:41:58.0501 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1416b4f2-0bdf-4e7e-50cd-08dcd726e211 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: DB5PEPF00014B95.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR07MB6857 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 --- 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.34.1