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 9BFA641DB5; Thu, 2 Mar 2023 16:50:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81E1A40E09; Thu, 2 Mar 2023 16:50:56 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C5B25400D6 for ; Thu, 2 Mar 2023 16:50:55 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id B5C9920B9C3D; Thu, 2 Mar 2023 07:50:54 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B5C9920B9C3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1677772254; bh=R6kWeQrJ9EFsWy8u15kWRWCQDHomX7CG7SeQFf7q3HQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Rv/9/GhY7v+hjeZr0feoGs+CcExOOoZB/DRGTqV+GJ+JbPGeWHah/8ilVhCEAb/d3 KCGCBXb9A8lBQfWNHa4DBAs/gjXPiYCWWrg9u6Ikl1I5CYxRM5EnhCR/Y1VP/uJjI5 yJWr0l3xukvPfip5rStHvT6SxJ80OcuhFOqM2rkc= Date: Thu, 2 Mar 2023 07:50:54 -0800 From: Tyler Retzlaff To: Ruifeng Wang Cc: "dev@dpdk.org" , Honnappa Nagarahalli , "thomas@monjalon.net" , nd Subject: Re: [PATCH 11/17] net/iavf: use previous value atomic fetch operations Message-ID: <20230302155054.GA29061@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1677718068-2412-1-git-send-email-roretzla@linux.microsoft.com> <1677718068-2412-12-git-send-email-roretzla@linux.microsoft.com> 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 Thu, Mar 02, 2023 at 09:28:09AM +0000, Ruifeng Wang wrote: > > -----Original Message----- > > From: Tyler Retzlaff > > Sent: Thursday, March 2, 2023 8:48 AM > > To: dev@dpdk.org > > Cc: Honnappa Nagarahalli ; thomas@monjalon.net; Tyler > > Retzlaff > > Subject: [PATCH 11/17] net/iavf: use previous value atomic fetch operations > > > > Use __atomic_fetch_{add,and,or,sub,xor} instead of __atomic_{add,and,or,sub,xor}_fetch > > when we have no interest in the result of the operation. > > > > Reduces unnecessary codegen that provided the result of the atomic operation that was not > > used. > > > > Change brings closer alignment with atomics available in C11 standard and will reduce > > review effort when they are integrated. > > > > Signed-off-by: Tyler Retzlaff > > --- > > drivers/net/iavf/iavf_vchnl.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index > > 9adaadb..73875d7 100644 > > --- a/drivers/net/iavf/iavf_vchnl.c > > +++ b/drivers/net/iavf/iavf_vchnl.c > > @@ -128,7 +128,7 @@ struct iavf_event_handler { > > int err = pipe(handler->fd); > > #endif > > if (err != 0) { > > - __atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED); > > + __atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED); > > return -1; > > } > > > > @@ -137,7 +137,7 @@ struct iavf_event_handler { > > > > if (rte_ctrl_thread_create(&handler->tid, "iavf-event-thread", > > NULL, iavf_dev_event_handle, NULL)) { > > - __atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED); > > + __atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED); > > return -1; > > } > > > > @@ -533,7 +533,7 @@ struct iavf_event_handler { > > /* read message and it's expected one */ > > if (msg_opc == vf->pend_cmd) { > > uint32_t cmd_count = > > - __atomic_sub_fetch(&vf->pend_cmd_count, > > + __atomic_fetch_sub(&vf->pend_cmd_count, > > It doesn't apply here. The return value is used. > The rest of the series looks good to me. oh, i was blind to the line wrapping. definitely not correct. thanks for catching this, will submit v2 with it reverted. > > > 1, __ATOMIC_RELAXED); > > if (cmd_count == 0) > > _notify_cmd(vf, msg_ret); > > -- > > 1.8.3.1