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 5E4B342B91; Wed, 24 May 2023 22:09:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 50B4D4067E; Wed, 24 May 2023 22:09:20 +0200 (CEST) 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 7A15240156 for ; Wed, 24 May 2023 22:09:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684958957; 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=95dpeFRFCAgMcwMUkCosqhrBgSYa69bOsqa5NUdd1RE=; b=QArYs3JjPGX3mgNSFKa8kOJxuyzddxqPwhEcOaKYIVQPqr4MoSVBwEVVaaSV7HP1pXktBN Jh66mO5Q/57AuQu3Itj79Q6NnN1aEOMmdKJXpgfdPtJo/x9n0Dagjl4z0JcpNNx7J4HU26 d6gzJT/EVSBiLMhrkFes7IUxuHe5CK0= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-169-MhL4fU0FPV2H76ip7ZNtIw-1; Wed, 24 May 2023 16:09:16 -0400 X-MC-Unique: MhL4fU0FPV2H76ip7ZNtIw-1 Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2555076ea4dso636021a91.2 for ; Wed, 24 May 2023 13:09:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684958955; x=1687550955; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=95dpeFRFCAgMcwMUkCosqhrBgSYa69bOsqa5NUdd1RE=; b=LEujOMjANbF20rOc1xBfy/S3nzc0QR3kUfK7kv/kfNV+0aMTiO+o3DKZAtReL3Xq3n L3JZsfbF9+6JlVgxq0SjWssoBJNoRpPccLUcptFre5DNLTZqdQOACWbuKO/ud9NgVBmr 5I52sCByrdDrHEzMuDgWl8E4RDDuO5mBNPKvlv9W97unHaF/2z654eP039/gcpPLa9yq GRyn4624iWLR8g6JdZXranFL7uIC66ag6IDiz0zGRLiYimFCkxND70hf79z2uZO+FDI4 AWR/PodUdJ174Ec/CMACne8KSokVDA3jQmad/PAyvD3h/pgxMUQXlMBmNMJWPVoKcd/Z j/yg== X-Gm-Message-State: AC+VfDySXuslb4lQ2qdyWkK98X6HqMEbHxwbaQvZ6hKO7Hy6OkpP9GfO Rzvsr03VFx9jcEfmxY2ejh/Nspj1ge2o/CR4munl7926og8X2TnL+Phcbw6bOz+LJU+N/IECllX sap8FLWs+2X7vkO1NRm0= X-Received: by 2002:a17:903:11cd:b0:1a6:84be:a08f with SMTP id q13-20020a17090311cd00b001a684bea08fmr19571691plh.64.1684958955558; Wed, 24 May 2023 13:09:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7jfqA9RJJPjyNNyNUF+DOoNPJuaUh1ksT82HoBwMC3dN3BWfEpuCO9AF+kWLDWrNCSgHBibsh+W05OYctOB9A= X-Received: by 2002:a17:903:11cd:b0:1a6:84be:a08f with SMTP id q13-20020a17090311cd00b001a684bea08fmr19571672plh.64.1684958955258; Wed, 24 May 2023 13:09:15 -0700 (PDT) MIME-Version: 1.0 References: <1679084388-19267-1-git-send-email-roretzla@linux.microsoft.com> <1679612036-30773-1-git-send-email-roretzla@linux.microsoft.com> <1679612036-30773-4-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1679612036-30773-4-git-send-email-roretzla@linux.microsoft.com> From: David Marchand Date: Wed, 24 May 2023 22:09:04 +0200 Message-ID: Subject: Re: [PATCH v3 3/7] dma/idxd: replace rte atomics with GCC builtin atomics To: Bruce Richardson , Kevin Laatz Cc: dev@dpdk.org, Honnappa.Nagarahalli@arm.com, Ruifeng.Wang@arm.com, thomas@monjalon.net, stephen@networkplumber.org, mb@smartsharesystems.com, Tyler Retzlaff X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Hello Bruce, Kevin, Review please. On Thu, Mar 23, 2023 at 11:54=E2=80=AFPM Tyler Retzlaff wrote: > > Replace the use of rte_atomic.h types and functions, instead use GCC > supplied C++11 memory model builtins. > > Signed-off-by: Tyler Retzlaff > --- > drivers/dma/idxd/idxd_internal.h | 3 +-- > drivers/dma/idxd/idxd_pci.c | 8 +++++--- > 2 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/dma/idxd/idxd_internal.h b/drivers/dma/idxd/idxd_int= ernal.h > index 180a858..cd41777 100644 > --- a/drivers/dma/idxd/idxd_internal.h > +++ b/drivers/dma/idxd/idxd_internal.h > @@ -7,7 +7,6 @@ > > #include > #include > -#include > > #include "idxd_hw_defs.h" > > @@ -34,7 +33,7 @@ struct idxd_pci_common { > rte_spinlock_t lk; > > uint8_t wq_cfg_sz; > - rte_atomic16_t ref_count; > + uint16_t ref_count; > volatile struct rte_idxd_bar0 *regs; > volatile uint32_t *wq_regs_base; > volatile struct rte_idxd_grpcfg *grp_regs; > diff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c > index 781fa02..2de5d15 100644 > --- a/drivers/dma/idxd/idxd_pci.c > +++ b/drivers/dma/idxd/idxd_pci.c > @@ -6,7 +6,6 @@ > #include > #include > #include > -#include > > #include "idxd_internal.h" > > @@ -136,7 +135,9 @@ > /* if this is the last WQ on the device, disable the device and f= ree > * the PCI struct > */ > - is_last_wq =3D rte_atomic16_dec_and_test(&idxd->u.pci->ref_count)= ; > + /* NOTE: review for potential ordering optimization */ > + is_last_wq =3D __atomic_fetch_sub(&idxd->u.pci->ref_count, 1, > + __ATOMIC_SEQ_CST) - 1 =3D=3D 0; > if (is_last_wq) { > /* disable the device */ > err_code =3D idxd_pci_dev_command(idxd, idxd_disable_dev)= ; > @@ -350,7 +351,8 @@ > free(idxd.u.pci); > return ret; > } > - rte_atomic16_inc(&idxd.u.pci->ref_count); > + /* NOTE: review for potential ordering optimization */ > + __atomic_fetch_add(&idxd.u.pci->ref_count, 1, __ATOMIC_SE= Q_CST); > } > > return 0; > -- > 1.8.3.1 > --=20 David Marchand