From patchwork Mon Feb 19 09:40:31 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: 656 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 EE65343B4B; Mon, 19 Feb 2024 10:48:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B7624402BC; Mon, 19 Feb 2024 10:48:35 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2065.outbound.protection.outlook.com [40.107.21.65]) by mails.dpdk.org (Postfix) with ESMTP id 41D8A402B8 for ; Mon, 19 Feb 2024 10:48:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mccGEWMcryHev/cv/+WB7d8zppb0vCedtb/g+b1rpQHgI7i7JQA2MwKlCnhJGW3xHj8s0EUBidWLS7cZ5P8IKCOhvk22YQS09Nvh8SPrTpqgnGNTmcRA1hjIHqaslqqB3NXiPI+Td4PbdxRozEWD0HISWR8VPmqYbGU8w1cMfm7x5T/VOk5RUItt+WinUic+VdLDJxi8+hEmoMvGRh+wk6cCLc1pDSz2XHtrS4NfBjQxQY3xdasy9DXzuPQu8BUx1Cikah8Qd+fKm+GpEqsxh+COGH4NFicnYi6QolcLYso+EFovWsLfytbU52piYT2HN9JjmVqqEO8Gf005tSPUnA== 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=bEIAkzjYyrotBFAzsGxXye1VvX6mQAQVMnAmrFP75tQ=; b=GwtEPqVkQOINPZKd87y0Y375I4Az9tE0Zt2Plbe6HjyEM1uSf+nHhh648Ox/fVhY0/At0K1lkFo0+HWqvdIuWSWIotSJrxc+/+PZJ6nY/KNjU47RjoGh8fT0KQwD1sYgfVsy4reRxEo0DAosI4odGfguOACHtPxDvMdn7FnAVgjf0q/W/+9y8/67x4L+g8GopNH5KvimWAhGyDysy8Yp4OM/TgclmFagXHzltKeYcSPFOyWU3rKja8pwM/iq/ERTRie/Vbre3kD8lgDe/B18HNTcd4xkcpgXHvYWnxcwx+zUJAsnYqRhuBmu8tIoYJ0uk08Er7zO+WUlcmrmQiVxLA== 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=bEIAkzjYyrotBFAzsGxXye1VvX6mQAQVMnAmrFP75tQ=; b=o8klg93U0cI+FJsutBPsSGVgutXzT9vrQi9LfK+gAZtuusMrZDbBngr4c8LUIlGmzqRFNlQfI1M1Fn5GrkjSTTJNw/qR/OjZvMat8PKY3Ty4YaVB5oxVj4Z/1Sft7YdgTlXExD02zYtmQsKUmf8UWVzqgEgZX0Do123A+EJC67sfhtNX7oLk9t7WG3cryG1vntNo30wsjk9zyo54oE+wEn50oNxJk4/TGS7eebAPqvhCTAXtXRiNnc18+bSpD3CXCe4CN9RI3YH0YkiBeBjPYUnWgg5aKRwSiwaMgHo8wwMiPIBHeC5EcuapXEs1Ub8cEPTiyF3kz31bFItyF0Umzw== Received: from DB8PR04CA0006.eurprd04.prod.outlook.com (2603:10a6:10:110::16) by PR3PR07MB8181.eurprd07.prod.outlook.com (2603:10a6:102:174::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Mon, 19 Feb 2024 09:48:32 +0000 Received: from DU6PEPF0000B61E.eurprd02.prod.outlook.com (2603:10a6:10:110:cafe::8d) by DB8PR04CA0006.outlook.office365.com (2603:10a6:10:110::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38 via Frontend Transport; Mon, 19 Feb 2024 09:48: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 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; Mon, 19 Feb 2024 09:48:32 +0000 Received: from seliicinfr00050.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.60) with Microsoft SMTP Server id 15.2.1258.12; Mon, 19 Feb 2024 10:48:31 +0100 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id C39DE1C006A; Mon, 19 Feb 2024 10:48:31 +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 v2 0/5] Lcore variables Date: Mon, 19 Feb 2024 10:40:31 +0100 Message-ID: <20240219094036.485727-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240208181644.455233-2-mattias.ronnblom@ericsson.com> References: <20240208181644.455233-2-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU6PEPF0000B61E:EE_|PR3PR07MB8181:EE_ X-MS-Office365-Filtering-Correlation-Id: 761a7cd9-219f-4e13-8aca-08dc312fef1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F40EgBVQvpmWOz7F72tNws0Ye0ET4rZUvwEjFCumeFAzjcJEtgN30F86ITeaaSzO3QLkxBtK4gCS3VPeRBMzlgzoonde8sFbjwroaY6cl59vWa2tAVRSpIqTWUcsHlWP/oY6rYOWtlsRUkZdTrfsMGr7h+PYfws4pxy/rwGuNk2mxRPB+Q3p+PB03/5yHl1SWNDgfAIJfOMeX/FYSmn0LTSOFpqkrcQxdiy5422ApwV7qe77kt5gnW9RF/bFOljOiDU4kkiFnWe+yML1hJ4UiT3Uak5tjAKsNit8uM5UPXQAF/T4m3O/PqUOa8JiGn+0Bm6DvPpoYXHN9BmCu1fUZDfxmHvE3My7b8uzHeYaKjD1YWg7LP1wLFCnQG5xQDBQisAnS9u/dEEA1xrjNYGhhvwtqAASYAeUBkgNvwXKB+yryaSRGuF5qDjiXMl38S3THBB/p3RkOmdzscKn3OSr4KWJ93lo25XKBzmXRb/xHdchulXgCcR6Ou+H+gYtt78ubKignyeHKhdLepVTUChaFvDIXfzTEawLfeHBwKS6KfobLV7UiP4oRRXfQAVgk/1zRg8oGbDp2eh2P61DE6zP1i8IhEfwSqXVF9h15V77nLsg4HQL/8mQ7FYlGkfTWEVUxJK8a2MD9YEjdBeps0NKt0hTT0bF9OsMmuz2x6vh1Mw= 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)(4636009)(376002)(136003)(39860400002)(396003)(346002)(230922051799003)(451199024)(64100799003)(186009)(82310400011)(36860700004)(1800799012)(40470700004)(46966006)(83380400001)(86362001)(36756003)(2616005)(54906003)(41300700001)(316002)(6266002)(5660300002)(336012)(2906002)(478600001)(70206006)(70586007)(107886003)(1076003)(8936002)(8676002)(6916009)(4326008)(26005)(7636003)(356005)(82740400003)(82960400001); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2024 09:48:32.3744 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 761a7cd9-219f-4e13-8aca-08dc312fef1d 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: PR3PR07MB8181 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 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 (5): 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 app/test/meson.build | 1 + app/test/test_lcore_var.c | 408 ++++++++++++++++++++++++++ config/rte_config.h | 1 + doc/api/doxy-api-index.md | 1 + lib/eal/common/eal_common_lcore_var.c | 82 ++++++ lib/eal/common/meson.build | 1 + lib/eal/common/rte_random.c | 30 +- lib/eal/common/rte_service.c | 119 ++++---- lib/eal/include/meson.build | 1 + lib/eal/include/rte_lcore_var.h | 374 +++++++++++++++++++++++ lib/eal/version.map | 4 + lib/power/rte_power_pmd_mgmt.c | 27 +- 12 files changed, 973 insertions(+), 76 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