From: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
To: Tyler Retzlaff <roretzla@linux.microsoft.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "Honnappa.Nagarahalli@arm.com" <Honnappa.Nagarahalli@arm.com>,
"thomas@monjalon.net" <thomas@monjalon.net>,
"bruce.richardson@intel.com" <bruce.richardson@intel.com>,
"mb@smartsharesystems.com" <mb@smartsharesystems.com>,
"Ruifeng.Wang@arm.com" <Ruifeng.Wang@arm.com>,
"maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>
Subject: RE: [EXT] [PATCH v2 13/17] drivers/event: use previous value atomic fetch operations
Date: Mon, 13 Mar 2023 07:02:10 +0000 [thread overview]
Message-ID: <PH0PR18MB40862D9F54B763181D05AF77DEB99@PH0PR18MB4086.namprd18.prod.outlook.com> (raw)
In-Reply-To: <1677773902-5167-14-git-send-email-roretzla@linux.microsoft.com>
> 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 <roretzla@linux.microsoft.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
> drivers/event/cnxk/cnxk_eventdev_selftest.c | 12 ++++++------
> drivers/event/cnxk/cnxk_tim_worker.h | 6 +++---
> drivers/event/dsw/dsw_event.c | 6 +++---
> drivers/event/octeontx/timvf_worker.h | 6 +++---
> 4 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/event/cnxk/cnxk_eventdev_selftest.c
> b/drivers/event/cnxk/cnxk_eventdev_selftest.c
> index 577c99b..95c0f1b 100644
> --- a/drivers/event/cnxk/cnxk_eventdev_selftest.c
> +++ b/drivers/event/cnxk/cnxk_eventdev_selftest.c
> @@ -554,7 +554,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
> ret = validate_event(&ev);
> RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate event");
> rte_pktmbuf_free(ev.mbuf);
> - __atomic_sub_fetch(total_events, 1, __ATOMIC_RELAXED);
> + __atomic_fetch_sub(total_events, 1, __ATOMIC_RELAXED);
> }
>
> return 0;
> @@ -916,7 +916,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
>
> if (seqn_list_update(seqn) == 0) {
> rte_pktmbuf_free(ev.mbuf);
> - __atomic_sub_fetch(total_events, 1,
> + __atomic_fetch_sub(total_events, 1,
> __ATOMIC_RELAXED);
> } else {
> plt_err("Failed to update seqn_list");
> @@ -1072,7 +1072,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
>
> if (seqn_list_update(seqn) == 0) {
> rte_pktmbuf_free(ev.mbuf);
> - __atomic_sub_fetch(total_events, 1,
> + __atomic_fetch_sub(total_events, 1,
> __ATOMIC_RELAXED);
> } else {
> plt_err("Failed to update seqn_list");
> @@ -1217,7 +1217,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
>
> if (ev.sub_event_type == MAX_STAGES) { /* last stage */
> rte_pktmbuf_free(ev.mbuf);
> - __atomic_sub_fetch(total_events, 1,
> __ATOMIC_RELAXED);
> + __atomic_fetch_sub(total_events, 1,
> __ATOMIC_RELAXED);
> } else {
> ev.event_type = RTE_EVENT_TYPE_CPU;
> ev.sub_event_type++;
> @@ -1293,7 +1293,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
>
> if (ev.queue_id == nr_queues - 1) { /* last stage */
> rte_pktmbuf_free(ev.mbuf);
> - __atomic_sub_fetch(total_events, 1,
> __ATOMIC_RELAXED);
> + __atomic_fetch_sub(total_events, 1,
> __ATOMIC_RELAXED);
> } else {
> ev.event_type = RTE_EVENT_TYPE_CPU;
> ev.queue_id++;
> @@ -1338,7 +1338,7 @@ typedef int (*validate_event_cb)(uint32_t index,
> uint8_t port,
>
> if (ev.queue_id == nr_queues - 1) { /* Last stage */
> rte_pktmbuf_free(ev.mbuf);
> - __atomic_sub_fetch(total_events, 1,
> __ATOMIC_RELAXED);
> + __atomic_fetch_sub(total_events, 1,
> __ATOMIC_RELAXED);
> } else {
> ev.event_type = RTE_EVENT_TYPE_CPU;
> ev.queue_id++;
> diff --git a/drivers/event/cnxk/cnxk_tim_worker.h
> b/drivers/event/cnxk/cnxk_tim_worker.h
> index a326d55..c087fe5 100644
> --- a/drivers/event/cnxk/cnxk_tim_worker.h
> +++ b/drivers/event/cnxk/cnxk_tim_worker.h
> @@ -102,19 +102,19 @@
> static inline void
> cnxk_tim_bkt_inc_nent(struct cnxk_tim_bkt *bktp)
> {
> - __atomic_add_fetch(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
> + __atomic_fetch_add(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
> }
>
> static inline void
> cnxk_tim_bkt_add_nent_relaxed(struct cnxk_tim_bkt *bktp, uint32_t v)
> {
> - __atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELAXED);
> + __atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELAXED);
> }
>
> static inline void
> cnxk_tim_bkt_add_nent(struct cnxk_tim_bkt *bktp, uint32_t v)
> {
> - __atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELEASE);
> + __atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELEASE);
> }
>
> static inline uint64_t
> diff --git a/drivers/event/dsw/dsw_event.c
> b/drivers/event/dsw/dsw_event.c
> index 9932caf..89badca 100644
> --- a/drivers/event/dsw/dsw_event.c
> +++ b/drivers/event/dsw/dsw_event.c
> @@ -50,7 +50,7 @@
>
> if (unlikely(new_total_on_loan > dsw->max_inflight)) {
> /* Some other port took the last credits */
> - __atomic_sub_fetch(&dsw->credits_on_loan,
> acquired_credits,
> + __atomic_fetch_sub(&dsw->credits_on_loan,
> acquired_credits,
> __ATOMIC_RELAXED);
> return false;
> }
> @@ -77,7 +77,7 @@
>
> port->inflight_credits = leave_credits;
>
> - __atomic_sub_fetch(&dsw->credits_on_loan,
> return_credits,
> + __atomic_fetch_sub(&dsw->credits_on_loan,
> return_credits,
> __ATOMIC_RELAXED);
>
> DSW_LOG_DP_PORT(DEBUG, port->id,
> @@ -527,7 +527,7 @@ struct dsw_queue_flow_burst {
> target_qfs[*targets_len] = *candidate_qf;
> (*targets_len)++;
>
> - __atomic_add_fetch(&dsw-
> >ports[candidate_port_id].immigration_load,
> + __atomic_fetch_add(&dsw-
> >ports[candidate_port_id].immigration_load,
> candidate_flow_load, __ATOMIC_RELAXED);
>
> return true;
> diff --git a/drivers/event/octeontx/timvf_worker.h
> b/drivers/event/octeontx/timvf_worker.h
> index 3f1e77f..ad98ca0 100644
> --- a/drivers/event/octeontx/timvf_worker.h
> +++ b/drivers/event/octeontx/timvf_worker.h
> @@ -108,7 +108,7 @@
> static inline void
> timr_bkt_dec_lock(struct tim_mem_bucket *bktp)
> {
> - __atomic_add_fetch(&bktp->lock, 0xff, __ATOMIC_ACQ_REL);
> + __atomic_fetch_add(&bktp->lock, 0xff, __ATOMIC_ACQ_REL);
> }
>
> static inline uint32_t
> @@ -121,13 +121,13 @@
> static inline void
> timr_bkt_inc_nent(struct tim_mem_bucket *bktp)
> {
> - __atomic_add_fetch(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
> + __atomic_fetch_add(&bktp->nb_entry, 1, __ATOMIC_RELAXED);
> }
>
> static inline void
> timr_bkt_add_nent(struct tim_mem_bucket *bktp, uint32_t v)
> {
> - __atomic_add_fetch(&bktp->nb_entry, v, __ATOMIC_RELAXED);
> + __atomic_fetch_add(&bktp->nb_entry, v, __ATOMIC_RELAXED);
> }
>
> static inline uint64_t
> --
> 1.8.3.1
next prev parent reply other threads:[~2023-03-13 7:02 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 0:47 [PATCH 00/17] use __atomic operations returning previous value Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
2023-03-02 14:47 ` Maxime Coquelin
2023-03-02 0:47 ` [PATCH 02/17] telemetry: " Tyler Retzlaff
2023-03-02 9:34 ` Bruce Richardson
2023-03-02 0:47 ` [PATCH 03/17] stack: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 04/17] eal: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 05/17] distributor: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 06/17] bbdev: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 07/17] examples/vhost: " Tyler Retzlaff
2023-03-02 14:47 ` Maxime Coquelin
2023-03-02 0:47 ` [PATCH 08/17] net/virtio: " Tyler Retzlaff
2023-03-02 14:48 ` Maxime Coquelin
2023-03-02 0:47 ` [PATCH 09/17] net/octeontx: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 10/17] net/mlx5: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 11/17] net/iavf: " Tyler Retzlaff
2023-03-02 9:28 ` Ruifeng Wang
2023-03-02 15:50 ` Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 12/17] net/cxgbe: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 13/17] drivers/event: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 14/17] dma/skeleton: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 15/17] drivers/common: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 16/17] app/test: " Tyler Retzlaff
2023-03-02 0:47 ` [PATCH 17/17] test-eventdev: " Tyler Retzlaff
2023-03-02 14:40 ` [PATCH 00/17] use __atomic operations returning previous value Morten Brørup
2023-03-02 16:18 ` [PATCH v2 " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 01/17] vhost: use previous value atomic fetch operations Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 02/17] telemetry: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 03/17] stack: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 04/17] eal: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 05/17] distributor: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 06/17] bbdev: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 07/17] examples/vhost: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 08/17] net/virtio: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 09/17] net/octeontx: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 10/17] net/mlx5: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 11/17] net/iavf: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 12/17] net/cxgbe: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 13/17] drivers/event: " Tyler Retzlaff
2023-03-13 7:02 ` Pavan Nikhilesh Bhagavatula [this message]
2023-03-02 16:18 ` [PATCH v2 14/17] dma/skeleton: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 15/17] drivers/common: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 16/17] app/test: " Tyler Retzlaff
2023-03-02 16:18 ` [PATCH v2 17/17] test-eventdev: " Tyler Retzlaff
2023-03-03 1:54 ` [PATCH v2 00/17] use __atomic operations returning previous value Ruifeng Wang
2023-03-03 2:33 ` fengchengwen
2023-04-25 9:10 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PH0PR18MB40862D9F54B763181D05AF77DEB99@PH0PR18MB4086.namprd18.prod.outlook.com \
--to=pbhagavatula@marvell.com \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=Ruifeng.Wang@arm.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=mb@smartsharesystems.com \
--cc=roretzla@linux.microsoft.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).