From patchwork Mon May 6 08:27:15 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: 914 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 D4B4743FC4; Mon, 6 May 2024 10:38:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53417402B9; Mon, 6 May 2024 10:38:23 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2075.outbound.protection.outlook.com [40.107.8.75]) by mails.dpdk.org (Postfix) with ESMTP id 4EB8240270 for ; Mon, 6 May 2024 10:38:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M1+Trca14r1oz8tivHyGWw8sYQfucjmwXzwpafvppv2IoBWTBLDHLe61yrrkmE8EA1CvMNxjJiNGY1j8woDWl9J8BRMI1U3muHZH4mWbojpTx/jsFYnzDT4zf0epP9GB8p8Qrkf7Wqn7SLFyeaUjrvcswiQiEZ681iiH2+4lH/OMIwUcJ3xNO+YqGgZvctxuSA6SU/tQw21YHVu2DshHjUT0GPqT8wuhBx6Xa4ziru2SyOi7Zlz+3ncLcC/oiSAKQu1jNtdHYyGaWAZfJeXXzwlFETiSZCR7pwvhfkWbo62j+rb1UJS+nyYHoboR6+HSTKdf5b+ESXUoxEDP4VdrNg== 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=Lut4OB2YWNLscV0dbr/9KAZii4WWX37Ll5Wfal6HjF8=; b=HTArpoufQaPlEahsDAo3/eJrPx6IpFq/una0GnljZoNg9s5pDfFqwC88fgEsO790YOs24Akot8M7Egfo95ZUK3GoTHXqs/LMI+eITHaUd98gi+nP5TZDYHJZi9iBmsUBO1gISdceQQuk0i4u0W3v7RQVCkbCQ41kaWuxkkIOgkA/Xy245lBEbB+uvu9T+8RCo6kLie73IbcNRRnrUgl+n2xuxSpWgAbu1WPHMOPXP9NI8VVxnOb+o+NAbte3qReEZ4UGBMdJewjeDe4BbQTeyLMijflcUlN7Ujv06uN0ovOJIeH/Up6HAy1wd7cfkyFe+z2NATXwicYVjx0auwLKhQ== 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=Lut4OB2YWNLscV0dbr/9KAZii4WWX37Ll5Wfal6HjF8=; b=STcAkHM6qT3V/raff54MuXmwvQ52SBBVgHJ+vhwtiml+RO1WSSjcgJx09YuqHjnYB188tcFw7x02wmXCfsvjJkTInf79ze0l7grgt7PmG8ec5AlbVNkDipa/8GEEQvouP+TY7mFEtfoEvxV33YqAYo5KS4R+f2hBk6L+5WtIzH1dUTHq1pEg8b7K/sgX5fXw7WKDlUbVSYLJ3yRTxxfyfbRTQJYrqRMNXk5/BTP4WYnIypZVtMYA5lA8hNKiOGiWarWB0zMElr9phQXEiZdbVakqmAkI3HH5vSjhdDPN5az+2PmMlXlYV9zfUpK0BZlGqt7Ni4q6nnkgzdYQWxaQxw== Received: from AM0P190CA0023.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::33) by DB8PR07MB6410.eurprd07.prod.outlook.com (2603:10a6:10:13b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 08:38:21 +0000 Received: from AMS0EPF000001AD.eurprd05.prod.outlook.com (2603:10a6:208:190:cafe::c3) by AM0P190CA0023.outlook.office365.com (2603:10a6:208:190::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39 via Frontend Transport; Mon, 6 May 2024 08:38: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 AMS0EPF000001AD.mail.protection.outlook.com (10.167.16.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 08:38:20 +0000 Received: from seliicinfr00050.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.64) with Microsoft SMTP Server id 15.2.1544.9; Mon, 6 May 2024 10:38:20 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id 8E8FA1C006A; Mon, 6 May 2024 10:38:20 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , =?utf-8?q?Morten_Br=C3=B8rup?= , Stephen Hemminger , Konstantin Ananyev , =?utf-8?q?Mattias_R?= =?utf-8?q?=C3=B6nnblom?= Subject: [RFC v6 0/6] Lcore variables Date: Mon, 6 May 2024 10:27:15 +0200 Message-ID: <20240506082721.120666-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228100928.524277-2-mattias.ronnblom@ericsson.com> References: <20240228100928.524277-2-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001AD:EE_|DB8PR07MB6410:EE_ X-MS-Office365-Filtering-Correlation-Id: f63da6bc-c4da-4afa-2da7-08dc6da7e2a6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|36860700004|1800799015|376005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?VoCbhDMqyWmTHEBgeWQ7z04AnCbbBmH?= =?utf-8?q?LDOy64s21Z1WuTCBsgXOGxYh8l7MJGO8OkpFmvVw8ZQoSUFC0zqDhbusXCXSAIYQO?= =?utf-8?q?i9zvzVcO/e++ZlRDYT0THVLlyCYsjz/qMLphutUfza3vV6L+GOguIq1ISa+dyph2B?= =?utf-8?q?oy7I/ZDVKaFUoW24Dkn/V7zQWGctKfaSPWB365SKSzomrRr60r9Vh5sAd5NRWGLlv?= =?utf-8?q?s4xHRsZ8a+CLdB8l54OF9/gwIBe/x4N3TwViAGIM8hMs89TUilvTX0QdyT+xlnGSq?= =?utf-8?q?8Y3OcT0KGVSlAIXL9GN4sLGpDto/G6dFKTaCdUc0v3qJpbzHwSQ7inekwmFENflW+?= =?utf-8?q?/0oZVctaGsecDjmjz1touyuNZoEsJyqj6XvDLCwEtzUomkzXlsTHdjz/gRCqaGt12?= =?utf-8?q?PaQE0O2AE6FhfLWsFT6JbOlSPjQPpkbS5yzv8ULLMrGoYs75kmib//9iTwP2i43kc?= =?utf-8?q?ABxPH+yBFbyjmz6KzK0dRAVrF90LbW6kHlvTmGZ9a3IF6Qgjkd9Nit0qlTWk4KAex?= =?utf-8?q?Rj8vQjWe9R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g.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230031)(82310400017)(36860700004)(1800799015)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 08:38:20.8650 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f63da6bc-c4da-4afa-2da7-08dc6da7e2a6 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: AMS0EPF000001AD.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6410 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). 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 | 69 ++++ lib/eal/common/meson.build | 1 + lib/eal/common/rte_random.c | 28 +- lib/eal/common/rte_service.c | 115 +++---- lib/eal/include/meson.build | 1 + lib/eal/include/rte_lcore_var.h | 384 +++++++++++++++++++++++ lib/eal/version.map | 3 + lib/eal/x86/rte_power_intrinsics.c | 17 +- lib/power/rte_power_pmd_mgmt.c | 34 +- 13 files changed, 1000 insertions(+), 87 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