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 B04A445B12; Fri, 11 Oct 2024 10:28:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 29B1A40395; Fri, 11 Oct 2024 10:28:25 +0200 (CEST) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2042.outbound.protection.outlook.com [40.107.103.42]) by mails.dpdk.org (Postfix) with ESMTP id BBD8F402E2 for ; Fri, 11 Oct 2024 10:28:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i2GaPyzV5xm6saaFNuiDcrcMC5BfD3tW0y4hzzzmH7U0smkbKETRnU0Wiw0MNtaGebTtdExLWSUh1EmNJ476R5NiGl6NYrFURUULYSR81AhPwhsDy7K0YBC72/oca+AESQbBEMc38k8E81KAKWDPd0ZrrWJNzLhyt8Vw8hr1kvOLMpkKM1gcIZJ+ULwsaGv8jSisWK6d/9xOUBBYo98m0cLpf+dgCRZ5lsj5x1f1jeCU2uGVZ8r+GmcqBqvRizqXeOXDkqF6b5E+Bd53KJ39S0JexqZJM9ltfV93sIAv41CVPFqUQ6sZ0g4g7MX4L5qOZtJCt5YEiXBI68YeWN15mw== 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=F1/3SuDwW2rl0HFjonfpL39DIJIcfR+IKkmZUpj8121yFw0pdj+lQO+p65Wad3demAgdKytOoL6eYsuCYV38fy5+DhHAMVSJYeISK6cCCOBiWa2mBMFG7vJ4b7RoiyVDftjJ1dWL0OxKfapEQ7QYxCnxeCGySwqksfEvnY2O0XPqe/J9j1DtSqjLPkKfKWt6vsmaDZvGqHhvS1O49eDAUX4Q0Z7oSqRZ+BOPfrREg6a+8mgymy0kFcpzplj03pzzP/aZZXqHp5bcrUkwaq/X91AVRS+TznD/oq/0Os3wXWHObW20C4v89WxYy8sV9rtqhkxs+ZV4E/c7oBQzKtjL6Q== 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=NQziRtGOfWdACkI7xUtUD/tbEppXHNNzwLTe/U3ZGWOIFzpaN9Kzn7psFS1pDZiNvjH7sKaTrSgeXfZKDTOjgl29JELzFmNzsDjpaLJLs4XAo+CVRZBi5zYWLzBKZVZ45OVp6FIua6gcSrg7p/XhhZ8400ugmHSMtX503tzsAm+1Q2md++643oaATBdiYSiTtErK4ikBEl4EH64+eYzbgHHymTkjrtfw6uTa4+NPmcFyykTb+BVFXQsbN6jBjOHua4voLxgpqq+CBSy6Ns5gkj6dPfIVTT2y380JUYGSi9xCdLLAU2z/AkKmeKrWTPkLrussKTywp9z6hY9+DEM7+A== Received: from DUZPR01CA0275.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b9::6) by DUZPR07MB9980.eurprd07.prod.outlook.com (2603:10a6:10:4af::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Fri, 11 Oct 2024 08:28:17 +0000 Received: from DB1PEPF000509F4.eurprd02.prod.outlook.com (2603:10a6:10:4b9:cafe::2a) by DUZPR01CA0275.outlook.office365.com (2603:10a6:10:4b9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Fri, 11 Oct 2024 08:28:17 +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 DB1PEPF000509F4.mail.protection.outlook.com (10.167.242.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.13 via Frontend Transport; Fri, 11 Oct 2024 08:28:17 +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; Fri, 11 Oct 2024 10:28:16 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 35ADA380070; Fri, 11 Oct 2024 10:28:16 +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 v10 7/7] eal: keep per-lcore power intrinsics state in lcore variable Date: Fri, 11 Oct 2024 10:19:01 +0200 Message-ID: <20241011081901.816211-8-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241011081901.816211-1-mattias.ronnblom@ericsson.com> References: <20241010142205.813134-2-mattias.ronnblom@ericsson.com> <20241011081901.816211-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: DB1PEPF000509F4:EE_|DUZPR07MB9980:EE_ X-MS-Office365-Filtering-Correlation-Id: f8c7f828-0e49-44fd-a163-08dce9cea840 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?S1F6S3hDWTJnWVVrOVpPMHhXV1MwMDFidFB2Z0o5bHNmb2hweEhWclBkc2FS?= =?utf-8?B?WGduN3VFSThIMWp4N0dDNWJKNGV6QlpwTUR4K3RaNktvT3VuYjlJcGYyTHZs?= =?utf-8?B?Z0NGeG5QZFBxdEFheklkY1FRR1Fnc1Z6WlJNdS8vVGxGc2JnT0N1S3FZZkJW?= =?utf-8?B?MmIvWnJVaDlqWDQ5MjRUOGZEU1lTMnRPc1VyUEpuNVhXTXh1WGxWNTVhNFBJ?= =?utf-8?B?aFBIczZ4dTRsQnV1eFp2dlNkaEpRbXJXdG5XTFl2TERxYURxR1NpTGFPbmVy?= =?utf-8?B?d2tYMCt4b2RlVndyOWhGbVhnb1pPdzJQWDMrOWtsdk5LcjBSQU02SmlrNTJP?= =?utf-8?B?YlBLME85NGZIWDBFeWRMZ3UzNEJVbW8vZ2phR3RSS1VUaURFbm5nV0o2Ykwz?= =?utf-8?B?QjlJRk4yVG56N0xsWUF3dnZLd2JvNGVjNWlzR2dibjZuLzFuejZVUDJTUk1s?= =?utf-8?B?WDBZVnpibno1MTVqWWg4WVVZWWF3QmovK1I4NzZMUWlkQmJSRHVzeHdOWEg3?= =?utf-8?B?RGl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GdZalZB?= =?utf-8?B?aHNqTFBoTjFtSThqNXpQdDNMdmg3VmM0OWd5NTJHWjQxZnhBdEF3N3QvSE41?= =?utf-8?B?UmwwUHhiSWhXUUtTL0VZbWh0MzRvc1AwMWhjVXlORCtRM05zdUYwelBLTlZv?= =?utf-8?B?Q0QvS2NKVnpLT0J5YnhabEVyMEhtY2VseTU0cGMyYUVRSjBjNi9ZamxJSlFh?= =?utf-8?B?YkdicWpPVVdqOGxkSjdsdTlac0FzaVNHcG9oQlZ6OXRjQ2pyOEMxR2xOcFZv?= =?utf-8?B?RU5jM0ZmcGxQTHJ4QnZDWDdOMmZ5b0hnc0Q4UUVPbjI0UGh6VGNuR00wcFRL?= =?utf-8?B?cHhNZElKNDJtYTM3NS83RzRNV0NWRWQ2OThBZVJiNjdvYWxtamVFVUlnWGl4?= =?utf-8?Q?/9RDaz9YC0ayiOhMVIimlacDmpO6LXilPNJ9s=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: 11 Oct 2024 08:28:17.4329 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f8c7f828-0e49-44fd-a163-08dce9cea840 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: DB1PEPF000509F4.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR07MB9980 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