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 2EC4D41DB5; Thu, 2 Mar 2023 15:48:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F04740E09; Thu, 2 Mar 2023 15:48:28 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 39376400D6 for ; Thu, 2 Mar 2023 15:48:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677768505; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iiMrmyIHsIyGVbuk7/gYvCD2QUGpo+Ny8uYVupYep4E=; b=Tp0bvikN+rUwF4hUaYyRUz8hc+osnH5dAnVMMP8uW78tX66z6g6EjO95MNv33nK3u7Uo6O Uw8Lew475rmv9uYZnTRIMJjKs598cDau5mHy1MlY4v6NNnk0DH1h/DWO5pPvCST4MOAwlh 6Jx9OZ5oLYg8aD/rwWW3lrVuL42/3YU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-627-xAoFYQTPPZOOfBPYZTXRnw-1; Thu, 02 Mar 2023 09:48:22 -0500 X-MC-Unique: xAoFYQTPPZOOfBPYZTXRnw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5B7DA2800487; Thu, 2 Mar 2023 14:48:22 +0000 (UTC) Received: from [10.39.208.28] (unknown [10.39.208.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7784B40C6EC4; Thu, 2 Mar 2023 14:48:21 +0000 (UTC) Message-ID: Date: Thu, 2 Mar 2023 15:48:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 08/17] net/virtio: use previous value atomic fetch operations To: Tyler Retzlaff , dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, thomas@monjalon.net References: <1677718068-2412-1-git-send-email-roretzla@linux.microsoft.com> <1677718068-2412-9-git-send-email-roretzla@linux.microsoft.com> From: Maxime Coquelin In-Reply-To: <1677718068-2412-9-git-send-email-roretzla@linux.microsoft.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 3/2/23 01:47, Tyler Retzlaff wrote: > 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/virtio/virtio_user/virtio_user_dev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c > index f46a131..2b4607a 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -1025,7 +1025,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) > uep->id = desc_idx; > uep->len = n_descs; > > - __atomic_add_fetch(&vring->used->idx, 1, __ATOMIC_RELAXED); > + __atomic_fetch_add(&vring->used->idx, 1, __ATOMIC_RELAXED); > } > } > Reviewed-by: Maxime Coquelin Thanks, Maxime