From patchwork Thu Feb 8 18:16:39 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: 630 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 3908A43AE1; Thu, 8 Feb 2024 19:24:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C113D42DF9; Thu, 8 Feb 2024 19:24:49 +0100 (CET) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2055.outbound.protection.outlook.com [40.107.105.55]) by mails.dpdk.org (Postfix) with ESMTP id BA35340273 for ; Thu, 8 Feb 2024 19:24:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SjFLH474hFQLgnxUJCMg3vbNfpAys1yAJimnWSCsAeQ/NnmIj345bf4vNPBJc19kv49DhcB45ijWW6k1gPD7mXjOnRApBPNVMiS+BtU4bDpNXQjwMfc09BzZOfifZKz6hZ/D5xLbgPFWFq/tfSX4E8HUYm7YdvnlMRxDjhul/MX+mM6fqndOdUaDEcNefPINtWxzqX5ldmXQPgOmU0MPnNUZhPTTIV92r2yRFsd/529xG718WYxB6E0S9ei4lGDBFgywDWB6oinJTtuIwrpaA0FsbjLYFRl64ZS29y/V67qXxDNR/lyr9Pt6xlxqroYgGbcTWpcNINo8/opvglc/4A== 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=9rf9P0Fr9X2b0HvZhpd78GiZoMJl4nAzWWcjHxbJFiQ=; b=RIGmpsydExhzHqGPzFjb9zBn/T+9BjSOdmWd3xc4u+RhoZ1BJEJqKUSmcEGapPkuZv+mxtisJuwdI76RSJxKg2P6UhOE0SZizvgDdt9xxe81A3MIVMolrpA1iT5Zd/RbE7X/e1pSdmjIiDZQIlIZLQwzINLIbVi/5NKaCD6v6pzY+xLfJeM4ofnr7nokIUuElfPRs8YFyxBpmhkK+15vv4b5SUGdsf4E7q89CUTscSD/oD6rfZsAERi/SQFNMDWbYkikR4032CF9pYOAan4ZVZ26G8Ok+RwOCxp0Dw8lWM3Oq6rL+1EXwegEj2p5z1i3iR+FsZZjK932qf3OcEHL6w== 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=9rf9P0Fr9X2b0HvZhpd78GiZoMJl4nAzWWcjHxbJFiQ=; b=E1cWUVaGtikJacFeRxl/Yh4YnzMUeEv7yawYXX98cxK2+ot2wEiQi03b+y+ZKlJ6HF+AViIeqUloc989x54NrJsUABIs1MLqnMidk4fbwVGbzpKDBolWrFzq3L2P0mM+mwhSbBeeR5r4fOIJqEKfMdEk8mSjIUxek+ditkVqn7qRTq5V/gvpdoUYROHp5/7wDklhAsSjca2G4lk/q+SIFqOmx1cHsxWAez2+lKjgYqjGAWiiWVDr2RDa9X6E6THZqVJ7ZUT2e5R18yGOUJUAvDV2646oNU1iX5MKyrfYSc1m7SdeMPYto3nbZV2+IYlKl0ZiGIP3nfEU0DD3hoN2mQ== Received: from AS4P250CA0025.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5e3::15) by DB9PR07MB7915.eurprd07.prod.outlook.com (2603:10a6:10:2a4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.39; Thu, 8 Feb 2024 18:24:46 +0000 Received: from AM3PEPF0000A794.eurprd04.prod.outlook.com (2603:10a6:20b:5e3:cafe::e0) by AS4P250CA0025.outlook.office365.com (2603:10a6:20b:5e3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36 via Frontend Transport; Thu, 8 Feb 2024 18:24:46 +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 AM3PEPF0000A794.mail.protection.outlook.com (10.167.16.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.19 via Frontend Transport; Thu, 8 Feb 2024 18:24:45 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.67) with Microsoft SMTP Server id 15.2.1258.12; Thu, 8 Feb 2024 19:24:45 +0100 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 5C1E6380061; Thu, 8 Feb 2024 19:24:45 +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 0/5] Lcore variables Date: Thu, 8 Feb 2024 19:16:39 +0100 Message-ID: <20240208181644.455233-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM3PEPF0000A794:EE_|DB9PR07MB7915:EE_ X-MS-Office365-Filtering-Correlation-Id: ee02908f-4b94-4512-a528-08dc28d33a32 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bkg3QCQ02jT3fhX498CiDvFVtZz3NVVpvwtr7UxcIMb4TiiU8Qe8LWYAWtvE1RIvqINM+9dh1T+k3Y1CKOBkJrsdMHtUfVa3IEovL2bpuAy5JOBEYwR9SSXHY71zq6JBa5/4q1rePi2Kg1b6OZNn72l1CqML1ph03jZx6dBjTqfnNbR24AEIKGkb0jvjPsM+W8i4xxqT1EUNvqDPDnisS/ZoJjcEtBRxoPFCIRCWr9brrqLWhGU5d4ooKOayz5fiDNQIsIWVWll6XWfa+Q3QdsFakkd79AZMFuCoA8tpxI1RdO0fMoyyIQ4QzBw9sTbxDic1p0eI96Sc27wyKb8aFH1GCt4kHrNCnTSuQwuuxDhbOrA8SZfhSSShD/wrDJBm/Ha8qr2WHcvDDuCklWJwYByC8zEKbCU3Dt/hTD0kFZ2EwNySaiBJiv08gBPvUEZWLpTpmTh03qwIPJYu+gKcEGYHs1sOUYGizTkt+ONtmRcDmKc46aRaS0xOA0qYoDi4pCOaiBwjj2LVsW5pHXR1qgOeKJGwPe7tp4IF3geZTsx7yGnAwkukmlTGEvGeDrCWU7jezni/rBPBuuqEgrqz36z9VEQ6+RNkb3HDS3bUqhA= 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)(39860400002)(136003)(376002)(396003)(346002)(230922051799003)(451199024)(1800799012)(82310400011)(186009)(64100799003)(36840700001)(40470700004)(46966006)(1076003)(2616005)(107886003)(86362001)(336012)(6266002)(41300700001)(26005)(2906002)(5660300002)(478600001)(316002)(54906003)(70586007)(70206006)(6916009)(4326008)(8936002)(8676002)(36756003)(6666004)(82740400003)(82960400001)(356005)(7636003)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2024 18:24:45.8907 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee02908f-4b94-4512-a528-08dc28d33a32 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: AM3PEPF0000A794.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR07MB7915 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 | 384 ++++++++++++++++++++++++++ config/rte_config.h | 1 + doc/api/doxy-api-index.md | 1 + lib/eal/common/eal_common_lcore_var.c | 80 ++++++ 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 | 352 +++++++++++++++++++++++ lib/eal/version.map | 4 + lib/power/rte_power_pmd_mgmt.c | 27 +- 12 files changed, 925 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