From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9CD12A0561; Thu, 18 Mar 2021 15:48:05 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60248406B4; Thu, 18 Mar 2021 15:48:05 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.56]) by mails.dpdk.org (Postfix) with ESMTP id 5F30240698 for ; Thu, 18 Mar 2021 15:48:03 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=me86YPvW936TtvkS6qL5Cz004vnqZfQb1h1uWsV4GtDwGe7r1zy5cDfUcaKjfEyDQHOsA7kdB3r72qion9OCxIZ1oPL3JJxebamzsUcd+dKbMbe+0X4BiaJCEnRMT8tXDsCmVey/JgOWjDMmpVcBQFUt5c4d2AX3+22qFjc3wWEmL7HdvmnTMdQ+Kcmd9bhcTsPx8cREoF413WIzwPqE0gpM6MxTKL4EIQp9d8UOMlpNfnE3LgKyHQsJ4/xx+qp7nr/+NqVGlxL+ewKS7I4AEnCEMFzXDklTcJWYrQWeiXMvcPkx5BdW//bcsBEXsnhHpYZw+PSeshGEHHJyTfdqTQ== 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-SenderADCheck; bh=M7lVETOSMTuZH0j+afhFMKT+wOegY2Lvf9k3IiCxVms=; b=ncHa9WEMN4kedxPcT0QVmfnLX1oPmp9EX6N1m23zfWY5EQTyDFdxI17OgFx6zmBKeT/I+KnavKpNCHU5H2KEtej2Lh2yJjrDX989Z3TkQntV94ZvqyKQ8b/RAC+XEC507IHe9J8QXZ1m/0vSdbuA/CzD4a/zZkMOxEV3zcAkbXvzmAaMIkWG/hWKDPWQ2p6IzcUw5JwEJc8+fyQEFGtXRTrN3ORu9wXjCht8c7FoWX3cHuAwVh14QdMMvSJsFtrVR2Q+s+eYLnqMWn9AfzjmY5+sWhnIia1ep/SFbRijU76Ztc9BhPeoZZRYIPrgE6dgm6yIku5UBUBaO4vrhe4ViA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M7lVETOSMTuZH0j+afhFMKT+wOegY2Lvf9k3IiCxVms=; b=EQS1O8hvgi+KGrdugZncKF1vZJFkKFnK1eeFtGRM/QSv53EE+lBMdok1H5FuhknxpXLaBoqkd8wI6nWURE4VU2z4BCmVxgF+FFVJuBefBPk2N9Tue46Etk1YxNP8rtpulh8mkdAV2rLysHtYhfxzXzpnGhU+2RWyyaXREL7MbMzPPWcLBvHkpDro3D39W8I4QNl0cgKBGjPKV/d2+GkKTyPR/GrkEGoSJQvLaM5oBVytCztrYdluDsroWgUyXL/LMRRy2rE0YXsVaWZ7z6HvhouOkmmpWQiuOYlTZx6QWAAKDrPm8nA8nNcTQxf1zIChkZf162P8gXMY6CRDaYl6jw== Received: from DM6PR12MB3945.namprd12.prod.outlook.com (2603:10b6:5:1c2::27) by DM6PR12MB4761.namprd12.prod.outlook.com (2603:10b6:5:75::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Thu, 18 Mar 2021 14:48:01 +0000 Received: from DM6PR12MB3945.namprd12.prod.outlook.com ([fe80::9d62:2f16:264b:285d]) by DM6PR12MB3945.namprd12.prod.outlook.com ([fe80::9d62:2f16:264b:285d%5]) with mapi id 15.20.3955.018; Thu, 18 Mar 2021 14:48:01 +0000 From: Tal Shnaiderman To: Narcisa Ana Maria Vasile , "dev@dpdk.org" , NBU-Contact-Thomas Monjalon , "dmitry.kozliuk@gmail.com" , "khot@microsoft.com" , "navasile@microsoft.com" , "dmitrym@microsoft.com" , "roretzla@microsoft.com" , "ocardona@microsoft.com" CC: "bruce.richardson@intel.com" , "david.marchand@redhat.com" , "pallavi.kadam@intel.com" Thread-Topic: [dpdk-dev] [PATCH 1/3] Add EAL threads API Thread-Index: AQHXG5Jw6Df0kjpO2EKtvW6ogmD346qJvnDw Date: Thu, 18 Mar 2021 14:48:01 +0000 Message-ID: References: <1616029240-26588-1-git-send-email-navasile@linux.microsoft.com> <1616029240-26588-2-git-send-email-navasile@linux.microsoft.com> In-Reply-To: <1616029240-26588-2-git-send-email-navasile@linux.microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: linux.microsoft.com; dkim=none (message not signed) header.d=none;linux.microsoft.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [5.29.18.92] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9a388d63-7b2a-4795-8fdf-08d8ea1cd46a x-ms-traffictypediagnostic: DM6PR12MB4761: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-transport-forked: True x-ms-oob-tlc-oobclassifiers: OLM:1303; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fJCGeExafiXx0XCre834pke2iDPxSfuWPoSSTcLrbjhftcAz5UtgUcuEOUXOHIZmGT4afQ+tkrTsuWcZ0rl1uLXuxszXT5f4E2wU83JP9GijE8bDGmao9xhTXiDLcb9J3HvHXzLR2zNSGj6PiEZZsSlF0M1L8c0RyiYQxHLtV23zVAMXLX7dwtvGOJg1jBsF/mOgePxYwmVIutEg57E3uIm61+DtbHRBFO8UW53yLjNAyRee5Xt3Ym/ByGyEcX4X5qwRn+R5ZloGQ7yJ0leVSFvbHiFchGIs0ogZ66EZWIIlCmGkchXJBP6ywQapi+dWC57r1gSKB0UUPHGzoSoZMkQtvhuwMuvfddIM4Rc50AKlyUdTUO+1p+C8ma/itMasL02rPfAk532hGU6k9veOU8b0BbRe8tiEt80BuE9xNadEuiTIGDcFITpznf/pPE8RqGvLwOXE+s8pkShBmMAXQy9BoWjFbBaTysFHhbpxQYW0afXSwqzSgkWF0oj2CronnyxEUyslYQZeFPGI/ZIvIGFI6Hoe0Fy7bl+uoXcZn8c7qXPt/SfKUCJhobRmAOQggTHgqI4DShkhn0Fd3HoBX2EcYEOqtsG9XH807HDcD81R43Ctxkkq5ph7BzBmNN3J x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3945.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(396003)(346002)(366004)(376002)(136003)(5660300002)(7416002)(478600001)(55016002)(4326008)(2906002)(316002)(110136005)(186003)(45080400002)(33656002)(54906003)(9686003)(8676002)(83380400001)(71200400001)(66946007)(66446008)(64756008)(26005)(6506007)(8936002)(38100700001)(76116006)(86362001)(66476007)(7696005)(52536014)(66556008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?Q/gqhYgWATvQboen7Mt4ho7RUyhxJ75SJJJeeMBBlZKpVXlADt3ZqKtv/0bT?= =?us-ascii?Q?xQskJiGD14OgOKQwqjufWiH1gVD3B3GSbCUw+esxtSsf+c4dCqQe7/mCYL9q?= =?us-ascii?Q?iuEUo7CelcLEV3zB42cv/1R3CEW2TbtmPvqUW9eomrNVLyxLyuZI54eRK+bc?= =?us-ascii?Q?QSGPRgni/OtoV+SX0CkctAWUhRlLNvvSBjbn9ltK37DM/sKDayIy0NGL7yXP?= =?us-ascii?Q?PSjJnTJ8RPP6q3wJN9hAh6hNqNi4XT4HSPzzLY3bF8I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?Q?0Y8IZyL6nFzWzPHX6nX/6E65j9ANWn7Xe7vv4v2OIEiQMaJEuFZnZLbUuP81?= =?us-ascii?Q?sexKqAMgPAq/tKOqXhu33ftZAKiDb9Ls3g+clx2AKq0BX6vwakCAOWsIfNZm?= =?us-ascii?Q?L+oP+22MI1vkRHJ/GizPhHAEiFN3TXOWEf335284YaEtKcekg1VKNpSexrBT?= =?us-ascii?Q?pnw=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3945.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a388d63-7b2a-4795-8fdf-08d8ea1cd46a X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2021 14:48:01.4793 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 10y5P2Ap7dz+sXn3jLcumWEzGrvygP8ImaTkDVMw1MEUDTbBul1S6kug+Kh2uo38xA0uDt7NdVln2v8J9SdWrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4761 Subject: Re: [dpdk-dev] [PATCH 1/3] Add EAL threads API 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 Sender: "dev" > Subject: [dpdk-dev] [PATCH 1/3] Add EAL threads API >=20 > From: Narcisa Vasile >=20 > EAL must hide the environment specifics from apps and libraries. > Add an EAL API for managing threads. >=20 > Signed-off-by: Narcisa Vasile > Signed-off-by: Dmitry Malloy > --- Hi Naty, Dmitry,=20 Thank you for adding those functions to the thread API. This is a huge commit, I'd split it to separate patches, something like: 1) Move existing code to rte_thread. 2) Add empty stubs for new functions. 3) Implement OS functions for thread creation/join. 4) Implement OS functions for thread affinity. 5) Implement OS functions for thread priority. > lib/librte_eal/common/eal_common_thread.c | 6 +- > lib/librte_eal/common/rte_thread.c | 346 ++++++++++++ > lib/librte_eal/include/rte_thread.h | 323 ++++++++++- > lib/librte_eal/include/rte_thread_types.h | 20 + > lib/librte_eal/windows/eal_lcore.c | 167 ++++-- > lib/librte_eal/windows/eal_windows.h | 10 + > .../include/rte_windows_thread_types.h | 19 + > lib/librte_eal/windows/rte_thread.c | 507 +++++++++++++++++- > 8 files changed, 1338 insertions(+), 60 deletions(-) create mode 100644 > --- a/lib/librte_eal/windows/rte_thread.c > +++ b/lib/librte_eal/windows/rte_thread.c > @@ -1,16 +1,503 @@ > /* SPDX-License-Identifier: BSD-3-Clause > * Copyright 2021 Mellanox Technologies, Ltd > + * Copyright(c) 2021 Microsoft Corporation > */ >=20 > #include > -#include > #include > -#include > + > +#include "eal_windows.h" >=20 > struct eal_tls_key { > DWORD thread_index; > }; >=20 I don't know if this table is needed, the approach should be to have the re= turn value/rte_errno identical between the OSs. And having the specific OS errno printed. e.g. pthread_setschedparam On UNIX returns ESRCH when no thread id is found= , the table below doesn't translate to it so Windows will never return such error code, maybe use only the errnos below for all = OSs? what do you think? > +/* Translates the most common error codes related to threads */ static > +int rte_thread_translate_win32_error(DWORD error) { > + switch (error) { > + case ERROR_SUCCESS: > + return 0; > + > + case ERROR_INVALID_PARAMETER: > + return -EINVAL; > + > + case ERROR_INVALID_HANDLE: > + return -EFAULT; > + > + case ERROR_NOT_ENOUGH_MEMORY: > + /* FALLTHROUGH */ > + case ERROR_NO_SYSTEM_RESOURCES: > + return -ENOMEM; > + > + case ERROR_PRIVILEGE_NOT_HELD: > + /* FALLTHROUGH */ > + case ERROR_ACCESS_DENIED: > + return -EACCES; > + > + case ERROR_ALREADY_EXISTS: > + return -EEXIST; > + > + case ERROR_POSSIBLE_DEADLOCK: > + return -EDEADLK; > + > + case ERROR_INVALID_FUNCTION: > + /* FALLTHROUGH */ > + case ERROR_CALL_NOT_IMPLEMENTED: > + return -ENOSYS; > + > + default: > + return -EINVAL; > + } > + > + return -EINVAL; > +}