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 51E3D45B5A; Thu, 17 Oct 2024 08:07:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C4634402F2; Thu, 17 Oct 2024 08:07:03 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2041.outbound.protection.outlook.com [40.107.20.41]) by mails.dpdk.org (Postfix) with ESMTP id C72F64021F for ; Thu, 17 Oct 2024 08:07:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t715fH1+6kl619OFfJtIkU0NCsTVml3Uoc0clPKb00BuLDabhgQ9LyJiWmfIvZGOB0L7D6BXwc51rB/H/ZpTahRHU+AkanQ7Yv/ewHJgsjvB4RDnsN0jiLQeY8xk0rr1/SDnFPQ1aZiR56GUHWs5KreumpFdyezuHyi7B9YV1gvqmpSNwMFjdp7C7IwyIDGCxWfjcT8EhmUybeYhxi6dWRARtpKJLyZBQKKocOdnfNu/nvjkbYXztPGBjaM8+SozdzNjjOAxtejoZZ6e5zf3aMhRNflPVGFWGJLwWdo7DCJ42vnqD0PwFx0C3Gm/JgmRGmJoeXYZFiei1Owhlmnz3A== 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=cX4ufj1pN9MGR3XnbJ9151fWBNDYFHNFptwEX85LFw4=; b=eL8xWcQSSlnRPdqwml8j3YGykgI3etbbJjlYS+1lhezLE99ABAU9px1Rt7EooEKKI68uf75//TWpeYunFmEFBKQhpROBAdXjGBNGWuqlhzlv7mmnC08yZTD1LYV+GCeoWPGc8RrISAY1TMpyEDmy6eh1WoxLFty/CrfNwZEnvtUR8zlYHnJlsEFIG96nsGTSq21WgbLoKO2zcQCmiRRXAYn/ZIEAN0JcuSB1VGUw87A/clmO/5r+Ij7eWrXKn+cxlrOm0daTYUua8yMG3VuYwBbjHnAYgFVkAN68nfo4uHDQsh8RS8FK+hKAIzS9mM07blKfy7Z2BELV2mR2PwnC1Q== 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=cX4ufj1pN9MGR3XnbJ9151fWBNDYFHNFptwEX85LFw4=; b=Gllvf9Z/zYIVdklVG8X66NeWkeSuPfzw423DKf5apWwF2+UKBJymLY432AvI7JEudtn4fGDMo7Wn6IHpb007hK80tqCRxmKLhm6+Swut2a70LD9BQWN8/uCLrWeZBryzuB7do0JhoN2d325oha0/fhlvNCyTpH5ssiX9sF6jAyGtGulIhC6/yfdTsZKI0hl02jsvsc6+B7Zh0o017TCbQNTguxyTYKz1+RGHJh6/sxfCtH+0R/ddk1Jg6QJRxJ4lKWbfhVWt4gI/PjPp/wD3U1nCFg5SI0yogo1Dcrgiw/ApvL7rbJYaTxjAdxqW2NFCSGkBJHsOExgKVuLDwfhR3g== Received: from DUZPR01CA0088.eurprd01.prod.exchangelabs.com (2603:10a6:10:46a::14) by PA4PR07MB7502.eurprd07.prod.outlook.com (2603:10a6:102:c4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 17 Oct 2024 06:06:58 +0000 Received: from DB5PEPF00014B9C.eurprd02.prod.outlook.com (2603:10a6:10:46a:cafe::ed) by DUZPR01CA0088.outlook.office365.com (2603:10a6:10:46a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.20 via Frontend Transport; Thu, 17 Oct 2024 06:06: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 DB5PEPF00014B9C.mail.protection.outlook.com (10.167.8.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Thu, 17 Oct 2024 06:06: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; Thu, 17 Oct 2024 08:06:57 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id A7E74380070; Thu, 17 Oct 2024 08:06: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 , Luka Jankovic , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Konstantin Ananyev , Chengwen Feng Subject: [PATCH v15 7/7] eal: keep per-lcore power intrinsics state in lcore variable Date: Thu, 17 Oct 2024 07:57:43 +0200 Message-ID: <20241017055743.848292-8-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241017055743.848292-1-mattias.ronnblom@ericsson.com> References: <20241016131916.827788-2-mattias.ronnblom@ericsson.com> <20241017055743.848292-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: DB5PEPF00014B9C:EE_|PA4PR07MB7502:EE_ X-MS-Office365-Filtering-Correlation-Id: 364aaf5d-b08e-44e7-67eb-08dcee71e8c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?ZmQydEZWMkhqZ3laYXlDL1MwVDhHQlFwRFEwUkJKUHkzQVg4MGNxN05UOGpH?= =?utf-8?B?bUkrTFFaUjF6K3FFdlNqR3k0WTg4NmIxdHZkblNaTlU0cWJ3NldLTUY2dlh2?= =?utf-8?B?YTJQZ2JxNG9VS1pPbWh2WUwrUjR4MHFuZ0czNnFSOXRDRVNzYTE0WjQrM2xL?= =?utf-8?B?bFBqN3d1ZUpJNnFTUCsyUXFVRTNDWUUza01sNFYzSDQxMklERG9nTEZzVXdx?= =?utf-8?B?SkwzVXNkbzdtSjU5N3FVb0ZxK0NkM1VUTnNtZStHT2xQeHJJczZBanZ5TkUy?= =?utf-8?B?aWNxcGZBTUFPSWt0dGNVMFFoblRKWTkxdkdCTmdIb1VSVGQrdzZMVHlockpw?= =?utf-8?B?RUh3WS8zdzlMakxEMkMvVFI1SHVwNVhHRXBqM3BybUJYSjA1YlBxa0U3ejQv?= =?utf-8?B?QWdGcjNvcXFMblpiTVNNR08vTmhHZjBLeXNtVC84MzJHcUdYMUVlTUpaanNF?= =?utf-8?B?MkN1aUxYNmZzOHU2VzNZMEpqVWkrUUh0ZHBoOU1Yb2hqWVFmQU02dXBJODV0?= =?utf-8?B?STFHT0lXOGJ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-8?B?RU1JdWJqWnZHZ1F6WHpZQStVWDJncEVTdFZQenBSR3p6Ni9HbHh3MkVzWG9a?= =?utf-8?B?R1RBSldnSGtzNTlieEFCYnFQd1JBTkNTSDZ2NUUzTGlnVGZDRXB3ZzFKaklK?= =?utf-8?B?STNqWjVmVWpLVWM3UnlDZmFkaEVucmVUdjJHMWJiSVljTEQvZkdCbmg5L0Yv?= =?utf-8?B?RjdmRExxbHFKOE1YWXBPblFMRmw0WVhaemZuWjVzRmR4N2FYMXkxa2xZdFdp?= =?utf-8?B?RzMyUElWZitqdFh6Mkk0cmZNZ1JwWnM0OWdRcmd4WHBCYVdLZ3ltN1MzQUg2?= =?utf-8?B?QzJMdkZSM2xmeUJPK1hHdUpCUzJMc29KS1lpY1hqT0NWTURrL2FiR3NJTE5X?= =?utf-8?B?bkZzNmZjWlhGbUpnQjNGYWp6VExFeFdXRmJWNkhrbTlzRkY1MEJkNWJmT0dU?= =?utf-8?B?RGJPVW8xcFU3UkpaYmR1ek4rdk5aZnhPOVdHL2xvMVBObnc9PQ==?= 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)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 06:06:58.3149 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 364aaf5d-b08e-44e7-67eb-08dcee71e8c8 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: DB5PEPF00014B9C.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR07MB7502 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..98a2cbc611 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(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(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(wait_status); + uint32_t i, rc; /* check if supported */ -- 2.43.0