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 DC13645BD4; Fri, 25 Oct 2024 10:51:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70E1C40614; Fri, 25 Oct 2024 10:51:07 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2088.outbound.protection.outlook.com [40.107.104.88]) by mails.dpdk.org (Postfix) with ESMTP id 7C7C840156 for ; Fri, 25 Oct 2024 10:50:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lqOg8thlN+XZXzj65rho2+IKEEz+YStb4iEBXVSogJVnU2V8GRLvYoOzH1nk+fZYSXTJlQoISLR1RcWaZfb8KuT8HORLofueZ11crATsc6WjFXYFftjJf+HZFG0xZ9Pa/W9RMPmQT4RHsIpIUJfLOhIgnnpjYlNfp1L7CfD4JlkFPamuo73jioneQ5PFpGJXWI0IYli/8n5BxuEKY3SKrVW+QfyE4ZJK6DwBx3c0e2WXILirYVlqBkqQV2xc5oQ/T0S0VxCCf2f2jfblLB5Mj2mJCqLTxUGcrjp7SO31qa+fjGee0H28l537o5PFr/I4WMwkOg1gtoVmu206Zp4xPw== 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=Ecbg8ZYkZ9159Y+vx5tT4qEUdhn7L567+qOHLSTY1nSYawxC6KRhC1wK/GsE7rExvNwiwxgBWflIOazMFmgqlxHAdDS7BM0YggmAEKsNRlL0O38QSzH6j0EtCNvwPVY97AcyT55MrVaIkZ0EcEx7FgCIKjYbWEvmSADdUgKCtBInlF6eHurBOkZihpWtNCaJALmpN02qtDNnmH/egwu9K+aomtsp3hoYr6WPo135XnoreEaRwnZenprUEMgkirEC78er0fBESKZ/9RhjFSR2E6jTOySqjkIYTBYNTTAwhCCEd8qEfp8PjzO9j4Y9714uI/JoxG1ZlMp3t9cYhPbRSQ== 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=CG7IrTpruy63levvqxRxP4M2aiWMHBLk4PKgC7RxQSjFDcK0/pK/BlZageAznVZjLOX6gDH5xoJBdsNofGzoxke9f2fgHdRFgHY4XCTg360HMu4Pcmahfh25S7gDNLISAA14YRxclQWAk72x0n4FRNV76yzru/RaTLbYmlCVljY1pT14zNEVKlQwOYecsaK2g1pZBC6gLuI0kgGS6TDwsC8cQm9o4ciBHQeRTn18LWKrLUipvGO0tMOFm6S48/vqWSkXNi/00lFf/I0kPg18yNc6STZ505Re39NlaTkURmVPaln/q4E9OZB8V0l68w5rDCzbHTClay62vjEwG1I5Dg== Received: from DUZPR01CA0272.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b9::12) by PR3PR07MB7035.eurprd07.prod.outlook.com (2603:10a6:102:76::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Fri, 25 Oct 2024 08:50:51 +0000 Received: from DB5PEPF00014B97.eurprd02.prod.outlook.com (2603:10a6:10:4b9:cafe::c9) by DUZPR01CA0272.outlook.office365.com (2603:10a6:10:4b9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Fri, 25 Oct 2024 08:50:51 +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 DB5PEPF00014B97.mail.protection.outlook.com (10.167.8.235) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Fri, 25 Oct 2024 08:50:51 +0000 Received: from seliicinfr00050.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, 25 Oct 2024 10:50:50 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id 4131E1C00A5; Fri, 25 Oct 2024 10:50:50 +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 , Thomas Monjalon , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Konstantin Ananyev , Chengwen Feng Subject: [PATCH v17 8/8] eal: keep per-lcore power intrinsics state in lcore variable Date: Fri, 25 Oct 2024 10:41:49 +0200 Message-ID: <20241025084149.873037-9-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025084149.873037-1-mattias.ronnblom@ericsson.com> References: <20241023075302.869008-1-mattias.ronnblom@ericsson.com> <20241025084149.873037-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: DB5PEPF00014B97:EE_|PR3PR07MB7035:EE_ X-MS-Office365-Filtering-Correlation-Id: 518d6786-3139-4a72-eb2b-08dcf4d2210a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|7416014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?B?ZzRsdVJPWG54K3BleGI4ZHkrSFFEdE1JNFROa3Y1cWhWV2I1Y1E5bnVxcG9N?= =?utf-8?B?a3RzV0wyRWM3Y0tmNXJOaHRocVU1S1BJaml6WXlVM2JCK2xSVWVMNHlLT3pF?= =?utf-8?B?QWg1L2NEbE00NUNUdCtqVThvM2EyK0hja21Sa2RXdDhaSGhaOHh5U291SGll?= =?utf-8?B?SG1PZ1NlL0t3cGFtakt4KzVWbnRPYlQ1RGg0MUJ4STF5eGdmdDRwZlBleXJR?= =?utf-8?B?ZmRUYi9VTGtqc0pjZlFpVDdTbXhPOVZaaUZtWUNxR1I4RHZEVXA2S0pTTVpQ?= =?utf-8?B?L3U1MTJXVnFjOGJ1NDh2ZDViMC83aHp3OVBYVzNERHRNcElObGxjTEdjekl1?= =?utf-8?B?UTg4aGdvdFMzSEk5d1FpbG9iV0tHNHBrRVJlMXpJNk04R0ZJZ2R1N1lERVdE?= =?utf-8?B?Wi9QQWZScURHcWZROVlDYm8wK3MveUlwalpaa3o5V0ZnZkFLeEhvYmp4ZGtt?= =?utf-8?B?VElIbEl0L3RMZkkvcUJHdFFlMk9ZeHpaUHB2dTIwUlRKMXM3YWpObzVQdXUw?= =?utf-8?B?QjcwVThwY0ZWS3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VTBRY21ESDVOM01seHY1L29aNExKekZ4VGRreDZMYnRWWnJVRGNv?= =?utf-8?B?WTk5TnBaODZ0ZFpDZHV1am1EdmRmYnpQMXlBV3l6UGRtbVdkZ29rRHZkcUhE?= =?utf-8?B?NjV3c0FiN21tekhPWFpxYjkrWU43aUtBelE1N3VwM0dZOWRBWGM5VmtpT1ho?= =?utf-8?B?MEZLbEh1Tmk0d0xRZERRRGJWT2czVmNHcm0zanliV0tpVUpIRGNQUG5KSWlo?= =?utf-8?B?OWFTcUNpZHkrU2p1U3lGdnB6UGNRaHBLdHl3c1JseGNwWW1yTFFBSEhNWEVH?= =?utf-8?B?ZE5zRlREUFMyVG1YQlRzejhYUUdGaHRDN0hIUWpTZUdEVzhWWE9vUUhUdVRh?= =?utf-8?B?Z3MyUzZhZlJ0dzFhMlJnb20xd2FqSGcyZEk5SDVKTmpjalNUNm5abWJhemE2?= =?utf-8?B?Ty9NejNpWXVzOWNWSzVxUVVJV0pSS2VFZCtjOHVNd1VmZmc9PQ==?= 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)(7416014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 08:50:51.3659 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 518d6786-3139-4a72-eb2b-08dcf4d2210a 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: DB5PEPF00014B97.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR07MB7035 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