From: David Marchand <david.marchand@redhat.com>
To: Feifei Wang <feifei.wang2@arm.com>
Cc: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
dev <dev@dpdk.org>, nd <nd@arm.com>,
Ruifeng Wang <ruifeng.wang@arm.com>
Subject: Re: [dpdk-dev] [PATCH v1 2/2] mcslock: use wait until equal API for tight loop
Date: Tue, 19 Oct 2021 13:10:11 +0200 [thread overview]
Message-ID: <CAJFAV8yvw0Haq4PxuQBLd3XyKfjasjTsvQ-tv8fDsxK-vp=dvA@mail.gmail.com> (raw)
In-Reply-To: <20210825080127.495645-3-feifei.wang2@arm.com>
On Wed, Aug 25, 2021 at 10:02 AM Feifei Wang <feifei.wang2@arm.com> wrote:
>
> 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);
Why do you need to cast as volatile?
--
David Marchand
next prev parent reply other threads:[~2021-10-19 11:10 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 ` [dpdk-dev] [PATCH v1 2/2] mcslock: " Feifei Wang
2021-10-19 11:10 ` David Marchand [this message]
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='CAJFAV8yvw0Haq4PxuQBLd3XyKfjasjTsvQ-tv8fDsxK-vp=dvA@mail.gmail.com' \
--to=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=feifei.wang2@arm.com \
--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).