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 6096AA04A5; Wed, 9 Feb 2022 14:57:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5234E41143; Wed, 9 Feb 2022 14:57:52 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 30BE640140 for ; Wed, 9 Feb 2022 14:57:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644415071; x=1675951071; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=zX1cM7STIDlDvfYYtpIzRKDg5PSISHBzCmwhLS4AMvE=; b=N3sB2igVb5Rto2yVbt0Hrv7oEJdH9tRnmq1Op2OVRDOH2ZAvt26/sLeQ 8DMr2Xxn6A2sYwzPska1aNMMwCwe4Ta+PcE/6fp+p60LiPcNq+YgUkXhR qxJUnMzXb8F6hW9YS5xEwk9bOMZhwLU/ZDZ9X3+nBHglKpYcYEM9I9BKZ 1hhJhQMVQ9AZsyojOIrAFTDpTjM0xcFxzXB6PvafFvY1tQKdXwrYeowDS 6SieZTwCqcU5UKElVOfGgMse6BpKJJcodlHF+tuigOfwqfnVEokTo2PJh bCHA7cx9cFNyF28NxkxhfRIygyoeIS5I8EA9nH7gmGAWL0zhsxtvvNkkt w==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="273743907" X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="273743907" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 05:57:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="622281902" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by FMSMGA003.fm.intel.com with ESMTP; 09 Feb 2022 05:57:49 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 9 Feb 2022 05:57:49 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Wed, 9 Feb 2022 05:57:49 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.175) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Wed, 9 Feb 2022 05:57:49 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TQ52Be4ILDaOVhGL3Io4mmyOyxK6mDrVcGiNZWKHr/PN7uJlk4wVxHUJwsaRvzFpAlTGe/Pw4ywpi9Ac6Y7n0EYeTm9Kn/KI6iW9+zek2h6bQ6BRO+4fqQqMyHXGMD9d5leJ+cyS3aK/ervtQsN6AbFhgHQB4YBmhCoZci3KUeVYeq19nnZrksozoMqkNZWohFIzIg8dYnaXfV8rrjPDuPpARck2K7EsSd4abph+bDve/MQ1FoSUKzsEYKNvujH+0NwelcATovBcbzjlDzvJEtF/lNDAMimeTVjNSnTEPDZLQUFChtTfewa9jSdcyECbgO6tIhZKlfVWOvoz//ZLCQ== 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=gb3fYdjaIla6+8EjOIhqH2J0sV8Ev72eBAKlWfOxkpM=; b=FnTslac5iZQ+ZQoCVNpuXmFhbH33EuCHkzFfkPDYJZI+0RCQTPIlxtE0KdX9vg0y2aRVcyp5psdADsGGfM72hz4WVf2A/lf8LSYW4IVbDP0qU0A9R2J4duWlB5u+Oh36+jVDnVts7jDFHn+FGjLwL+jDaAHw1nepIBfmt4sEAL6e53PiRsgRLJ5zYn0L60zD8xTDXrc6rXTmVoFQtNoHohNU2af2//5iAuKJPRdq68H9+1lUuviATjF0C7De218DPvb+RmPRglmqtj7b1KqlJISP+mJ3cn9B0ZRBMKEHeG64NciRAl7yiqP0TeJLwM02dDAChpARvRA28NQWTuIqIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM5PR11MB0009.namprd11.prod.outlook.com (2603:10b6:4:69::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Wed, 9 Feb 2022 13:57:45 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::8ccc:ed65:78fa:1b07]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::8ccc:ed65:78fa:1b07%4]) with mapi id 15.20.4951.019; Wed, 9 Feb 2022 13:57:45 +0000 From: "Ananyev, Konstantin" To: Narcisa Ana Maria Vasile CC: "Richardson, Bruce" , "david.marchand@redhat.com" , "dev@dpdk.org" , "dmitry.kozliuk@gmail.com" , "dmitrym@microsoft.com" , "khot@microsoft.com" , "navasile@microsoft.com" , "ocardona@microsoft.com" , "Kadam, Pallavi" , "roretzla@microsoft.com" , "talshn@nvidia.com" , "thomas@monjalon.net" Subject: RE: [PATCH v18 8/8] eal: implement functions for mutex management Thread-Topic: [PATCH v18 8/8] eal: implement functions for mutex management Thread-Index: AQHYHJKgDSc+9S1pUkOHtzuhRV7rcayKhbuAgACgGpA= Date: Wed, 9 Feb 2022 13:57:45 +0000 Message-ID: References: <20220209024755.GA9377@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> In-Reply-To: <20220209024755.GA9377@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b753500c-f8da-499e-d8f3-08d9ebd425f6 x-ms-traffictypediagnostic: DM5PR11MB0009:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AAwRYD6KMM3aPuaYMJkkvq9+n8JxWTSJJE5LhRKj2rj4suAet2EfVQyNQfSqa5+VYFivEZp3tbx4qSq5CDxletPgg30hizQCHUq0QnygfLANTsjHMWAAn9qq//euCWOl7Uwmi7UXZhm5vhjMlYVcyGjQobwXSWzEsh+MrJI5cNZBYuLjsL0hIvyYzdttY/6s+Ks44EiRsSbTgBMBs4kbltofpZfzzyrONFy9Y2xT42OO2e+rNMCCaKHyJftrpHORRxSaUM2VaKEAIGzLXSxOi+sTuPNKj7uq/SMPbSL9KopGEos7Wj2Cf6veu9ASCZ3xVk49lXwkvbPJXGxBlmcnyE6r2p9Kts/yvRUgK2pv4P1a4dgEbdOLJGlfvkY5bgtovgQN4caMVChsvN5qLFnmep+4ez0XYfxjoJUfrcxKVJHKt9NlyHhhQ/NsuqVCLtNn76Q2D2J2GgOA3zAgJfILYBCEIG65dIt9frE+wQB5VvvxnOhNfyHEjnX7Rw4cdrwkwADnJDQpG0rhKnsAK1lZo1wElLYqBjwTHBA3Nl2/9dqPzzTpKfl1E3xGiE+U9yy6QCXwgGvqrk0aN+whcFst6AJmFIuo7vri1Op8B4mW/lLV+z5xIPbdQ9cdJtqFDx1c6ZXutZ8jeALaXRwGz7EZetZ9kNxpCb1qW9l/BkvNgyEoz/CRkNqn4xL5RWeN8lF3SSmDhdMVS0lS/pu9ivNLX1xpQdVQqZFfYKHblEiEgwvl/gpb2quqFh7a15WnnyJi5JsNGv+2FjNifOB+FYXQZin0D+Bdgp7bMPKtyvewzx0= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(38100700002)(8676002)(66556008)(66446008)(82960400001)(5660300002)(76116006)(122000001)(64756008)(66946007)(66476007)(4326008)(8936002)(6916009)(316002)(38070700005)(54906003)(83380400001)(966005)(508600001)(7416002)(86362001)(186003)(2906002)(52536014)(55016003)(26005)(71200400001)(6506007)(33656002)(7696005)(9686003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?l2Hrfi37n0IR57D051u+ottWqLF3G1ZoGf578ISD53VlF+/GADmqQGKrpVcv?= =?us-ascii?Q?FIPxijtQ4OcdN3SJm6W1z2fcdaKYl2tL1dUmcduESnKA2nykUjzsCUO/nJn7?= =?us-ascii?Q?bUJoO4wB/bUO3MkWahvxqy3WQ2O4ZhgXBSIuWgChAGIubLQPogMqYCJT2Mn7?= =?us-ascii?Q?oPF5Gr/evLlqIZPvV/HWkZ9Zdpq6elb/cswfxkQ/IdxlYArlhvMZ9fioRwpE?= =?us-ascii?Q?CNi7WE/UG3bS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t?= =?us-ascii?Q?YRjKkFEmFVmMLjvgRmRaxXwdxHDKI/hjhFFge7uGfHgqeH5XliqLLOejAGd1?= =?us-ascii?Q?0zLDTJdUhXF+y+Jk0EigyQSpH1SnGrKmhWHj+6rBqezvlP5r5wS3IGWgums+?= =?us-ascii?Q?DLGuG+bfbuHYCTC2+AVslpsWAm5TN2sbavJPnqWjrInYpHclLKQ5G5Ar81rH?= =?us-ascii?Q?uc2EEQhJB47N6vg6Jwsx69wHJpqPIDKU0XopJCuLbS04uxXhF7MQhUd/W2HI?= =?us-ascii?Q?AosnCLgH81Xdm++8m8Ujqk59N2zasbRQQ2OCIQDhook0VKrsq+GmleUANpNb?= =?us-ascii?Q?t1F/M0SGy34RsSyotsmMAx2RD64Vh5mpDI/Ea20Ol/GeQhyL1UGvWAlvDlM2?= =?us-ascii?Q?7vUoo9ToVksLqrSG7bGnoaLIlXkyde1wLa45ms9jHrIS2o6ZUPFWUm8uILHp?= =?us-ascii?Q?/bLwOg9teDufyJFqYB+w4vLoeFO8voeJcs/eg6eK7hVQBBZaUNF9264plDeK?= =?us-ascii?Q?FIN7yUteobb0scM2LxISXhcUKK/FRbvSpAUmfX56CCSrRLVoOv1qvd8Q/uYn?= =?us-ascii?Q?wurb3w=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b753500c-f8da-499e-d8f3-08d9ebd425f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Feb 2022 13:57:45.1070 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: L9fLfUjciRC4wUcWqfCeFlp8tLmUIwR/r+4qT8najATxdj5Bgx07IEeT4/E5c+XWWddzTThrccEmxNYkBt+15S6+9TWPmDTXASkZcMbL0EE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB0009 X-OriginatorOrg: intel.com 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 > > Actually, please scrap that comment. > > Obviously it wouldn't work for static variables, > > and doesn't make much sense. > > Though few thoughts remain: > > for posix we probably don't need an indirection and > > rte_thread_mutex can be just typedef of pthread_mutex_t. > > also for posix we don't need RTE_INIT constructor for each > > static mutex initialization. > > Something like: > > #define RTE_STATIC_INITIALIZED_MUTEX(mx) \ > > rte_thread_mutex_t mx =3D PTHREAD_MUTEX_INITIALIZER > > should work, I think. > > Konstantin >=20 > Thank you for reviewing, Konstantin! > Some context for the current representation of mutex > can be found in v9, patch 7/10 of this patchset. >=20 > Originally we've typedef'ed the pthread_mutex_t on POSIX, just > like you are suggesting here. > However, on Windows there's no static initializer similar to the pthread > one. Still, we want ABI compatibility and same thread behavior between > platforms. The most elegant solution we found was the current representat= ion, > as suggested by Dmitry K. Yes, I agree it is a problem with Windows for static initializer. But why we can't have different structs typedef for mutex=20 for posix and windows platforms? On posix it would be: typedef pthread_mutex_t rte_thread_mutex_t; #define RTE_STATIC_INITIALIZED_MUTEX(mx) rte_thread_mutex_t mx =3D PTHREA= D_MUTEX_INITIALIZER=20 On windows it could be what Dimitry suggested: =20 typedef struct rte_thread_mutex { void *mutex_id; /**< mutex identifier */ } rte_thread_mutex_t; #define RTE_STATIC_INITIALIZED_MUTEX(private_lock) \ rte_thread_mutex_t private_lock; \ RTE_INIT(__rte_ ## private_lock ## _init)\ {\ RTE_VERIFY(rte_thread_mutex_init(&private_lock) =3D=3D 0);\ } API would remain the same, though it would be different underneath. Yes, on Windows rte_thread_mutex still wouldn't work for MP, but that's the same as with current design. =20 > I will address your other comments on the other thread. >=20 > Link to v9: http://patchwork.dpdk.org/project/dpdk/patch/1622850274-6946-= 8-git-send-email-navasile@linux.microsoft.com/