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 3C42342B91; Wed, 24 May 2023 22:11:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E0084067E; Wed, 24 May 2023 22:11:44 +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 DF7F740156 for ; Wed, 24 May 2023 22:11:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684959102; 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=xK1BCfBXKWm58tKX6BsoFPjgKSoqTZjs+Pi1ZlXXWMc=; b=LCENEH93VExBbWf1pg+Hd36rw1vh7VEbhOfU5rJCu2zbX5dVSowUudPeMfgljV80nHICAH yov46xXPCchWHtFIFw4XvFG8rkjoXFoNqM0JuNg82G/0q18QTMCgfJR299A67aFtIAnsfq coJjavz8qHfJqZDKTmDCMbMoYvbNe+c= Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-bbYrbc8BOoi2X4RfYzJDyg-1; Wed, 24 May 2023 16:11:41 -0400 X-MC-Unique: bbYrbc8BOoi2X4RfYzJDyg-1 Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-517bfcfe83fso427606a12.2 for ; Wed, 24 May 2023 13:11:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684959100; x=1687551100; 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=xK1BCfBXKWm58tKX6BsoFPjgKSoqTZjs+Pi1ZlXXWMc=; b=OrokhAga2I0h05gjUM4eROEaMVdeXlShd8pirR7P08sX25s/s5US4pzMSyDy9P6Bek KYMdLKx17KD//SsS4BD2veffG8o4Fhvkaa3y8k9hodbYszDGxOG2DDvNPgEAZK2VjbCu SeXBJCGmhYGnuCf2UvyFquPDRrDF/11gXV/W9N9hyKJ0GOtDkB2ZGmDAgCOqExNcMMhm H0IsIR0DqwIQu4Z0K1L6qYk1Z6GvXBPyaYeEdYJ2cV/Yv92nu6TE1EWXwCeY4uslJq8O 5ioRn5odv6iTXOgCNlBHBN7GuXzPZ8AZI0wFSPdj4yLXwfciRQhSDZeOM/xmdvYuU1FM x43g== X-Gm-Message-State: AC+VfDxvgqyjE39KSrKb7UzlW+4zB5IhLM/mocv9mtO4E5E0uGddkr48 7FiR5O9VyUbrzBUgSJjTRqUMtLr/D4yHZpm/zY0AwjsWP383FQmO0WFSCPW5BMqwR/IEN7fzJEo RcGk2qacaBW8OOwizljM= X-Received: by 2002:a17:902:f54d:b0:1a6:45e5:a26a with SMTP id h13-20020a170902f54d00b001a645e5a26amr24186018plf.27.1684959100110; Wed, 24 May 2023 13:11:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5brFfX0BHJGxvt+DeqSYGFwDLcywNyO7dIWyhTw+JtD2HBvSUwNAcRZZ8zooanwAC2qYJOxbMdqfu+SVh6qwM= X-Received: by 2002:a17:902:f54d:b0:1a6:45e5:a26a with SMTP id h13-20020a170902f54d00b001a645e5a26amr24185998plf.27.1684959099810; Wed, 24 May 2023 13:11:39 -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-6-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1679612036-30773-6-git-send-email-roretzla@linux.microsoft.com> From: David Marchand Date: Wed, 24 May 2023 22:11:28 +0200 Message-ID: Subject: Re: [PATCH v3 5/7] net/ixgbe: replace rte atomics with GCC builtin atomics To: Qiming Yang , Wenjun Wu 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, Wenjun, 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/ixgbe/ixgbe_bypass.c | 1 - > drivers/net/ixgbe/ixgbe_ethdev.c | 18 ++++++++++++------ > drivers/net/ixgbe/ixgbe_ethdev.h | 3 ++- > drivers/net/ixgbe/ixgbe_flow.c | 1 - > drivers/net/ixgbe/ixgbe_rxtx.c | 1 - > 5 files changed, 14 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/ixgbe/ixgbe_bypass.c b/drivers/net/ixgbe/ixgbe_b= ypass.c > index 94f34a2..f615d18 100644 > --- a/drivers/net/ixgbe/ixgbe_bypass.c > +++ b/drivers/net/ixgbe/ixgbe_bypass.c > @@ -3,7 +3,6 @@ > */ > > #include > -#include > #include > #include "ixgbe_ethdev.h" > #include "ixgbe_bypass_api.h" > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_e= thdev.c > index 88118bc..4bb85af 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -1127,7 +1127,8 @@ struct rte_ixgbe_xstats_name_off { > return 0; > } > > - rte_atomic32_clear(&ad->link_thread_running); > + /* NOTE: review for potential ordering optimization */ > + __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST); > ixgbe_parse_devargs(eth_dev->data->dev_private, > pci_dev->device.devargs); > rte_eth_copy_pci_info(eth_dev, pci_dev); > @@ -1625,7 +1626,8 @@ static int ixgbe_l2_tn_filter_init(struct rte_eth_d= ev *eth_dev) > return 0; > } > > - rte_atomic32_clear(&ad->link_thread_running); > + /* NOTE: review for potential ordering optimization */ > + __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST); > ixgbevf_parse_devargs(eth_dev->data->dev_private, > pci_dev->device.devargs); > > @@ -4186,7 +4188,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unuse= d struct rte_eth_dev *dev, > struct ixgbe_adapter *ad =3D dev->data->dev_private; > uint32_t timeout =3D timeout_ms ? timeout_ms : WARNING_TIMEOUT; > > - while (rte_atomic32_read(&ad->link_thread_running)) { > + /* NOTE: review for potential ordering optimization */ > + while (__atomic_load_n(&ad->link_thread_running, __ATOMIC_SEQ_CST= )) { > msec_delay(1); > timeout--; > > @@ -4222,7 +4225,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unuse= d struct rte_eth_dev *dev, > ixgbe_setup_link(hw, speed, true); > > intr->flags &=3D ~IXGBE_FLAG_NEED_LINK_CONFIG; > - rte_atomic32_clear(&ad->link_thread_running); > + /* NOTE: review for potential ordering optimization */ > + __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST); > return NULL; > } > > @@ -4317,7 +4321,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unuse= d struct rte_eth_dev *dev, > if (link_up =3D=3D 0) { > if (ixgbe_get_media_type(hw) =3D=3D ixgbe_media_type_fibe= r) { > ixgbe_dev_wait_setup_link_complete(dev, 0); > - if (rte_atomic32_test_and_set(&ad->link_thread_ru= nning)) { > + /* NOTE: review for potential ordering optimizati= on */ > + if (__atomic_test_and_set(&ad->link_thread_runnin= g, __ATOMIC_SEQ_CST)) { > /* To avoid race condition between thread= s, set > * the IXGBE_FLAG_NEED_LINK_CONFIG flag o= nly > * when there is no link thread running. > @@ -4330,7 +4335,8 @@ static int ixgbevf_dev_xstats_get_names(__rte_unuse= d struct rte_eth_dev *dev, > dev) < 0) { > PMD_DRV_LOG(ERR, > "Create link thread faile= d!"); > - rte_atomic32_clear(&ad->link_thre= ad_running); > + /* NOTE: review for potential ord= ering optimization */ > + __atomic_clear(&ad->link_thread_r= unning, __ATOMIC_SEQ_CST); > } > } else { > PMD_DRV_LOG(ERR, > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_e= thdev.h > index 48290af..2ca6998 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.h > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h > @@ -6,6 +6,7 @@ > #define _IXGBE_ETHDEV_H_ > > #include > +#include > #include > > #include "base/ixgbe_type.h" > @@ -510,7 +511,7 @@ struct ixgbe_adapter { > */ > uint8_t pflink_fullchk; > uint8_t mac_ctrl_frame_fwd; > - rte_atomic32_t link_thread_running; > + bool link_thread_running; > pthread_t link_thread_tid; > }; > > diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flo= w.c > index eac81ee..687341c 100644 > --- a/drivers/net/ixgbe/ixgbe_flow.c > +++ b/drivers/net/ixgbe/ixgbe_flow.c > @@ -18,7 +18,6 @@ > #include > #include > #include > -#include > #include > #include > #include > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxt= x.c > index c9d6ca9..8d7251d 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > @@ -27,7 +27,6 @@ > #include > #include > #include > -#include > #include > #include > #include > -- > 1.8.3.1 > --=20 David Marchand