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 02C0043215; Fri, 27 Oct 2023 15:05:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3C0742DD1; Fri, 27 Oct 2023 15:05:49 +0200 (CEST) Received: from forward502c.mail.yandex.net (forward502c.mail.yandex.net [178.154.239.210]) by mails.dpdk.org (Postfix) with ESMTP id 1B8FF42DCB for ; Fri, 27 Oct 2023 15:05:49 +0200 (CEST) Received: from mail-nwsmtp-smtp-production-main-91.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-91.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:47a7:0:640:b27a:0]) by forward502c.mail.yandex.net (Yandex) with ESMTP id 95CD561177; Fri, 27 Oct 2023 16:05:48 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-91.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id q4RKICMDYuQ0-yFwSL2gU; Fri, 27 Oct 2023 16:05:47 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1698411947; bh=NfEGBofzgkZTermyPDeYofSbC0J5TamqDuVMhkskcw8=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=Zvf8DNmuScNCdIyKcRnS1fh5/9et12HMFDGiK2AA9VVzcbVo6LElSdi224Net+zCQ dTP7UOoPadNouZe6uzd+UdvJlmxJyQmrb+8ow6cJkzjDWQkNaNkjI7zsI6+L9NDtSC H9dcM2OEsJ0GyzegCZ+1KhjTclPFEpSsNcl8gl2k= Authentication-Results: mail-nwsmtp-smtp-production-main-91.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <280f4bff-6f12-422a-a6ef-f518c6e9bb85@yandex.ru> Date: Fri, 27 Oct 2023 14:05:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 14/19] cryptodev: use rte optional stdatomic API Content-Language: en-US, ru-RU To: Tyler Retzlaff , dev@dpdk.org Cc: Akhil Goyal , Anatoly Burakov , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Ciara Power , David Christensen , David Hunt , Dmitry Kozlyuk , Dmitry Malloy , Elena Agostini , Erik Gabriel Carrillo , Fan Zhang , Ferruh Yigit , Harman Kalra , Harry van Haaren , Honnappa Nagarahalli , Jerin Jacob , Matan Azrad , Maxime Coquelin , Narcisa Ana Maria Vasile , Nicolas Chautru , Olivier Matz , Ori Kam , Pallavi Kadam , Pavan Nikhilesh , Reshma Pattan , Sameh Gobriel , Shijith Thotton , Sivaprasad Tummala , Stephen Hemminger , Suanming Mou , Sunil Kumar Kori , Thomas Monjalon , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang References: <1697497745-20664-1-git-send-email-roretzla@linux.microsoft.com> <1698280314-25861-1-git-send-email-roretzla@linux.microsoft.com> <1698280314-25861-15-git-send-email-roretzla@linux.microsoft.com> From: Konstantin Ananyev In-Reply-To: <1698280314-25861-15-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 26.10.2023 01:31, Tyler Retzlaff пишет: > Replace the use of gcc builtin __atomic_xxx intrinsics with > corresponding rte_atomic_xxx optional stdatomic API > > Signed-off-by: Tyler Retzlaff > --- > lib/cryptodev/rte_cryptodev.c | 22 ++++++++++++---------- > lib/cryptodev/rte_cryptodev.h | 16 ++++++++-------- > 2 files changed, 20 insertions(+), 18 deletions(-) > > diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c > index 314710b..b258827 100644 > --- a/lib/cryptodev/rte_cryptodev.c > +++ b/lib/cryptodev/rte_cryptodev.c > @@ -1535,12 +1535,12 @@ struct rte_cryptodev_cb * > /* Stores to cb->fn and cb->param should complete before > * cb is visible to data plane. > */ > - __atomic_store_n(&tail->next, cb, __ATOMIC_RELEASE); > + rte_atomic_store_explicit(&tail->next, cb, rte_memory_order_release); > } else { > /* Stores to cb->fn and cb->param should complete before > * cb is visible to data plane. > */ > - __atomic_store_n(&list->next, cb, __ATOMIC_RELEASE); > + rte_atomic_store_explicit(&list->next, cb, rte_memory_order_release); > } > > rte_spinlock_unlock(&rte_cryptodev_callback_lock); > @@ -1555,7 +1555,8 @@ struct rte_cryptodev_cb * > struct rte_cryptodev_cb *cb) > { > struct rte_cryptodev *dev; > - struct rte_cryptodev_cb **prev_cb, *curr_cb; > + RTE_ATOMIC(struct rte_cryptodev_cb *) *prev_cb; > + struct rte_cryptodev_cb *curr_cb; > struct rte_cryptodev_cb_rcu *list; > int ret; > > @@ -1601,8 +1602,8 @@ struct rte_cryptodev_cb * > curr_cb = *prev_cb; > if (curr_cb == cb) { > /* Remove the user cb from the callback list. */ > - __atomic_store_n(prev_cb, curr_cb->next, > - __ATOMIC_RELAXED); > + rte_atomic_store_explicit(prev_cb, curr_cb->next, > + rte_memory_order_relaxed); > ret = 0; > break; > } > @@ -1673,12 +1674,12 @@ struct rte_cryptodev_cb * > /* Stores to cb->fn and cb->param should complete before > * cb is visible to data plane. > */ > - __atomic_store_n(&tail->next, cb, __ATOMIC_RELEASE); > + rte_atomic_store_explicit(&tail->next, cb, rte_memory_order_release); > } else { > /* Stores to cb->fn and cb->param should complete before > * cb is visible to data plane. > */ > - __atomic_store_n(&list->next, cb, __ATOMIC_RELEASE); > + rte_atomic_store_explicit(&list->next, cb, rte_memory_order_release); > } > > rte_spinlock_unlock(&rte_cryptodev_callback_lock); > @@ -1694,7 +1695,8 @@ struct rte_cryptodev_cb * > struct rte_cryptodev_cb *cb) > { > struct rte_cryptodev *dev; > - struct rte_cryptodev_cb **prev_cb, *curr_cb; > + RTE_ATOMIC(struct rte_cryptodev_cb *) *prev_cb; > + struct rte_cryptodev_cb *curr_cb; > struct rte_cryptodev_cb_rcu *list; > int ret; > > @@ -1740,8 +1742,8 @@ struct rte_cryptodev_cb * > curr_cb = *prev_cb; > if (curr_cb == cb) { > /* Remove the user cb from the callback list. */ > - __atomic_store_n(prev_cb, curr_cb->next, > - __ATOMIC_RELAXED); > + rte_atomic_store_explicit(prev_cb, curr_cb->next, > + rte_memory_order_relaxed); > ret = 0; > break; > } > diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h > index be0698c..9092118 100644 > --- a/lib/cryptodev/rte_cryptodev.h > +++ b/lib/cryptodev/rte_cryptodev.h > @@ -979,7 +979,7 @@ struct rte_cryptodev_config { > * queue pair on enqueue/dequeue. > */ > struct rte_cryptodev_cb { > - struct rte_cryptodev_cb *next; > + RTE_ATOMIC(struct rte_cryptodev_cb *) next; > /**< Pointer to next callback */ > rte_cryptodev_callback_fn fn; > /**< Pointer to callback function */ > @@ -992,7 +992,7 @@ struct rte_cryptodev_cb { > * Structure used to hold information about the RCU for a queue pair. > */ > struct rte_cryptodev_cb_rcu { > - struct rte_cryptodev_cb *next; > + RTE_ATOMIC(struct rte_cryptodev_cb *) next; > /**< Pointer to next callback */ > struct rte_rcu_qsbr *qsbr; > /**< RCU QSBR variable per queue pair */ > @@ -1947,15 +1947,15 @@ int rte_cryptodev_remove_deq_callback(uint8_t dev_id, > struct rte_cryptodev_cb_rcu *list; > struct rte_cryptodev_cb *cb; > > - /* __ATOMIC_RELEASE memory order was used when the > + /* rte_memory_order_release memory order was used when the > * call back was inserted into the list. > * Since there is a clear dependency between loading > - * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is > + * cb and cb->fn/cb->next, rte_memory_order_acquire memory order is > * not required. > */ > list = &fp_ops->qp.deq_cb[qp_id]; > rte_rcu_qsbr_thread_online(list->qsbr, 0); > - cb = __atomic_load_n(&list->next, __ATOMIC_RELAXED); > + cb = rte_atomic_load_explicit(&list->next, rte_memory_order_relaxed); > > while (cb != NULL) { > nb_ops = cb->fn(dev_id, qp_id, ops, nb_ops, > @@ -2014,15 +2014,15 @@ int rte_cryptodev_remove_deq_callback(uint8_t dev_id, > struct rte_cryptodev_cb_rcu *list; > struct rte_cryptodev_cb *cb; > > - /* __ATOMIC_RELEASE memory order was used when the > + /* rte_memory_order_release memory order was used when the > * call back was inserted into the list. > * Since there is a clear dependency between loading > - * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is > + * cb and cb->fn/cb->next, rte_memory_order_acquire memory order is > * not required. > */ > list = &fp_ops->qp.enq_cb[qp_id]; > rte_rcu_qsbr_thread_online(list->qsbr, 0); > - cb = __atomic_load_n(&list->next, __ATOMIC_RELAXED); > + cb = rte_atomic_load_explicit(&list->next, rte_memory_order_relaxed); > > while (cb != NULL) { > nb_ops = cb->fn(dev_id, qp_id, ops, nb_ops, Acked-by: Konstantin Ananyev