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 2EA6DA0524; Wed, 5 May 2021 19:10:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1AE940040; Wed, 5 May 2021 19:10:22 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C7A524003C for ; Wed, 5 May 2021 19:10:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id EE2F020B7178; Wed, 5 May 2021 10:10:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EE2F020B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1620234619; bh=irV0mjauVDJ6WviL/MEOBE5G/hvErA8/jOx7trOJVdo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=icAWo0ERa3mP7M7K0zdn/UPv4gOLdfOJ6NQpWKWTzzXpcWB6Z8ZGNf3xU3mR0Rptj bQDGCMhgV9z1DYl6S8XZaFBAIstpJC65rS3iiGxldx7LSBSSobwMf2DuNNsI3So7Hq +Vtr6WePtts9vrC0GT52uJlgGWKi4MRuqt+ok89g= Date: Wed, 5 May 2021 10:10:19 -0700 From: Tyler Retzlaff To: Honnappa Nagarahalli Cc: Joyce Kong , "thomas@monjalon.net" , "david.marchand@redhat.com" , Ruifeng Wang , "dev@dpdk.org" , nd Message-ID: <20210505171019.GA2517@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20210421071733.17794-1-joyce.kong@arm.com> <20210429190358.GG21799@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20210429193854.GH21799@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20210430155147.GA24271@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> 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) Subject: Re: [dpdk-dev] [PATCH v1] test/ticketlock: use C11 atomic builtins for lcores sync 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" On Wed, May 05, 2021 at 12:37:50AM +0000, Honnappa Nagarahalli wrote: > > > > > > > > > > > your subject line indicates the use of C11 which is a standard [1]. > > > > > > > > the patch itself uses gcc atomics builtins which are not part of C11 > > > > standard so the subject line is incorrect and misleading. > > > Ok, understood. How about the following? > > > "use gcc's C11 atomic built-ins for lcore synchronization" > > > > drop 'C11' from it and it describes the actual change > > > > > > > > > > > > > [1] http://www.open- > > std.org/jtc1/sc22/wg14/www/standards.html#9899 > > > > > > > > > > > > > > Not sure if these compilers are supported in DPDK. DPDK officially > > > > > supports > > > > gcc, clang (not sure on icc). > > > > > > > > dpdk may incorporate support for other compilers in the future so > > > > unless there is substantive justification for moving to > > > > non-standard/non-portable code i'm asking that this change not be made > > as it will complicate those future efforts. > > > There is some history [1] behind why we are doing this. I guess new > > compiler support needs to be discussed in the future. > > > > > > [1] > > > https://www.dpdk.org/blog/2021/03/26/dpdk-adopts-the-c11-memory- > > model/ > > > > thanks for the reference. it seems this documents explicitly states the choice > > to not use C11 stdatomic.h and the basis of that choice appears to be to > > support old versions of gcc. > > > > it doesn't seem particularly forward looking to reduce future compiler > > portability to support old versions of gcc thereby excluding standards > > compliant compilers. > > > > i would like to hear from the tech board that it is the best trade-off for the > > project to reduce compiler portability for older versions of gcc instead of > > adopting standard C11 atomics which locks out the use of other compilers. > > > > if this change does go forward could i at least ask that the builtins used are > > abstracted behind either macros or inline functions so that if alternate > > implementations appear for the builtins we don't have to perform shotgun > > surgery on the broader codebase when it arrives? > There is already code using the built-ins in the repo. I do not see why this is any different. i agree there are several dozen uses of gcc atomic builtins in use in lib/* already. so it's easy to fall into the trap of only a few more won't hurt but it's a slippery slope if everyone continues to use that as justification for not abstracting them away now. would you not consider abstracting behind a macro though? perhaps submitting a patch that cleans up the existing use so the amount of change later? > How difficult it is for the compiler to support these built-ins? there are a lot of non-technical factors that would have to be addressed to answer that question so i don't think it's a useful discussion. the functionality is supported by C11 compilers (albiet optionally) so you have to somehow make a case for adding duplicated non-standard functionality which is difficult politically and financially depending on the vendor. > If DPDK supports another compiler in the future that do not have these built-ins, the shotgun approach should be straight forward as there is a 1:1 mapping between the built-ins and the C11 atomic APIs from stdatomic.h. not if you abstract it now, otherwise it just grows. others are free to ack this change as is. so i'm not blocking it by any means and i'd be happy to ack a change that introduced the abstraction instead of direct use of compiler specific builtins. thanks