From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 89749A04BA; Thu, 8 Oct 2020 04:47:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5969A2C16; Thu, 8 Oct 2020 04:47:07 +0200 (CEST) Received: from nat-hk.nvidia.com (nat-hk.nvidia.com [203.18.50.4]) by dpdk.org (Postfix) with ESMTP id E2F7D2B84 for ; Thu, 8 Oct 2020 04:47:04 +0200 (CEST) Received: from HKMAIL104.nvidia.com (Not Verified[10.18.92.77]) by nat-hk.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 08 Oct 2020 10:47:03 +0800 Received: from HKMAIL101.nvidia.com (10.18.16.10) by HKMAIL104.nvidia.com (10.18.16.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 8 Oct 2020 02:46:56 +0000 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.175) by HKMAIL101.nvidia.com (10.18.16.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 8 Oct 2020 02:46:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FxCi+6YfS3+ltxxoz4TPZcxStqZcwoQgD3pDyfQzDcQcHcvJAoROBMritiDa1fzApMtg02IxvEwqXZ4WD7s8yUAAOvjvt2mTn4gG4rd0qgEOUmlUIcyXSOzv35/raNLs6IDhch3WZDXETcdQce4xqupJibjXyqoIwQJ434wgLFqEV84yRRaOHrrCCrbRPwBJGVx2EqJchzDMCZd0uNmrtamvFcmMqLW0+XYsXwV+nI5kUeWiOwVK4B/4wN6kE3mwjZSKrVoRcPNPEj/PRR8QJKHRftFv+5YhoC5IzTeQST83HFKBIZSoYUD1N81UhzMKrq0UEd+B2NiYtNjn8mL5tA== 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=tcRdHjekBjuRm4T/I51mQbjqm96cAHXazlB9pVIFi6Y=; b=LcN0cXP2ps2jHhdfN+pWxRrF64X2KkskOj9OX5oQ6JxmZjSCsjmapEQXuuZuysVWhC6bMbDwRPT2x+FEZWIhP45Z3J2XGDgsQok9e7DgPnQr6zWFHzghY6vVw/iW1v0nkWs1ccBwRFDj96Vj4kJn5vy7U7wIdHUc2qt3X+4e0Qq+g9msOZgSBroBfcTb2w+TUQvTs55UA/LZYmlShFbis3hmKrYCNi+wuk9od8avywpfr3ZEE/at/Mg9wnz+4q64XepvINpWRErrVOwjgRWZNkMLC4ApyNXIaChmZ7dl1yXF7ZRhlALhIpGHW+gwMkmc3JbSJRBXQWzjzXf6F8/RFw== 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 Received: from MWHPR12MB1743.namprd12.prod.outlook.com (2603:10b6:300:113::8) by MWHPR1201MB0030.namprd12.prod.outlook.com (2603:10b6:301:53::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.36; Thu, 8 Oct 2020 02:46:54 +0000 Received: from MWHPR12MB1743.namprd12.prod.outlook.com ([fe80::9dae:c530:883a:b4dc]) by MWHPR12MB1743.namprd12.prod.outlook.com ([fe80::9dae:c530:883a:b4dc%9]) with mapi id 15.20.3433.046; Thu, 8 Oct 2020 02:46:54 +0000 From: Suanming Mou To: Dmitry Kozlyuk CC: Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam , "dev@dpdk.org" Thread-Topic: [PATCH v3 1/2] eal/windows: add pthread mutex lock Thread-Index: AQHWnMp5hWPTmUQIREyshyk4SvM36KmM/YqQ Date: Thu, 8 Oct 2020 02:46:53 +0000 Message-ID: References: <1601194817-208834-1-git-send-email-suanmingm@nvidia.com> <1602080249-36533-1-git-send-email-suanmingm@nvidia.com> <1602080249-36533-2-git-send-email-suanmingm@nvidia.com> <20201007195358.6687cc42@sovereign> In-Reply-To: <20201007195358.6687cc42@sovereign> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [36.27.56.50] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 651b50be-c2b5-4332-b625-08d86b346a7e x-ms-traffictypediagnostic: MWHPR1201MB0030: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uv8qV0s9C2jP5x4Ak9I6lk+3dKKmets3R6DrSo2P2w/rz8kYx5175f1zJysK6LTxvwE6LNOwwZMxOTeqDz0YDHc6JW5vNGlY6dXafEHpzXDTAgAfxrBLoBrdEoT8XSMEVTFuuO3fIujghQjx1g6vBzMygNHKO2qLSjZ/pOCJ+Gktuz5zKYwwq8VUGquIvZ8S5B4j+8IbyhqBvRfFxHhsuO98YPqm0OCxwnI/A14d2p6J/v/mYMsLf7dCf9V1B02LixsoOU5z4DRDRQP1eHS5zFrvFnDl+8yYuqbUaCMC9wkMSqqAYDRIi5ke87isS/8H9dmK7R94LdG2JfQ7Xsvnhn4MUs2rMlivid6zy0PZG0Gt1sXxjRNqXF3Ms9kvlVs++hKNeVUlsnSDh1ZIQHmANQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR12MB1743.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(39860400002)(376002)(136003)(396003)(6916009)(26005)(83080400001)(66446008)(66556008)(66476007)(66946007)(52536014)(64756008)(7696005)(5660300002)(8936002)(9686003)(71200400001)(53546011)(6506007)(76116006)(83380400001)(45080400002)(186003)(8676002)(2906002)(478600001)(86362001)(33656002)(55016002)(316002)(966005)(54906003)(4326008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: MLLPfJxugbt4gKYaAlyuzN4Zz40q1ac2wwz0Ppbvp0ARL/bDDOeijSeY+/ByjQtUia8TuWAIGbLu2rEvEzz91YTvOIV7R41ML9sxcQTP2N5yTlDIiNa7rgyamoV/J8FHAe/lPbx2NnrGto3oUBUsO3sSDRY0Pa4onRHjwalSqsYHB3ZKEkTg+ObRcgq+77CPzm6IgsQOsQYacGlQZdQanrtfMweDGwA6vvZwI2kwt33d0mpk466DndF9HBWfsky4CW6Tlg4Wmq/RM6NXHN1s9lLm1WtnjS5aVfdP/V5pGrXIR2YzCjqH61m9va130NG/w0L5PjeynAfwh4o64GWfcaXtdpAPw426GAvR1iD5bufu/Ag8yIW4vEGASEfh5SQ+4ioMhlllxsLv+IQY02wdZeKH+KJWdBS6merQYoL++Lg5E8gqdMn81dRSkNW441dtBrBfZhCR0jS2v6T7GKDuxCbJyOjLNKjclH0nbLHO1tEjlkSgaJfVEK3gOdf7iDipw1cBh8oTOtpjJc6SrhHTCfFW/UjGvT5aS3JTVICmSQKtcrXuKJqeVTKcfreP/VpQ5xeY2e7aAkrrQxJ9EBxPezzBxQ0SVp6obuJjgPKu+9V64O7Zd976tS3RIL8RQFh41AxRSjmbCGi9Knma5MUv0g== x-ms-exchange-transport-forked: True 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: MWHPR12MB1743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 651b50be-c2b5-4332-b625-08d86b346a7e X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2020 02:46:53.9686 (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: PS6dXANXX5qTWu0wc8POSPAabnph144OmjZeR6SnLQ5tCmCoOo03Vg6ekYUWA/Nhw9GQ34OBiNVt5pa+fU32gQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0030 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1602125223; bh=tcRdHjekBjuRm4T/I51mQbjqm96cAHXazlB9pVIFi6Y=; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To: CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References: In-Reply-To:Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:authentication-results:x-originating-ip: x-ms-publictraffictype:x-ms-office365-filtering-correlation-id: x-ms-traffictypediagnostic:x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers:x-ms-exchange-senderadcheck: x-microsoft-antispam:x-microsoft-antispam-message-info: x-forefront-antispam-report:x-ms-exchange-antispam-messagedata: x-ms-exchange-transport-forked:Content-Type: Content-Transfer-Encoding:MIME-Version: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; b=F1LKMDxnw6NvZjL9BI9LF0dGiX9LZVOarmEM9kC9CjOShC3Id4kryRtiMkGOSNuHU Ry+8tCrjJoPOJGbGulACk+OvclRrfAK3AWhHcQHEbE11suelRnohhRH1oT0GETj8eu d9avPG2pn/rwkWp31crULzWRLAQTGX4/3yjzR+rwqvh13ed0W8pYMFBwMqWEDps6Hv LrimZKksKZUIGGlfnklF2wggSDL5xd4c509fvVBIcyu7JrPWIdxsHXWOjh6U1Co/IJ s3yPIfpDnK3AR/p39xGI0jR2WehxdmdPG6p39SHwTdfJUVpk22RHKXdZlkKFBbOlKt IOaiDD+Zv73qw== Subject: Re: [dpdk-dev] [PATCH v3 1/2] eal/windows: add pthread mutex lock X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Hi Dmitry, Thank you very much. I also got some messages that they wish the PTHREAD_MUTEX_INITIALIZER macro= can also be supported. Refer to [1], we found that with critical section solution, maybe the macro= can be defined as this: #define PTHREAD_MUTEX_INITIALIZER {(void*)-1,-1,0,0,0,0} We have tested that works, so I would prefer to add that if the macro is al= so OK with you. What do you think about that?=20 The explanation from [1]: " The pthreads API has an initialization macro that has no correspondence t= o anything in the windows API. By investigating the internal definition of = the critical section type, one may work out how to initialize one without c= alling InitializeCriticalSection(). The trick here is that InitializeCritic= alSection() is not allowed to fail. It tries to allocate a critical section= debug object, but if no memory is available, it sets the pointer to a spec= ific value. (One would expect that value to be NULL, but it is actually (vo= id *)-1 for some reason.) Thus we can use this special value for that point= er, and the critical section code will work. The other important part of the critical section type to initialize is the = number of waiters. This controls whether or not the mutex is locked. Fortun= ately, this part of the critical section is unlikely to change. Apparently,= many programs already test critical sections to see if they are locked usi= ng this value, so Microsoft felt that it was necessary to keep it set at -1= for an unlocked critical section, even when they changed the underlying al= gorithm to be more scalable. The final parts of the critical section object= are unimportant, and can be set to zero for their defaults." [1] https://locklessinc.com/articles/pthreads_on_windows/ BR, SuanmingMou > -----Original Message----- > From: Dmitry Kozlyuk > Sent: Thursday, October 8, 2020 12:54 AM > To: Suanming Mou > Cc: Narcisa Ana Maria Vasile ; Dmitry Mallo= y > ; Pallavi Kadam ; > dev@dpdk.org > Subject: Re: [PATCH v3 1/2] eal/windows: add pthread mutex lock >=20 > On Wed, 7 Oct 2020 22:17:28 +0800, Suanming Mou wrote: > > Add pthread mutex lock as it is needed for the thread safe rte_flow > > functions. > > > > Signed-off-by: Suanming Mou >=20 > Acked-by: Dmitry Kozlyuk