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 8F380A04A9; Tue, 8 Feb 2022 03:22:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 72FBB41101; Tue, 8 Feb 2022 03:22:00 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 504A540141 for ; Tue, 8 Feb 2022 03:21:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644286918; x=1675822918; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=KKJL1rW4vbMe3ECtKYs1eiPhuj00szUE+izyyNrPLI0=; b=XmSfqosV/GvDebneATAxKuL0ybljgeBRifFNHFo3T7IpWy46dZ20iOaN d3laoAiBMro94M8O6qUivR1bGBz33giXdVLvbD6eeWDTa3yODryoH1bfh ZtstkiGBrKAvtfwP7UG+Ub7XaaEss2lyjdYGPNpaFCA1uP8I+IuXsg7rJ PD4we+4KADSk94k5F2lUKosIm00BQj5uJfhYnIJGwr4rg0nUiwE/MTt4Z iB3t5fEo+T87ABXGfO1FqZWFwQuxsj3BL6lHTcjJt+lKP+8WXWSSL+yAY QI8ZWEv5B6m+o21nXr1MT6tB7KMm4lfmb22DfEse5Ndi3X/yiZJWpPa7T Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10251"; a="249064179" X-IronPort-AV: E=Sophos;i="5.88,351,1635231600"; d="scan'208";a="249064179" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2022 18:21:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,351,1635231600"; d="scan'208";a="525369123" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga007.jf.intel.com with ESMTP; 07 Feb 2022 18:21:56 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 7 Feb 2022 18:21:56 -0800 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 7 Feb 2022 18:21:55 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Mon, 7 Feb 2022 18:21:55 -0800 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.170) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Mon, 7 Feb 2022 18:21:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BadXnfIXmXVBldxHloR1MOYLyvtGZnFQdcXF22AUQYsB3Vvbb+7dsFGEyYzxHHmSwgR2rqrFrllVIGd3n481QtI2JGYZZjkEGKhXoHw1ORB5F7r94ki7gwMVXvSngtAlypnfpV2Q/zBsAynY1/r2+0QSC5KXRxMIxoY13Bt/2C8wXtEClQEVeBzEozEyPWHEx9Z0q9k69fFi0RLrCPHVAZWo3//ZagCSWXDneQ8yAyR2zCpY5gqR4k4ZJijSAHM4LA72usZxvlvZEGdWoHwu67CrKb+ZmcrsAn6MF0YE6b83EVAmYoFA0j56X8iYdDrWnCFLCbFeIYiDFcYJ1zszag== 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=g16Wz1KAmmWHGxsL1bgYPZMN6/6FYrLh9hIKb+orEc0=; b=HpEsIkVJ/Pb6AC7fLCODDpvdv7YJVnIiDmg4XEbUoa0z3gPGP+xieg/Q4o0K2tnC3e2OaflY9d9WcjsilXzzqO0lCmd1wE3LliMNj2QN/KVYQdvoTREERen3DvnzwY3voGp9vCtLUESmLIrxPwkXcUsl1xP/YMgD706k0TMrPnQYy5kbU005exw+0M0qy9WTMfkyK+NBsUVro0HWPr6uo9mlRMmAq1N7KvRVqCSUlMez1FK39iD/ce/dFq53fFlQzemawyTqRqnRWJCfyQrkzUpdpNmTMTS0EQmK1K9ZWILgaTzpFAu8NOMzYamOgI3mFHkJR4MQ4St7St5cAUCzBg== 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 CO1PR11MB5012.namprd11.prod.outlook.com (2603:10b6:303:90::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Tue, 8 Feb 2022 02:21:50 +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; Tue, 8 Feb 2022 02:21:50 +0000 From: "Ananyev, Konstantin" To: "Ananyev, Konstantin" , "navasile@linux.microsoft.com" 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+9S1pUkOHtzuhRV7rcQ== Date: Tue, 8 Feb 2022 02:21:49 +0000 Message-ID: References: In-Reply-To: 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: 95c523ea-0bfa-4c33-9fd1-08d9eaa9c381 x-ms-traffictypediagnostic: CO1PR11MB5012:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3sYd15uKurvBAmPBRF18acpc6XNRoab+E2DbNy968c0wdMlvfjSWitVrcL16Fmlp3ULuMG06WEdEoH24UuyrrpSmm1jKV/2XDAeR5nZY2Mn1DCC1VaINw56kgJg77hi0HSQKhhvf2eYajJ3FWkF+2tCO52YB1LNHGbQQoWvr2ShEwpUEXQjHLXMCNBV44YHeXLQQGsJLpTYQUF0IiKWIudF1h+5TrhJl4Ppdge6JrDd197xL86NotceSRS5FKu1dzPlKzPwvJJ7jkALQlG2FSuMDM+sgAXP5yASXtmYAtNa+7xKGr2VJVZQR/EUDNM9tXPL+HLhlQEJ6OSDxFG/uC1xUeBDPnhhvIO9xz6JcGSJIg+A4RtsnTB7HaXg81Dob7uHeCieQh+DQbTvvqCVaZRtbzaKmhwS3AP1K6T44y5qfW/fE16mYOdEJJaJdE61OfaXe23z/PhhfesldjrKZe/jaeTaVJfC7C/viMjI2GX344xL1vrZrnrYV+ZAgbcNs3R9LxHzEBrEz5gkq5rZhEcYW9l9tOkcbekDxIrJml6tKp7t4yIlDef3TsgbRZNW8tGwrMDi4H/cWFF7OWMWEQuRdX2N/04bjj8J5dROothQ9QqiYrNQclgqi8Qt60iY0ofGuiqVTdmn8BPIDRtrv0nX2T5nx3GL6sk9IhXiJum3VkKY8/OPwguAXb2c16birS4brnS0gpmJp3vZ9R8OoKg== 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)(83380400001)(55016003)(33656002)(508600001)(38100700002)(82960400001)(122000001)(76116006)(186003)(110136005)(66556008)(66476007)(66446008)(54906003)(8936002)(38070700005)(5660300002)(71200400001)(66946007)(52536014)(86362001)(9686003)(316002)(4326008)(8676002)(26005)(6506007)(7696005)(64756008)(2906002)(7416002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?heEGP1zj8e86N4riWY7+Rl5cYZKmP8Y+kvYLr+gfUqZgaEBV3KdKI3XDpU89?= =?us-ascii?Q?648Hmy5gqSvgf2eWiLnZcrNndsXKqFoW9GghYWU7heD0Gn82kzK0SGBK+l4h?= =?us-ascii?Q?tP4ooFQzQjJTeKL7l7SRm+CU7mQSyVz4vNHeqGNfy4Swd/1A8ZWNyb4MPFGd?= =?us-ascii?Q?0rj+aGfyh1CNHjxryVjZHBOucN3ILKAz9Ae/e4oupnKucpY8jcGjN/N2UFRE?= =?us-ascii?Q?Z1UcxgpAygRRJidNcJWjxqgwp6/fJwr1+enrzSlQVG4fc4YmQXJox+hucJDg?= =?us-ascii?Q?7lSXW1qfJHY8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0fIyL0?= =?us-ascii?Q?cc00CTMnH08MYT8/W7wHknwZbnSlzs6RJE0NUJ+XCwGrEDN5yB3DfOGao1ZJ?= =?us-ascii?Q?PWyZw9lwyNtxCvN9sVxj7fp4QPqBq0hTwSwwezCuPe8lg2YtCPUdmcHq8163?= =?us-ascii?Q?7H8Ph1SMhbKG0KgPdg+GG0U1l+T5xlWR5vCXgX4rzajApbuYCOQj+K4FYwg6?= =?us-ascii?Q?GoNd0aHXHFAM0/IemcxR+QFFQInpzFIv0tDwrKeYTw/odALvl6Kh01mfgkc3?= =?us-ascii?Q?cyodBlA6szrRQGXrjahCXJYaghqTHl/phlhoSlNGrsbfY+dribCHWFrE9Hus?= =?us-ascii?Q?TLv/XGrQnb/I/4mDUN/PRFanUp7Hu6hDOt/aaa4TqYQ0ofD1Kzmi/JZg6YJO?= =?us-ascii?Q?/i3xBQ+ReT6sjfGIJbuHHkNAWPtqfNlI03zVqfV9qeMYoqXxUe4K50lXdtjQ?= =?us-ascii?Q?8ok/8prxZ0c4WbHzEVuxtytI0+kUk6g6PyRycsj2kOMBMvF35IifflsFlhYM?= =?us-ascii?Q?IBAdiw=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: 95c523ea-0bfa-4c33-9fd1-08d9eaa9c381 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Feb 2022 02:21:49.9591 (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: ryYdslkCsFKe1LAHDmM1lcGnmFiwmp+WqQonXkq7KeW7kq82m13JvPj4K1jMRKcQ+zWjKwZcsmNKS5LFTcdz5SCHYcjUFEUqlz5vDVpHyYw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB5012 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 > > + > > +/** > > + * Thread mutex representation. > > + */ > > +typedef struct rte_thread_mutex_tag { > > + void *mutex_id; /**< mutex identifier */ > > +} rte_thread_mutex; >=20 > I wonder can't we have something like that instead: >=20 > for posix: > typedef pthread_mutex_t rte_thread_mutex_t; > for windows: > typedef struct rte_thread_mutex { > int initialized; > CRITICAL_SECTION cs; > } rte_thread_mutex_t; >=20 > Then for posix: > #define RTE_INIT_MUTEX(mx) do {\ > *(mx) =3D PTHREAD_MUTEX_INITIALIZER; \ > } while(0) >=20 > #define RTE_DESTROY_MUTEX(mx) do {} while (0); /*empty */ >=20 > For windows: > #define RTE_INIT_MUTEX(mx) do {\ > If ((mx)->initialized =3D=3D 0) { > InitializeCriticalSection((mx)->cs); > (mx)->initialized =3D 1; > } > } while (0) >=20 > #define RTE_DESTROY_MUTEX(mx) do { > if ((mx)->initialized !=3D 0) { \ > DeleteCriticalSection((mx)->cs); > } > } while (0) >=20 Actually, please scrap that comment. Obviously it wouldn't work for static variables,=20 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