From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id DE5371B329 for ; Mon, 29 Jan 2018 10:51:49 +0100 (CET) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2018 01:51:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,429,1511856000"; d="scan'208";a="197011896" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.77]) by orsmga005.jf.intel.com with SMTP; 29 Jan 2018 01:51:46 -0800 Received: by (sSMTP sendmail emulation); Mon, 29 Jan 2018 09:51:45 +0000 Date: Mon, 29 Jan 2018 09:51:44 +0000 From: Bruce Richardson To: Stephen Hemminger Cc: Thomas Monjalon , dev@dpdk.org, Chao Zhu , konstantin.ananyev@intel.com Message-ID: <20180129095144.GA15004@bricha3-MOBL3.ger.corp.intel.com> References: <20180126020151.979-1-stephen@networkplumber.org> <20180126020151.979-2-stephen@networkplumber.org> <3131860.My9xXdrCmY@xps> <20180126172440.GA17280@bricha3-MOBL3.ger.corp.intel.com> <20180126135423.29394092@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180126135423.29394092@xeon-e3> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.9.1 (2017-09-22) Subject: Re: [dpdk-dev] [PATCH v8 01/15] eal: introduce atomic exchange operation 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: , X-List-Received-Date: Mon, 29 Jan 2018 09:51:50 -0000 On Fri, Jan 26, 2018 at 01:54:23PM -0800, Stephen Hemminger wrote: > On Fri, 26 Jan 2018 17:24:40 +0000 > Bruce Richardson wrote: > > > On Fri, Jan 26, 2018 at 06:14:01PM +0100, Thomas Monjalon wrote: > > > 26/01/2018 03:01, Stephen Hemminger: > > > > To handle atomic update of link status (64 bit), every driver was > > > > doing its own version using cmpset. Atomic exchange is a useful > > > > primitive in its own right; therefore make it a EAL routine. > > > > > > > > Signed-off-by: Stephen Hemminger --- > > > > .../common/include/arch/ppc_64/rte_atomic.h | 21 +++++- > > > > .../common/include/arch/x86/rte_atomic.h | 24 +++++++ > > > > .../common/include/arch/x86/rte_atomic_32.h | 12 ++++ > > > > .../common/include/arch/x86/rte_atomic_64.h | 12 ++++ > > > > lib/librte_eal/common/include/generic/rte_atomic.h | 78 > > > > ++++++++++++++++++++++ 5 files changed, 146 insertions(+), 1 > > > > deletion(-) > > > > > > Looks good, thanks. > > > > > > It probably deserves a review by PPC experts. Adding Chao, maintainer > > > of this part. + Bruce and Konstantin for x86 part. > > > > > Would it not be simpler to use __sync_bool_compare_and_swap compiler > > built-in on all supported platforms? Do we really need the per-platform > > optimization of this? > > > > /Bruce > > Exchange is different than compare and swap. The is nice atomic intrinsic > in GCC. The x86 part is in Linux and BSD already. Yes, sorry, I picked the wrong builtin. I should have referenced instead "__sync_lock_test_and_set", which is an xchg op according to the docs [https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html].