From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 7B2BD324D for ; Thu, 14 Mar 2019 16:54:33 +0100 (CET) Received: by mail-pg1-f193.google.com with SMTP id q206so4271786pgq.4 for ; Thu, 14 Mar 2019 08:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wlwBrHy9NmY6ByhdRSyvSYhGVj+auBNj3LHS38WeReI=; b=KCUsn38O2DwKZNAGER0YXTaFqj9JRTTxgEXGo4f2UNwLY/wILE0XN1iXNLxlAonVCt 0C94Kr/kshoQ7PYPkXuSNsORudo1upixG/GpT9QthDhz+X/VmTP+zzGtrFVSguNNzMSY UaqvKaz4CceeZ5ZfGKUOM20Mn1ZNtiGB6uW/Gq+reerX2fU+NUmncmrGxegDJLqgtBKD xcU1HJLXiOv1cPhMqonmVb8HV5fiLZNEUMNEVegEMJOPb8ytGYfMvgSvv24+v4FhjJpT Py4romrqCqyFuGSIvlzfBgm1wVyvjMr6jzR2wKhkKi+Tz43zy0KWTqmJHVEgvr0F7Kp2 7/WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wlwBrHy9NmY6ByhdRSyvSYhGVj+auBNj3LHS38WeReI=; b=LKc53hFkVnDypNcLK4ZgMsJyjjgEGBAlbPLsKkl4s8NDpSAtzUhVtfwNmxGOXwKYRC 3zOUzklIYzfXlGoeGfixp4UC0bP7ogn57NPMp0LEOMjdyFHTAUVAJrunLFQsI/lc3gQe rp25nXrALox58JarAKXL8G05DGxYDh2shcunecT8J3mgeH5QJ4FLEHsCjr4RT+M73T22 4EuN729Kkx8Cc5kEI5TaIrR1ZKlNjHjb19msIAubMmSec02qmDCrYkd0IIPTZJTybUrd g2h2rVIaFtqqEBL7q3qxFYd9ddgRqJqK3DDzW1wmx1iyd9wioMNvss7cmNEyihncsd2Q htcA== X-Gm-Message-State: APjAAAUdgz+Q5Zf9V3Z4cfbn1jIY+Xu+ygoUrTytnJd1VKtFk3CC/agm V9/rG5ZVQNwC63UHY0cJI+z7Mg== X-Google-Smtp-Source: APXvYqyVrNRKSvWD0/j05c/391L2aFC0czh0DDBeo3of5FLr+ONle9xFueIMLu8VDUpcZCC85wS4zQ== X-Received: by 2002:a62:20d2:: with SMTP id m79mr51114233pfj.135.1552578872678; Thu, 14 Mar 2019 08:54:32 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id y13sm1258142pfn.31.2019.03.14.08.54.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Mar 2019 08:54:32 -0700 (PDT) Date: Thu, 14 Mar 2019 08:54:29 -0700 From: Stephen Hemminger To: Joyce Kong Cc: dev@dpdk.org, nd@arm.com, Gavin Hu , jerinj@marvell.com, konstantin.ananyev@intel.com, chaozhu@linux.vnet.ibm.com, bruce.richardson@intel.com, thomas@monjalon.net, hemant.agrawal@nxp.com, honnappa.nagarahalli@arm.com Message-ID: <20190314085429.22ccd9ca@shemminger-XPS-13-9360> In-Reply-To: <1552569304-74817-2-git-send-email-joyce.kong@arm.com> References: <1552569304-74817-1-git-send-email-joyce.kong@arm.com> <1552569304-74817-2-git-send-email-joyce.kong@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 1/3] rwlock: reimplement with atomic builtins 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: Thu, 14 Mar 2019 15:54:33 -0000 On Thu, 14 Mar 2019 21:15:02 +0800 Joyce Kong wrote: > - success = rte_atomic32_cmpset((volatile uint32_t *)&rwl->cnt, > - (uint32_t)x, (uint32_t)(x + 1)); > + success = __atomic_compare_exchange_n(&rwl->cnt, &x, x+1, 1, > + __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); Would it be possible to have rte_atomic32_cmpset be an inline function that became __atomic_comppare_exchange? Then all usages would be the same. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 2CA4AA0096 for ; Thu, 14 Mar 2019 16:54:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 70C4A374E; Thu, 14 Mar 2019 16:54:34 +0100 (CET) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 7B2BD324D for ; Thu, 14 Mar 2019 16:54:33 +0100 (CET) Received: by mail-pg1-f193.google.com with SMTP id q206so4271786pgq.4 for ; Thu, 14 Mar 2019 08:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wlwBrHy9NmY6ByhdRSyvSYhGVj+auBNj3LHS38WeReI=; b=KCUsn38O2DwKZNAGER0YXTaFqj9JRTTxgEXGo4f2UNwLY/wILE0XN1iXNLxlAonVCt 0C94Kr/kshoQ7PYPkXuSNsORudo1upixG/GpT9QthDhz+X/VmTP+zzGtrFVSguNNzMSY UaqvKaz4CceeZ5ZfGKUOM20Mn1ZNtiGB6uW/Gq+reerX2fU+NUmncmrGxegDJLqgtBKD xcU1HJLXiOv1cPhMqonmVb8HV5fiLZNEUMNEVegEMJOPb8ytGYfMvgSvv24+v4FhjJpT Py4romrqCqyFuGSIvlzfBgm1wVyvjMr6jzR2wKhkKi+Tz43zy0KWTqmJHVEgvr0F7Kp2 7/WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wlwBrHy9NmY6ByhdRSyvSYhGVj+auBNj3LHS38WeReI=; b=LKc53hFkVnDypNcLK4ZgMsJyjjgEGBAlbPLsKkl4s8NDpSAtzUhVtfwNmxGOXwKYRC 3zOUzklIYzfXlGoeGfixp4UC0bP7ogn57NPMp0LEOMjdyFHTAUVAJrunLFQsI/lc3gQe rp25nXrALox58JarAKXL8G05DGxYDh2shcunecT8J3mgeH5QJ4FLEHsCjr4RT+M73T22 4EuN729Kkx8Cc5kEI5TaIrR1ZKlNjHjb19msIAubMmSec02qmDCrYkd0IIPTZJTybUrd g2h2rVIaFtqqEBL7q3qxFYd9ddgRqJqK3DDzW1wmx1iyd9wioMNvss7cmNEyihncsd2Q htcA== X-Gm-Message-State: APjAAAUdgz+Q5Zf9V3Z4cfbn1jIY+Xu+ygoUrTytnJd1VKtFk3CC/agm V9/rG5ZVQNwC63UHY0cJI+z7Mg== X-Google-Smtp-Source: APXvYqyVrNRKSvWD0/j05c/391L2aFC0czh0DDBeo3of5FLr+ONle9xFueIMLu8VDUpcZCC85wS4zQ== X-Received: by 2002:a62:20d2:: with SMTP id m79mr51114233pfj.135.1552578872678; Thu, 14 Mar 2019 08:54:32 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id y13sm1258142pfn.31.2019.03.14.08.54.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Mar 2019 08:54:32 -0700 (PDT) Date: Thu, 14 Mar 2019 08:54:29 -0700 From: Stephen Hemminger To: Joyce Kong Cc: dev@dpdk.org, nd@arm.com, Gavin Hu , jerinj@marvell.com, konstantin.ananyev@intel.com, chaozhu@linux.vnet.ibm.com, bruce.richardson@intel.com, thomas@monjalon.net, hemant.agrawal@nxp.com, honnappa.nagarahalli@arm.com Message-ID: <20190314085429.22ccd9ca@shemminger-XPS-13-9360> In-Reply-To: <1552569304-74817-2-git-send-email-joyce.kong@arm.com> References: <1552569304-74817-1-git-send-email-joyce.kong@arm.com> <1552569304-74817-2-git-send-email-joyce.kong@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 1/3] rwlock: reimplement with atomic builtins 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" Message-ID: <20190314155429.lhA9gpeIyjokqOQHlvC7myq94rd57vVR1hcEfg2bFkg@z> On Thu, 14 Mar 2019 21:15:02 +0800 Joyce Kong wrote: > - success = rte_atomic32_cmpset((volatile uint32_t *)&rwl->cnt, > - (uint32_t)x, (uint32_t)(x + 1)); > + success = __atomic_compare_exchange_n(&rwl->cnt, &x, x+1, 1, > + __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); Would it be possible to have rte_atomic32_cmpset be an inline function that became __atomic_comppare_exchange? Then all usages would be the same.