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 C6E4943BD2;
	Sun, 25 Feb 2024 16:11:56 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 3F684402CC;
	Sun, 25 Feb 2024 16:11:56 +0100 (CET)
Received: from EUR05-DB8-obe.outbound.protection.outlook.com
 (mail-db8eur05on2050.outbound.protection.outlook.com [40.107.20.50])
 by mails.dpdk.org (Postfix) with ESMTP id 36C1540270
 for <dev@dpdk.org>; Sun, 25 Feb 2024 16:11:54 +0100 (CET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=GCkAGUq9z2cpV3NNpGZc49V4pq0nNhxe1Cy8pOQ99OfTO49pzd8z/YKue4HPr0+r62xf4plZYkqiwJXOClRFuBuA5w8QIzy5cr1OPHQSO4TYX4mxJQ64bZbfqEEC/g7RjEsQ8tCYQcf34p88RJHsJo454gextxy4wfUr4gIQHHHxqrX2UoAktE/rEg7Z3EFy8NI7D+p9s8MiRbXH1vOsGPljtI4Oqgvm/Sg9eokiMdPehpDX8yAZzO0sROZ3ZacKTNzNXs6ZQWOgGTBwDC31DAQZIHXQiitSU4BO47J7l0GsszI3x9Hu+yumv9u62CJAY/S1VGcC1VGBcC+kTfpIiQ==
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=+iraWBlkEbPTYy7kWxubHnGWm7LrSpMQkEySTEH/1kk=;
 b=oFfokglMimtyckKlOefBBTIzKk0UVftDvD0T20VPR8Yefiz2xbJyJOiHBc9h14ryVTq9aILbxl1+dttNrhB/ys6lBlFIbA7MSUdiEnj47Ru00ei7gKk53nARwfRhyo87FD5tY/ss6nZB+nDWaDfCcJTOfjj0QnyFlRxut5sIDeTI4Pj23dfnFONF/YDs5E0d6abRcZgwhWRJvq+kTMr6psmvfTq+IDDhcHxBTinC65B/CWhjjV+OsSAHkSDidoJnaBjx/OnzACVGdmj0uCeYGv5Ixi+t7gZGi7B3zhNhB+Ey7akvdlFwRa5JMhEBSpz155UG6Cd09dlfNbjosuZsSg==
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=+iraWBlkEbPTYy7kWxubHnGWm7LrSpMQkEySTEH/1kk=;
 b=DBqHLwjxe92HubrQV0Qa0VMN6+aJFmPegg1o4/InBhNiZPruZPXEBjChgN+S5LXI+I3OPC2imzIFB/DyHBhdoKxlCWlXi9T5fiLlE4O9oyUxNvID44/NncOmVWcQf8Bz2Qb1cYOzC4WY/x/bSZpYjA7fcWHT6uUjm4x2laUVUMPxabbR8HaY/0dGdqNGy0QmMv8gRu2nR0ZvJPA0zm+L0ihj/dwGDI73ru/TOTrkwUsePA8tSQrXJW6Y+tzftahyFHik9QNAwJokNBIjmkFim5dJBmVnb0iz4W8l7BjswJZ6r100o8kWOf+9sH4DrzuAixGqBZ7uSbziRLHckuyRnQ==
Received: from DU2PR04CA0353.eurprd04.prod.outlook.com (2603:10a6:10:2b4::13)
 by AS8PR07MB7525.eurprd07.prod.outlook.com (2603:10a6:20b:2ae::24)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.29; Sun, 25 Feb
 2024 15:11:52 +0000
Received: from DB1PEPF00039232.eurprd03.prod.outlook.com
 (2603:10a6:10:2b4:cafe::b6) by DU2PR04CA0353.outlook.office365.com
 (2603:10a6:10:2b4::13) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend
 Transport; Sun, 25 Feb 2024 15:11:52 +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
 DB1PEPF00039232.mail.protection.outlook.com (10.167.8.105) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.7292.25 via Frontend Transport; Sun, 25 Feb 2024 15:11:52 +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; Sun, 25 Feb 2024 16:11:51 +0100
Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100])
 by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id
 BD861380061; Sun, 25 Feb 2024 16:11:51 +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 v4 0/6] Lcore variables
Date: Sun, 25 Feb 2024 16:03:24 +0100
Message-ID: <20240225150330.517225-1-mattias.ronnblom@ericsson.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20240220084908.488252-2-mattias.ronnblom@ericsson.com>
References: <20240220084908.488252-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: DB1PEPF00039232:EE_|AS8PR07MB7525:EE_
X-MS-Office365-Filtering-Correlation-Id: d2e4dd8c-19dc-4ca5-6ef2-08dc361418e1
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: CTSwydwT40YRv4R5z76UGIlmxvJOrgGcGqQUqCh4fHpStPJsrMtPCnH5njxn8/6ssUwuRlTeGNVxmxWYmgqm96/IzjxFx3bG2ZkzBe2BBFMisGxeX+a55L19VMF3+Ftb9dDhKKdxHq1JFrq9enfp1OB6dqR5udpEtH47o+okokzBbYMGqIbB07QqktWIlsbYDpWDPLZDZ56CjN1Zd2TEwDpNc9T8WHYoWUnnewLRPPk/3892SiT0ZHNV7tUFd+xx/j5Rj4KZTmBr6or6Mgo0FhRjjt7pfEm9ZGhKoIjD7w73uSGjNqwjLyEX0Egs2WonlE4yZzq4uVsTXmDuclxXMlLnUAX3bU0wi1LYCnX4glr6hpOHdQ8zg7IzgK9Xg8UJWt/WL7hgtvQYZIs3ujICPMm3n4X4ghxpigDDpiluKfOMVp5uEOGPJ4FIV02+WbAu7FiyXxau39fT9KjXnrKSPUWmq7om8pYIFro3EffaJKsmxQjNsWab2UHoJGy5OhSKsHQ5TrNP16FNRfq7PYYBdmPoK0tH1UlXtU3jji6XiPiRRD2hYwlnHv8EFidznqA4Asx4PcCZHJ9JDpg2R8GLkutgkgbCPKh8IiG05YNu1iAes5ETofXQwomb+WeVjou+YITlYn64t9G2WdWJNY18XxMaBwFySoMklWoEmkKXfGg=
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: 25 Feb 2024 15:11:52.3659 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: d2e4dd8c-19dc-4ca5-6ef2-08dc361418e1
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: DB1PEPF00039232.eurprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7525
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             | 439 ++++++++++++++++++++++++++
 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          | 120 ++++---
 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, 1006 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