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 323F8459AD; Mon, 16 Sep 2024 13:02:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 722C740E1D; Mon, 16 Sep 2024 13:01:43 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2061.outbound.protection.outlook.com [40.107.247.61]) by mails.dpdk.org (Postfix) with ESMTP id D5C1640E2A for ; Mon, 16 Sep 2024 13:01:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lOlXnOPuqpC6K0K1oqX6YHSaGJ5CQ9M3O94MZl7AD7T+CbFkRC7pXr2PYW7PMYwXuwHVdMsyH2NaTW+DzaTVUS2afThwlt5CWPygiROEGwPBYDNdPeam6cz0lktaxfX6LwwYHErvUYvtWn6LxQWcpgKHY3RW7AzRRrjOPo/SZHeXq5z+t3pMsfwEwW6ya0JoOuqkxHl9QjFsdoIUUDuGJND8gBs9egDbY88igdGVHplnfyFQSiJljG4ZKCQOAozXlri94HcX+MxFBDMNemZSusrDq5h4UEZUZdFMjHx4SFwiyX5ZR+XCIFojA/42U0w+hpLA7FZd48TAZFmIX3IxvQ== 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=5KgLIeJsoXsbjQgRv+axyk0s7Khi0OpcLSDJyLLTnRM=; b=EifZTAjY6bGnpdacLnbbJJEZFdbrM4uz0ShYnds10UYSTnMRUteLMzY4i2PGYnUWhi5QfGrPVMVBVioQEjevCJnZ2Y7XCXZaD8mVN96bnKMWnwNaNdeErKwkdfKJ92efxIksG8Xdh8bznZy3gXeMHKGjohjTYlI4d5qRWVP7XSBSevWLRPotbXOZEKfdat5hjMbsHuo0g5bjFwd7cb8+wcfV5yNErI5ggSJK2oH+q4fcszZaOPXbbpkrkZmEHp293dkx+qZLANkENzLwc1VhQ0HZ/RuaRJT6ZcZagvXsArva94y5/CmzLN/rLTR1UmMlpXZMfOECl5Ykzxj6VYEq3g== 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=5KgLIeJsoXsbjQgRv+axyk0s7Khi0OpcLSDJyLLTnRM=; b=Zjiffg4g6bYmJ2EpZSz6Eq04/ejMt0sWm2XyfdNjkqoZ3hEFK6YCeUDhipBpDWFTL+HxQK7LC68FLpOvF0kK/PGCZkzbTkknDK9CUEpLQzWVJRX/pV0Flyyi1kz81Tyap2YOV55jhvPuasqmtT2b6lJkv595xw4pV4AsdG1prgDEy2xchw8qTVKZqm+AsZUxzzyHGlo/+99pRKJeD5ZbcmxP0Zj/5Nmw2r75a5V/zqJyTXPzrLu8CSPbZJ2nRIVedoeltgaiQQUnSq+yHGoLaTvCKysQz1nPQBSPcIuwAUlgsykd1hi3p+/sP/Yh0oFWCa64tbhfmW0Ptn9WJbwdPg== Received: from AS9PR05CA0050.eurprd05.prod.outlook.com (2603:10a6:20b:489::24) by VI1PR07MB9849.eurprd07.prod.outlook.com (2603:10a6:800:1db::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.23; Mon, 16 Sep 2024 11:01:32 +0000 Received: from AMS1EPF0000004E.eurprd04.prod.outlook.com (2603:10a6:20b:489:cafe::8f) by AS9PR05CA0050.outlook.office365.com (2603:10a6:20b:489::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Mon, 16 Sep 2024 11:01:32 +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 AMS1EPF0000004E.mail.protection.outlook.com (10.167.16.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Mon, 16 Sep 2024 11:01:31 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.62) with Microsoft SMTP Server id 15.2.1544.11; Mon, 16 Sep 2024 13:01:28 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id B2350380061; Mon, 16 Sep 2024 13:01:28 +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?= Subject: [PATCH v4 7/7] eal: keep per-lcore power intrinsics state in lcore variable Date: Mon, 16 Sep 2024 12:52:10 +0200 Message-ID: <20240916105210.721315-8-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240916105210.721315-1-mattias.ronnblom@ericsson.com> References: <20240912084429.703405-2-mattias.ronnblom@ericsson.com> <20240916105210.721315-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: AMS1EPF0000004E:EE_|VI1PR07MB9849:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b4f6656-c95a-485d-5d9c-08dcd63eec39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?B?MFJ4YlVkYlZmbWcvcWZ5RnVDeUtLQjFIVnZzc0NROU1vWVkzTkJFQ0NGVmVD?= =?utf-8?B?ejBENkh6R0toVUdJempFTHVlQ2Q3VVRBV2xYbDNnOFNIWXQzZjhmZWhuNmVs?= =?utf-8?B?MlNjS0RJMFVtZEplV1p3YkZXRklCeW5QYlZEalRIYWY1bDNaN3c2cmllWXdp?= =?utf-8?B?SDVMalpCQU1hZHhVV05ndUV0aUpRYXJkbEVrREF1Q1VNSHhUSDZWTXN2NHNo?= =?utf-8?B?TDczSU5lQWUvN2k1bVJxVkJJaExWUEdqT3YrQnNLRVl4czNQMWFGdXVEckxy?= =?utf-8?B?bVBidWx1WlNLKzhXcjA0OVJlUi9RWkE5cDRDUDQ5WDdqWDRIenZhZCtaODBS?= =?utf-8?B?VEJvdTV5VGNDUFBKUndjTFFwL3VUZHdVNW45OXhpazRWWHlWZWNydFpsTjkz?= =?utf-8?B?T1p5ODBIUkNXRTdWMk9oUllESUJMbmJEUFFDMWUrRW5CN1NhWWFMRjZFQ0V4?= =?utf-8?B?VjlzME1scm9VbW9PcG03UUl2SlpNcE1kOC8vNk9wcDI1a0NEQURIRWlkMXNQ?= =?utf-8?B?Sk83cEl5RGRFMzZZSGN0SUN0U01jem4zVE9TaVpPV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ZTUkVZR2RSeDRVaHpFRWZncW5FM2loUkhxRFhES3BGZlpv?= =?utf-8?B?SGd1S1R3R2gxa2MwZjIzYzVJWlU5OUx0dnRYck1rN3Y0NHlOaHFaY3R3enJi?= =?utf-8?B?M1IzbjlxK05uZ0ovYU1MM2kzV2x0UU8rcVZDT3dnRlc4Qkt1S25OSFpwY3Ry?= =?utf-8?B?akU4dVB2MU9sQTExMjZjWHN5ZGIxSGZEYXlJOWFQVFEzbFBlVmswaXhBKzhv?= =?utf-8?B?NFVMUHZxSzI2L1dlVEhHZ0FjQnE3ZzBLT0Q2RjZhVzRqWWNobW1HN0RORUlK?= =?utf-8?B?bjNnUy9yNURDN21HdnRIc0Y3YzI0TElYdS9IOXp6U1Z2Y1dCMjRyRDZOeUN1?= =?utf-8?Q?yENAX80tOGDnRy1vxOUPrfnLOFSL0rDVKsrOk=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)(36860700013)(82310400026)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2024 11:01:31.8485 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b4f6656-c95a-485d-5d9c-08dcd63eec39 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: AMS1EPF0000004E.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB9849 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 --- 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