From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id A74C843B51;
	Tue, 20 Feb 2024 09:57:08 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 2B953402D1;
	Tue, 20 Feb 2024 09:57:08 +0100 (CET)
Received: from EUR04-VI1-obe.outbound.protection.outlook.com
 (mail-vi1eur04on2051.outbound.protection.outlook.com [40.107.8.51])
 by mails.dpdk.org (Postfix) with ESMTP id BB4284029B
 for <dev@dpdk.org>; Tue, 20 Feb 2024 09:57:06 +0100 (CET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=JSkEt+IENHHD78Kqu+QUxoalXoIAj4tQIjFqlNQtZ5FF0NKXkg+sfVbHA9zL/uzg9IUEQOsyBvEZU7zI/3NlSSKQuRQounfIxQuwezSpEcwXoSXNPJcSpDJp5bIRvWkM0SKs0ik6H2Qnqxfu8eR6UA5QrKZXu5cdxw62cmMWhD+XZ2hfV4+TBAkJkFMEzYGMxR3JvbjVAA28y2BIdb6plwL/4ul3+reqVuaSBfBpdcYJquDL5fO2WPjQAy2kujil9mSQIVAguPcWP7pKgo6o++EfwCxx9jNnzIsLj1WW1Px0YlRxKvyhi5j2PWVgLoF/s00GXdke0kmkZ6hu24K9ww==
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=VbT4oQvAjx2ElXiZxWaRkyW4aUc3mfVJyokgxYehM6k=;
 b=iSMZ6AedYIm1ESDwxNau5xvKFtHRTiSl84vft6OvFTu1ROJjnOkQEYdcaJRF4/LRJZ+yLpoaRk9vI8HswOEqfom220nlTkPrbHT5ptbET0sOY1doWS+cH6Zuw9b3zTplxy5xYBB83cnJMTQ+27BObrmr9JqAPY92W9frNBJtcY42rDDfFuQy3Fw98rPcqT9G/DIY/Mm4dHnh1YVliSCCjObbsymbtERPWSyz4ngE54Cuwglexy5G9Z6G1fXgtMIyMB5QbQ2wKhkxrxOP9YVyTUEAWfS2vCEOUtBW2cvKozOXDigO06ANASb6cJ/LTqldNevEy+54oyh//ONemd0p2w==
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=VbT4oQvAjx2ElXiZxWaRkyW4aUc3mfVJyokgxYehM6k=;
 b=L92iqbFksCEclsgYaWXf9qBr7g+JFaujQVuvDiwI8a1Nnmj8JO+qi8zFohtzG/IVzNxMZa54oCuesf9t1g033EdvQBFRQQMgI1U3l/K/s3U3YjAtf7TS30JDMjZUQo2xhvVOen6ivZocNm8o/8qShz8lPfc/l+8VatStHiJzT0lpgO45FxHuiBEbigdzdLRbe8bUWpeVi0ObswfL7RZ2tzFYQiFMBh05mg9vPXnrz2uHfPVSM0TdYppT626eV6HRfdKtmJCaw37IkMfw+yMthHhExDljZn8oxLwRdSnKaeuq5Kbrhhb6Ut8DrNS15UYEpeOI+qBsFwYpi98UKu2PTQ==
Received: from AS8P251CA0009.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:2f2::34)
 by AS8PR07MB7319.eurprd07.prod.outlook.com (2603:10a6:20b:25b::10)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.39; Tue, 20 Feb
 2024 08:57:05 +0000
Received: from AMS0EPF00000190.eurprd05.prod.outlook.com
 (2603:10a6:20b:2f2:cafe::56) by AS8P251CA0009.outlook.office365.com
 (2603:10a6:20b:2f2::34) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38 via Frontend
 Transport; Tue, 20 Feb 2024 08:57:05 +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
 AMS0EPF00000190.mail.protection.outlook.com (10.167.16.213) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.7292.25 via Frontend Transport; Tue, 20 Feb 2024 08:57:04 +0000
Received: from seliicinfr00050.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; Tue, 20 Feb 2024 09:57:04 +0100
Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100])
 by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id
 39F081C006A; Tue, 20 Feb 2024 09:57:04 +0100 (CET)
From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com>
To: <dev@dpdk.org>
CC: <hofors@lysator.liu.se>, =?UTF-8?q?Morten=20Br=C3=B8rup?=
 <mb@smartsharesystems.com>, Stephen Hemminger <stephen@networkplumber.org>,
 =?UTF-8?q?Mattias=20R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com>
Subject: [RFC v3 0/6] Lcore variables
Date: Tue, 20 Feb 2024 09:49:02 +0100
Message-ID: <20240220084908.488252-1-mattias.ronnblom@ericsson.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20240219094036.485727-2-mattias.ronnblom@ericsson.com>
References: <20240219094036.485727-2-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: AMS0EPF00000190:EE_|AS8PR07MB7319:EE_
X-MS-Office365-Filtering-Correlation-Id: d61f402c-789e-401d-c397-08dc31f1e935
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: Bke9houadTSL+pthgACcl+RMqE+VXXTD60KYbf/kF4RLbuG5dDAkw6tDlaPMULkx7Qn4sOuxtvxpq76iO8oM4/7d8d0qLyWp6emGTj6wIgLUtjSUw+ZNTLlPnuWvUl3fxHduG+ELw5P7OP6CFoGCyJOq2iNA7aDnHC2XSU2ILxEMSYNh/KsrsBlFYybvTtBZlzuplMdQ3m2kZUqg7sp5/WrTNxhCyfkKsd0VRAAi5zUxMH9C1SGOklBxYz0e/Qptiq4SJQIg5R17bt7+7ajXGeIdLZgACL0h6wMdAHMU3QCLhLpXMz6Z9MDXUQ1c1RVFLzDBTOeyJL1ISFcFfftgXTak5GZruwIUR75na2r5h7is7+AuhxmRk3ng3qX0aYvEfTUPs0ZwdMJlICB4hs+qyxaVROzGPtOsqj+vZ/8RYiO15YMAb0vylSaHPo1rbKeDcPP+8Z+3ANXwzMpb5XkyD4chm0kYDblBskzWHr42v6FIYPC23JAKgtGHDRSHwS1O3yu6Yz38lS659by1Gp9zp5p+MjcQs2CGQeOGzOk+GYjAOGoE4veoJ5BDFZ+DQg1hzwTd7jzM0cRtxWWkaFEXFU1zAWfZvny35K6I96OwIJg9YwnDndZhTgmlukDo+gqfeZzN8n/pULV1zLbRp/aty28bgZfpEgrs5eANEEgjMVE=
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)(36860700004)(46966006)(40470700004); DIR:OUT;
 SFP:1101; 
X-OriginatorOrg: ericsson.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 08:57:04.8480 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: d61f402c-789e-401d-c397-08dc31f1e935
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: AMS0EPF00000190.eurprd05.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7319
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

This RFC presents a new API <rte_lcore_var.h> for static per-lcore id
data allocation.

Please refer to the <rte_lcore_var.h> 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 (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             | 407 ++++++++++++++++++++++++++
 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       | 375 ++++++++++++++++++++++++
 lib/eal/version.map                   |   4 +
 lib/eal/x86/rte_power_intrinsics.c    |  17 +-
 lib/power/rte_power_pmd_mgmt.c        |  36 ++-
 13 files changed, 987 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

-- 
2.34.1