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 9FA67A034E; Wed, 9 Feb 2022 03:47:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 328E6410F3; Wed, 9 Feb 2022 03:47:58 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6F9BF4067E for ; Wed, 9 Feb 2022 03:47:56 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1059) id 6412420B90F0; Tue, 8 Feb 2022 18:47:55 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6412420B90F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1644374875; bh=pgitAp6G6rPPXtO4k+94S7l7qMp2hLyqmj7e4uPN2JE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Csy0MQdBPuP6h8gxC47uPj+iaTG/jE/+jAHx4YGxH4Xr/7GCWMQPNTcDwEvwdBK8J 5K7cdNwWL2BwWOHL/956mJda5i0MwGxInq3MjG9ncFTyIBh5/ZtQ0WNC5WnHLQEEOS pOqZ9v5VrtOAorfha01U3Fy9s23+Pjt/PmcyxDAs= Date: Tue, 8 Feb 2022 18:47:55 -0800 From: Narcisa Ana Maria Vasile To: "Ananyev, Konstantin" 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 Message-ID: <20220209024755.GA9377@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Tue, Feb 08, 2022 at 02:21:49AM +0000, Ananyev, Konstantin wrote: > > > > > + > > > +/** > > > + * Thread mutex representation. > > > > 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 = PTHREAD_MUTEX_INITIALIZER > should work, I think. > Konstantin Thank you for reviewing, Konstantin! Some context for the current representation of mutex can be found in v9, patch 7/10 of this patchset. 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 representation, as suggested by Dmitry K. I will address your other comments on the other thread. Link to v9: http://patchwork.dpdk.org/project/dpdk/patch/1622850274-6946-8-git-send-email-navasile@linux.microsoft.com/ > >