From patchwork Wed Feb 28 10:09:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 708 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 323EB43C1F; Wed, 28 Feb 2024 11:17:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81B4B40A70; Wed, 28 Feb 2024 11:17:24 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2081.outbound.protection.outlook.com [40.107.22.81]) by mails.dpdk.org (Postfix) with ESMTP id E69AF4003C for ; Wed, 28 Feb 2024 11:17:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F0PET8AFMxQj/Tc2H+tswwS02rJDTwCUpM8K/ZQj4K1lSm0WFAiyQla4DZNhGa9nzuL+LnluBg4xHhXQWDUZEXTs4blkSeUXhOcvP4ZVeGoymULxDVjoexdLcnOCfu7UFCNeHz1WQ5/omkKWV6pMNxsWfR99C5LSecN8eJYyTtNg/DBlfZfo4yDRLREABatPrTEUqFMmayfzHGuvEPZ94bn5cHU4bkE0P0SFG5SP5ooHmVQdzr18zQp/L6kgwKSjpIY3002ks8v7CV0t0rlJSbIBxLn/9BOlBgRJucuZgLfs8NwSWq6yrMIjTCdUWhIjq/37wR9eIfOfaCDBfEbA1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=/rDjkSCyerK9Ow9I6cMgTl+Db3PG/ggS/rdgARG10kA=; b=UHamZ//TuSQFTgt/v+gn7agxXQ1AUmIRXb69d621UQ6vR6oxeW14NhUamnPvyEE2xR6K3AGtaI8pCOqZBxyJZiNaZJxIVKAuz8A3vRQ8RCfuHabhFfc1PmFcRdZG5sKDbBDtLAtxTlJ4uc6R0gaN2k9gHOimnWhm457E4uRByruAhTcXkCZXtuSkIO2FcamOhZiZbhIPKBHTR02KnHNgtuWx7k3MO7lGrhQVMZB4P77rBYCSnTgN4YBCmJHcVakF6SiDcnLxvGH+DlLF3GjRjMrl7hEIOzEUQ+6ZlX7QxwlMeOIvVRr+wgarB+9QzkWfPJWBvzRiXzQiDi4wBIxskw== 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=/rDjkSCyerK9Ow9I6cMgTl+Db3PG/ggS/rdgARG10kA=; b=XZjy68typ3XJFCuzuAssvf8wo6oj0Shq4X5BT+2w/gCwzEC0El5PkqKVJXk+plBiPDaC8HR5Tk/4oY9cf9TPWR339A0T/Zcu3ZrIV7+PtBGpuSQGtnkjSrhi2LGefb90w/nkpE0g/kDmaOY3jGgY/8nWmzZsVqY7ShseweNUvPpDIXA2/uo8KsJKajwh2XwlHW3xkFEHdgN0CjMvzOXS4Td24PPic6inRkbgjIquKVm9ye/Yl7nOaWww8GzoptnCr8PmIFaJ3M3SKABnU5+fqFzCKE+n/z8c8BAwX4Kz6CgwhZ5AMWAKPLovw34YFyi0HydH7Rs2QTK+rmMO3YdMxA== Received: from DUZPR01CA0083.eurprd01.prod.exchangelabs.com (2603:10a6:10:46a::19) by AM8PR07MB7604.eurprd07.prod.outlook.com (2603:10a6:20b:242::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.39; Wed, 28 Feb 2024 10:17:20 +0000 Received: from DU6PEPF0000B61E.eurprd02.prod.outlook.com (2603:10a6:10:46a:cafe::f4) by DUZPR01CA0083.outlook.office365.com (2603:10a6:10:46a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Wed, 28 Feb 2024 10:17:20 +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 DU6PEPF0000B61E.mail.protection.outlook.com (10.167.8.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Wed, 28 Feb 2024 10:17:20 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.68) with Microsoft SMTP Server id 15.2.1258.12; Wed, 28 Feb 2024 11:17:20 +0100 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 26986380061; Wed, 28 Feb 2024 11:17:20 +0100 (CET) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , =?utf-8?q?Morten_Br=C3=B8rup?= , Stephen Hemminger , =?utf-8?q?Mattias_R=C3=B6nn?= =?utf-8?q?blom?= Subject: [RFC v5 0/6] Lcore variables Date: Wed, 28 Feb 2024 11:09:22 +0100 Message-ID: <20240228100928.524277-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240225150330.517225-2-mattias.ronnblom@ericsson.com> References: <20240225150330.517225-2-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU6PEPF0000B61E:EE_|AM8PR07MB7604:EE_ X-MS-Office365-Filtering-Correlation-Id: 19844a47-c5c8-4078-7f76-08dc3846730b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9mZtjG1hEZgeMW8EGEM/lxIoWrODE/zEbPmYg9GhUNeYqspw+Jj0m2Oj0lOHJw36WwWHoSljqpPRVknYuHPiSe9+o0khjQwJ/RMbLiuP0ogTLCbC/pVLlnZR6DVcPPsDPAuihECZGj4AHngGT65ZfSbIn3dxKoWTSTz2Z2CE9FYSDo0x9nGHjw/+92CD1Jd2Z0sQiZHtltXoxRfTGAGKMhc1Sf3KuksUb6W2ZUXS8n8myGjUGPtkyub+eA0yJgoZ0rolWfcWwAVmrDj93HGJI8ireIrladCr6FSaEkMoG8rCSbPyK5gfewmML/hhmNicnvOy6OES91ahQaHRhQOidaP1nTFNV2d++UoIoXRk9xW15aXN5yINPQpeWUfH8t1hRb1UdmSmWBsoVJ1Hg7yp3fDTh/lSWDuCGf83JKZMjE6e4+NpQUxuOydcSQL1Rx4oT6znylWnOcV26g6JKQO1NoeNuCOzBhGh1nMxyvN11YRt5+EKUyLP8hDYnKJPerEvpQqVmNkLJClCQJ/KkTwfH4yyMKZ/7oTvQAWTooHLyYGQwnMYF+M5l34f1X0mxSwg9gZGbA7SSidnUzEmaqWoORods4sBsJFtjAHV509BiHT+9VDhLnkZvovWIgrVSy9AyXb8FgyzoU3gOvsZQZ0H5e1vkwxHn/zzh5bbOK4CM4Ol0pkRf4NaAWBtyEjIxK8FP1DeLcqlJC8FvVY63C64zCfMfwLjsym5nZWL77dZiL/4uuDGGDpzpMBw4/RSm0R5 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:(13230031)(82310400014)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2024 10:17:20.7829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19844a47-c5c8-4078-7f76-08dc3846730b 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: DU6PEPF0000B61E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB7604 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 This RFC presents a new API for static per-lcore id data allocation. Please refer to the API documentation for both a rationale for this new API, and a comparison to the alternatives available. The adoption of this API would affect many different DPDK modules, but the author updated only a few, mostly to serve as examples in this RFC, and to iron out some, but surely not all, wrinkles in the API. The question on how to best allocate static per-lcore memory has been up several times on the dev mailing list, for example in the thread on "random: use per lcore state" RFC by Stephen Hemminger. Lcore variables are surely not the answer to all your per-lcore-data needs, since it only allows for more-or-less static allocation. In the author's opinion, it does however provide a reasonably simple and clean and seemingly very much performant solution to a real problem. One thing is unclear to the author is how this API relates to a potential future per-lcore dynamic allocator (e.g., a per-lcore heap). Contrary to what the version.map edit suggests, this RFC is not meant for a proposal for DPDK 24.03. Mattias Rönnblom (6): eal: add static per-lcore memory allocation facility eal: add lcore variable test suite random: keep PRNG state in lcore variable power: keep per-lcore state in lcore variable service: keep per-lcore state in lcore variable eal: keep per-lcore power intrinsics state in lcore variable app/test/meson.build | 1 + app/test/test_lcore_var.c | 432 ++++++++++++++++++++++++++ config/rte_config.h | 1 + doc/api/doxy-api-index.md | 1 + lib/eal/common/eal_common_lcore_var.c | 68 ++++ lib/eal/common/meson.build | 1 + lib/eal/common/rte_random.c | 30 +- lib/eal/common/rte_service.c | 118 ++++--- lib/eal/include/meson.build | 1 + lib/eal/include/rte_lcore_var.h | 368 ++++++++++++++++++++++ lib/eal/version.map | 4 + lib/eal/x86/rte_power_intrinsics.c | 17 +- lib/power/rte_power_pmd_mgmt.c | 36 +-- 13 files changed, 990 insertions(+), 88 deletions(-) create mode 100644 app/test/test_lcore_var.c create mode 100644 lib/eal/common/eal_common_lcore_var.c create mode 100644 lib/eal/include/rte_lcore_var.h