DPDK patches and discussions
 help / color / mirror / Atom feed
From: Feifei Wang <Feifei.Wang2@arm.com>
To: David Marchand <david.marchand@redhat.com>
Cc: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>,
	dev <dev@dpdk.org>, nd <nd@arm.com>,
	Ruifeng Wang <Ruifeng.Wang@arm.com>, nd <nd@arm.com>
Subject: [dpdk-dev] 回复:  [PATCH v1 2/2] mcslock: use wait until equal API for tight loop
Date: Wed, 20 Oct 2021 02:46:24 +0000	[thread overview]
Message-ID: <DB9PR08MB6923E8869A3E80B67029B812C8BE9@DB9PR08MB6923.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <CAJFAV8yvw0Haq4PxuQBLd3XyKfjasjTsvQ-tv8fDsxK-vp=dvA@mail.gmail.com>

> -----邮件原件-----
> 发件人: dev <dev-bounces@dpdk.org> 代表 David Marchand
> 发送时间: Tuesday, October 19, 2021 7:10 PM
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>
> 抄送: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; dev
> <dev@dpdk.org>; nd <nd@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>
> 主题: Re: [dpdk-dev] [PATCH v1 2/2] mcslock: use wait until equal API for
> tight loop
> 
> 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?
Thanks for the comments.
This is firstly because rte_wait_until_equal API defines the variable as volatile.
However, with your comment, I find 'me->lock' is not volatile. And by the test,
I think you are right, it is necessary to add volatile here.
> 
> 
> --
> David Marchand


  reply	other threads:[~2021-10-20  2:46 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
2021-10-20  2:46     ` Feifei Wang [this message]
2021-10-20  2:54       ` [dpdk-dev] 回复: " 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=DB9PR08MB6923E8869A3E80B67029B812C8BE9@DB9PR08MB6923.eurprd08.prod.outlook.com \
    --to=feifei.wang2@arm.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=nd@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).