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 A491D45B04; Thu, 10 Oct 2024 16:23:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55C8B40A8A; Thu, 10 Oct 2024 16:23:08 +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 D653A402F1 for ; Thu, 10 Oct 2024 16:23:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l9ViNcb/rsQkkFqrEmyB9iS0Fvt5VNQxSE3Xyr2zG0zonAT+VDmWnTrjqWiTJya7Mr01VEwmnNzzgIKFlNcMf9IfD7W4EeTHTA7bjKkB9GJ6oTbksoC9LOOIdTnHWCfTwb5rP8cb3StVZfRD32Vy4XAVJuM4a15HflcO0ktP363o24gS49DxlbwrugeUJjQIp9Y8G0NV8FNN1Lw6Y1S6PY18SQxTJcmsydjYOAlbVDZ9SJE5aOIqN7AIcpSlEHDSK5tW0a2MxU2zk9/3Xryxsi8205m30HUe+jzT56rcsFe0tPDab8L2rLd/JGHZDHf1gNsfLHWkSU8KI767sT/Jnw== 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=CR+dZfHHUcubYUzAQqeJyW+3U7mqF/V0ED8zxQAEFD3E4NVNQmXXkg5qPxi2OUObJQw5L817FdD8oYnkEFb+2bqDpt+gFH3SVhhJk6WODzQYPba5YTeGa5I/5I3E5grvyrGdNWCpuPfHyYmc7xbbmyKQj0AZfobdhcp5afbNYRAMsAwRKwM8WXSTTXS4y9kbmwr9pvJyYYcVi+0kl29gqqDanbDsFg4zd9weuDfmfHp9vdHBA/ZpC9rxc01femma6hFCaJki5yy2BXcwXXTCTq8fyooU6DMtY5hfCYnsZw00uE6dOA5jV+cW5P4crhFBOfWSrKww5+a1UNVu0ncptQ== 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=i2JJ23gug2iO9LxVZx0r427H2NIKEWPeeZyEV88YW0CxQCj1YsOEdJUC5YuiBL5TX8WRkPGUX3RFT3i2ehKiKyuyECDsZ7I08Dgj9PkabDYJuj1MNYkhrnt8rNikUUdrw2tX5PzEfugkfV+SBCGqdUxHFwCAx7KWq5/p0Uz0hraw9NWKSELaHHXPY/IVIKhQ1HFrY9VUut81crMWBBHtOb/7e5BbDGa0gplo0hOtIyk4gDCse280aWJKnD6yb91dPcyJiNUk86zrAU35G6+4s3WII/AQ4pVH0Z55HwioNiY1JHfPCcwto+QCRUPFv8sEfniT5WoNxv+CB3VA3vJZow== Received: from AM5PR1001CA0058.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::35) by AM0PR07MB6322.eurprd07.prod.outlook.com (2603:10a6:20b:159::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Thu, 10 Oct 2024 14:23:00 +0000 Received: from AMS0EPF000001A7.eurprd05.prod.outlook.com (2603:10a6:206:15:cafe::65) by AM5PR1001CA0058.outlook.office365.com (2603:10a6:206:15::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Thu, 10 Oct 2024 14:23:00 +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 AMS0EPF000001A7.mail.protection.outlook.com (10.167.16.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Thu, 10 Oct 2024 14:23:00 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.63) with Microsoft SMTP Server id 15.2.1544.11; Thu, 10 Oct 2024 16:22:59 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 14A9838007F; Thu, 10 Oct 2024 16:22:59 +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 v8 7/7] eal: keep per-lcore power intrinsics state in lcore variable Date: Thu, 10 Oct 2024 16:13:49 +0200 Message-ID: <20241010141349.813088-8-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010141349.813088-1-mattias.ronnblom@ericsson.com> References: <20240918082614.725220-2-mattias.ronnblom@ericsson.com> <20241010141349.813088-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: AMS0EPF000001A7:EE_|AM0PR07MB6322:EE_ X-MS-Office365-Filtering-Correlation-Id: 221ec71a-953d-44b2-5361-08dce9370b83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?B?bXAxeEdHWlc2Y0svSDl4L1dtRzF2VGZpekVmc3pHWEhaODB4T3dRbzU2K003?= =?utf-8?B?YmtRRWYzNWJkdFcvSjlGeU4wRjJwRy8yanFINWc1WHBmKy9EWiswRzNHVVdV?= =?utf-8?B?T3dMa0I5NjVjMkhBSkgydE0ySjdWbllVYXJIYjRuN0pCWlJ5SCt0MkFqbFRz?= =?utf-8?B?QXJHQkc5Z3dLaFhBU3dQV3o4ekxLS2FSSVhIVytyb3RlUnFyRGhUdVUwQWZH?= =?utf-8?B?WjNrWW9aODVsWklMblBNOHFySFFscUQ2NTVuaWpySCtHL1NtK2FVR0ZBcWdT?= =?utf-8?B?WHA5RHcrYzExZkV6RmdsbXdzTG8vVjByVERIU291YVpOSTNGcFhxQVloa05F?= =?utf-8?B?Q1Y5UzQ5aTdSSERtRnZlWHdOakREaTBha09vcmxSeTgwU0VpQ0NkeUhoZmFD?= =?utf-8?B?bXgxN1hGWm9VVkVucXdvZnBaUkU3NGpQamZsZXRxVDRLTDdOZWgzZFRLV3gy?= =?utf-8?B?QzdwVkY3QUhtTXJZUlhDcXJGUjJKT3BIS1dKckw5NFluRHVVcFNvRnhEYlIz?= =?utf-8?B?SE50b1hrTlZpUG9TeU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utf-8?B?OVRIK3IxLzhvK25CQXZBS2xUTXRxMDZWUklTTnQ5L290VjBVWEhOSEZrRTNF?= =?utf-8?B?ZEpnaDBxY3NPVEhZQlI2U2xyTEF3TzJVSFNyVWZZZ0JBdStBQXRQbFd4MVZr?= =?utf-8?B?a1dCazhnU3AyM0V2UkppYnZQbUJSSWtYNEU1ekRJeU9zemhUaTlYUXdPM0NC?= =?utf-8?B?b1lRSDNRWW1kT0dqdWtJeTdTdmN5ZmkyS3daR1hXQWt3NnBpQ3dSVSs0a3NG?= =?utf-8?B?M3V5NlA5Q0xkd2NoNE8wK1kwcmdha0o5ak1IQ2pjeGl0RlFYN2UzR3BwV0Qy?= =?utf-8?B?ei9PSHUyZzBCTGFFVER3NjVqWmJyMWtVbm9xb3NiSHJXN1hDc3d0R1dja3ZJ?= =?utf-8?Q?uv9dEvjX4kQU2fBUC2bHlUFdx8QYUg7XNvtbI=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)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 14:23:00.4928 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 221ec71a-953d-44b2-5361-08dce9370b83 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: AMS0EPF000001A7.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR07MB6322 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