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 8E03B42B91; Wed, 24 May 2023 22:10:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B9C94067E; Wed, 24 May 2023 22:10:18 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id E9A1D40156 for ; Wed, 24 May 2023 22:10:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684959016; 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=bEpb+rHPerSEFJyMe9Lc1VGkWTol6UQt4aAA2CRnG9c=; b=cm/YP2ggnhCjyMB6t3o1p2/cl6Xg3IgNVUyeQ98p1/rMjRWckdiKEtZCO4x3q7Ec3FOfrh ftyzS5VJCQqw5UTCQ9x4mzuavlLT3SyVJoSwgJZ+r58m/oaksfhIGz1NoHp/T4AhndGT9E pWuQtiaPQWHaJ2c+sc2uxMcnvIIXqdk= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-66-cF8OZHVlN6yOcTQsZ1Tdzg-1; Wed, 24 May 2023 16:10:15 -0400 X-MC-Unique: cF8OZHVlN6yOcTQsZ1Tdzg-1 Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-1ae818c0fdaso6361105ad.0 for ; Wed, 24 May 2023 13:10:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684959014; x=1687551014; 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=bEpb+rHPerSEFJyMe9Lc1VGkWTol6UQt4aAA2CRnG9c=; b=TwSvrtLNDgc83jmSKTLKwK0bZYQaQLJTa3d4bMw9RUYxM8E7OgIq+dqdGOrdkbwmWm 4v1wl9cWkJ7k/yb8GCtQumxwVJCxYQr95uIqTmGsyi53R5cqZf3SX1GHze33nI3I7fUZ MZhviG2GSS9yCHyMytwpNEP7z+ZUz5PR1Z7WPT0rTowAmqpzh8vHSgkzOsYy3/JIHCUc J6YDvbPA6OJj60jvDJkDoc4Cy8CtEzE4ixhqziAt7aH/wR+3BYdT5L4m/LXSFQ3fJGXv lKHJlaD5RkzfX9HDDk4HEtagF5myPO8FnK0bU+DHenrh04dSm78a6ks+x0GwGFOPDiMq SBeQ== X-Gm-Message-State: AC+VfDyK0o0i9FRwN1o/W2e3F3WxRVTPnEzzoiM8xJB13XNrKRL8cN3f bsXHznsvqcin+bjJoT5gHc2IedUrMRuc98/h/KiPkLgJ7fBsZ5Zgyr7Y7ST9fRx6YBKTpsQNmqV x1hYmUgvdvuh6NsbC5rM= X-Received: by 2002:a17:902:ce83:b0:1ac:b449:3528 with SMTP id f3-20020a170902ce8300b001acb4493528mr21325432plg.46.1684959014435; Wed, 24 May 2023 13:10:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7zckb8Np1Z79Mz+MmDloSjG1G/QjLAHQ8jBjGqF5RqnJblrnug/f9NZw03BIfqplnYO9/JKD4cvLunhLXmJMM= X-Received: by 2002:a17:902:ce83:b0:1ac:b449:3528 with SMTP id f3-20020a170902ce8300b001acb4493528mr21325413plg.46.1684959014217; Wed, 24 May 2023 13:10:14 -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-5-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1679612036-30773-5-git-send-email-roretzla@linux.microsoft.com> From: David Marchand Date: Wed, 24 May 2023 22:10:03 +0200 Message-ID: Subject: Re: [PATCH v3 4/7] net/ice: replace rte atomics with GCC builtin atomics To: Qiming Yang , Qi Zhang 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 Qiming, Qi, 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/net/ice/ice_dcf.c | 1 - > drivers/net/ice/ice_dcf_ethdev.c | 1 - > drivers/net/ice/ice_ethdev.c | 12 ++++++++---- > 3 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c > index 1c3d22a..80d2cbd 100644 > --- a/drivers/net/ice/ice_dcf.c > +++ b/drivers/net/ice/ice_dcf.c > @@ -14,7 +14,6 @@ > #include > > #include > -#include > #include > #include > #include > diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_e= thdev.c > index dcbf2af..13ff245 100644 > --- a/drivers/net/ice/ice_dcf_ethdev.c > +++ b/drivers/net/ice/ice_dcf_ethdev.c > @@ -11,7 +11,6 @@ > #include > #include > #include > -#include > #include > #include > #include > diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c > index 9a88cf9..a04fca8 100644 > --- a/drivers/net/ice/ice_ethdev.c > +++ b/drivers/net/ice/ice_ethdev.c > @@ -3927,8 +3927,10 @@ static int ice_init_rss(struct ice_pf *pf) > struct rte_eth_link *dst =3D link; > struct rte_eth_link *src =3D &dev->data->dev_link; > > - if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, > - *(uint64_t *)src) =3D=3D 0) > + /* NOTE: review for potential ordering optimization */ > + if (!__atomic_compare_exchange_n((uint64_t *)dst, > + (uint64_t *)dst, *(uint64_t *)src, 0, > + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) > return -1; > > return 0; > @@ -3941,8 +3943,10 @@ static int ice_init_rss(struct ice_pf *pf) > struct rte_eth_link *dst =3D &dev->data->dev_link; > struct rte_eth_link *src =3D link; > > - if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, > - *(uint64_t *)src) =3D=3D 0) > + /* NOTE: review for potential ordering optimization */ > + if (!__atomic_compare_exchange_n((uint64_t *)dst, > + (uint64_t *)dst, *(uint64_t *)src, 0, > + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) > return -1; > > return 0; > -- > 1.8.3.1 > --=20 David Marchand