DPDK patches and discussions
 help / color / mirror / Atom feed
From: Feifei Wang <feifei.wang2@arm.com>
To: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Cc: dev@dpdk.org, nd@arm.com, Feifei Wang <feifei.wang2@arm.com>,
	Ruifeng Wang <ruifeng.wang@arm.com>
Subject: [dpdk-dev] [PATCH v1 2/2] mcslock: use wait until equal API for tight loop
Date: Wed, 25 Aug 2021 16:01:27 +0800	[thread overview]
Message-ID: <20210825080127.495645-3-feifei.wang2@arm.com> (raw)
In-Reply-To: <20210825080127.495645-1-feifei.wang2@arm.com>

Instead of polling for previous lock holder unlocking, use
wait_until_equal API.

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/eal/include/generic/rte_mcslock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/eal/include/generic/rte_mcslock.h b/lib/eal/include/generic/rte_mcslock.h
index 9f323bd2a2..c99343f22c 100644
--- a/lib/eal/include/generic/rte_mcslock.h
+++ b/lib/eal/include/generic/rte_mcslock.h
@@ -84,8 +84,8 @@ rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me)
 	 * to spin on me->locked until the previous lock holder resets
 	 * the me->locked using mcslock_unlock().
 	 */
-	while (__atomic_load_n(&me->locked, __ATOMIC_ACQUIRE))
-		rte_pause();
+	rte_wait_until_equal_32((volatile uint32_t *)&me->locked,
+			0, __ATOMIC_ACQUIRE);
 }
 
 /**
-- 
2.25.1


  parent reply	other threads:[~2021-08-25  8:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25  8:01 [dpdk-dev] [PATCH v1 0/2] replace tight loop with wait until equal api Feifei Wang
2021-08-25  8:01 ` [dpdk-dev] [PATCH v1 1/2] eal/common: use wait until equal API for tight loop Feifei Wang
2021-08-25  8:01 ` Feifei Wang [this message]
2021-10-19 11:10   ` [dpdk-dev] [PATCH v1 2/2] mcslock: " David Marchand
2021-10-20  2:46     ` [dpdk-dev] 回复: " Feifei Wang
2021-10-20  2:54       ` Feifei Wang
2021-10-15 10:07 ` [dpdk-dev] 回复: [PATCH v1 0/2] replace tight loop with wait until equal api Feifei Wang
2021-10-20  3:03 ` [dpdk-dev] [PATCH v2 " Feifei Wang
2021-10-20  3:03   ` [dpdk-dev] [PATCH v2 1/2] eal/common: use wait until equal API for tight loop Feifei Wang
2021-10-20  3:03   ` [dpdk-dev] [PATCH v2 2/2] mcslock: " Feifei Wang
2021-10-20  6:20   ` [dpdk-dev] [PATCH v2 0/2] replace tight loop with wait until equal api 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=20210825080127.495645-3-feifei.wang2@arm.com \
    --to=feifei.wang2@arm.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=nd@arm.com \
    --cc=ruifeng.wang@arm.com \
    /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).