DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 0/2] replace tight loop with wait until equal api
@ 2021-08-25  8:01 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
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Feifei Wang @ 2021-08-25  8:01 UTC (permalink / raw)
  Cc: dev, nd, Feifei Wang

For dpdk/lib, directly use wait_until_equal API to replace tight loop.

Feifei Wang (2):
  eal/common: use wait until equal API for tight loop
  mcslock: use wait until equal API for tight loop

 lib/eal/common/eal_common_mcfg.c      | 3 +--
 lib/eal/include/generic/rte_mcslock.h | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v1 1/2] eal/common: use wait until equal API for tight loop
  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 ` Feifei Wang
  2021-08-25  8:01 ` [dpdk-dev] [PATCH v1 2/2] mcslock: " Feifei Wang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Feifei Wang @ 2021-08-25  8:01 UTC (permalink / raw)
  Cc: dev, nd, Feifei Wang, Ruifeng Wang

Instead of polling for mcfg->magic to be updated, use wait_until_equal
API.

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/eal/common/eal_common_mcfg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/eal/common/eal_common_mcfg.c b/lib/eal/common/eal_common_mcfg.c
index c77ba97a9f..cf4a279905 100644
--- a/lib/eal/common/eal_common_mcfg.c
+++ b/lib/eal/common/eal_common_mcfg.c
@@ -30,8 +30,7 @@ eal_mcfg_wait_complete(void)
 	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
 
 	/* wait until shared mem_config finish initialising */
-	while (mcfg->magic != RTE_MAGIC)
-		rte_pause();
+	rte_wait_until_equal_32(&mcfg->magic, RTE_MAGIC, __ATOMIC_RELAXED);
 }
 
 int
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v1 2/2] mcslock: use wait until equal API for tight loop
  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
  2021-10-19 11:10   ` David Marchand
  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
  3 siblings, 1 reply; 11+ messages in thread
From: Feifei Wang @ 2021-08-25  8:01 UTC (permalink / raw)
  To: Honnappa Nagarahalli; +Cc: dev, nd, Feifei Wang, Ruifeng Wang

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] 回复: [PATCH v1 0/2] replace tight loop with wait until equal api
  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-15 10:07 ` Feifei Wang
  2021-10-20  3:03 ` [dpdk-dev] [PATCH v2 " Feifei Wang
  3 siblings, 0 replies; 11+ messages in thread
From: Feifei Wang @ 2021-10-15 10:07 UTC (permalink / raw)
  To: Feifei Wang, david.marchand, thomas, Honnappa Nagarahalli
  Cc: dev, nd, Ruifeng Wang, nd

Hi,

Would you please help review this patch series?
Thanks very much.

Best Regards
Feifei
> -----邮件原件-----
> 发件人: Feifei Wang <feifei.wang2@arm.com>
> 发送时间: Wednesday, August 25, 2021 4:01 PM
> 抄送: dev@dpdk.org; nd <nd@arm.com>; Feifei Wang
> <Feifei.Wang2@arm.com>
> 主题: [PATCH v1 0/2] replace tight loop with wait until equal api
> 
> For dpdk/lib, directly use wait_until_equal API to replace tight loop.
> 
> Feifei Wang (2):
>   eal/common: use wait until equal API for tight loop
>   mcslock: use wait until equal API for tight loop
> 
>  lib/eal/common/eal_common_mcfg.c      | 3 +--
>  lib/eal/include/generic/rte_mcslock.h | 4 ++--
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v1 2/2] mcslock: use wait until equal API for tight loop
  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     ` [dpdk-dev] 回复: " Feifei Wang
  0 siblings, 1 reply; 11+ messages in thread
From: David Marchand @ 2021-10-19 11:10 UTC (permalink / raw)
  To: Feifei Wang; +Cc: Honnappa Nagarahalli, dev, nd, Ruifeng Wang

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] 回复:  [PATCH v1 2/2] mcslock: use wait until equal API for tight loop
  2021-10-19 11:10   ` David Marchand
@ 2021-10-20  2:46     ` Feifei Wang
  2021-10-20  2:54       ` Feifei Wang
  0 siblings, 1 reply; 11+ messages in thread
From: Feifei Wang @ 2021-10-20  2:46 UTC (permalink / raw)
  To: David Marchand; +Cc: Honnappa Nagarahalli, dev, nd, Ruifeng Wang, nd

> -----邮件原件-----
> 发件人: 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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] 回复:  [PATCH v1 2/2] mcslock: use wait until equal API for tight loop
  2021-10-20  2:46     ` [dpdk-dev] 回复: " Feifei Wang
@ 2021-10-20  2:54       ` Feifei Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Feifei Wang @ 2021-10-20  2:54 UTC (permalink / raw)
  To: David Marchand; +Cc: Honnappa Nagarahalli, dev, nd, Ruifeng Wang, nd, nd



> -----邮件原件-----
> 发件人: Feifei Wang
> 发送时间: Wednesday, October 20, 2021 10:46 AM
> 收件人: David Marchand <david.marchand@redhat.com>
> 抄送: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; dev
> <dev@dpdk.org>; nd <nd@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; nd <nd@arm.com>
> 主题: 回复: [dpdk-dev] [PATCH v1 2/2] mcslock: use wait until equal API for
> tight loop
> 
> > -----邮件原件-----
> > 发件人: 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.

Sorry, correct the writing mistakes:
'It is unnecessary to add volatile here.'
> >
> >
> > --
> > David Marchand


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2 0/2] replace tight loop with wait until equal api
  2021-08-25  8:01 [dpdk-dev] [PATCH v1 0/2] replace tight loop with wait until equal api Feifei Wang
                   ` (2 preceding siblings ...)
  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 ` 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
                     ` (2 more replies)
  3 siblings, 3 replies; 11+ messages in thread
From: Feifei Wang @ 2021-10-20  3:03 UTC (permalink / raw)
  Cc: dev, nd, Feifei Wang

For dpdk/lib, directly use wait_until_equal API to replace tight loop.

v2:
1. delete wrong 'volatile' in mcslock (David)

Feifei Wang (2):
  eal/common: use wait until equal API for tight loop
  mcslock: use wait until equal API for tight loop

 lib/eal/common/eal_common_mcfg.c      | 3 +--
 lib/eal/include/generic/rte_mcslock.h | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2 1/2] eal/common: use wait until equal API for tight loop
  2021-10-20  3:03 ` [dpdk-dev] [PATCH v2 " Feifei Wang
@ 2021-10-20  3:03   ` 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
  2 siblings, 0 replies; 11+ messages in thread
From: Feifei Wang @ 2021-10-20  3:03 UTC (permalink / raw)
  Cc: dev, nd, Feifei Wang, Ruifeng Wang

Instead of polling for mcfg->magic to be updated, use wait_until_equal
API.

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/eal/common/eal_common_mcfg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/eal/common/eal_common_mcfg.c b/lib/eal/common/eal_common_mcfg.c
index c77ba97a9f..cf4a279905 100644
--- a/lib/eal/common/eal_common_mcfg.c
+++ b/lib/eal/common/eal_common_mcfg.c
@@ -30,8 +30,7 @@ eal_mcfg_wait_complete(void)
 	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
 
 	/* wait until shared mem_config finish initialising */
-	while (mcfg->magic != RTE_MAGIC)
-		rte_pause();
+	rte_wait_until_equal_32(&mcfg->magic, RTE_MAGIC, __ATOMIC_RELAXED);
 }
 
 int
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2 2/2] mcslock: use wait until equal API for tight loop
  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   ` Feifei Wang
  2021-10-20  6:20   ` [dpdk-dev] [PATCH v2 0/2] replace tight loop with wait until equal api David Marchand
  2 siblings, 0 replies; 11+ messages in thread
From: Feifei Wang @ 2021-10-20  3:03 UTC (permalink / raw)
  To: Honnappa Nagarahalli; +Cc: dev, nd, Feifei Wang, Ruifeng Wang

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 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/eal/include/generic/rte_mcslock.h b/lib/eal/include/generic/rte_mcslock.h
index 9f323bd2a2..34f33c64a5 100644
--- a/lib/eal/include/generic/rte_mcslock.h
+++ b/lib/eal/include/generic/rte_mcslock.h
@@ -84,8 +84,7 @@ 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((uint32_t *)&me->locked, 0, __ATOMIC_ACQUIRE);
 }
 
 /**
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/2] replace tight loop with wait until equal api
  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   ` David Marchand
  2 siblings, 0 replies; 11+ messages in thread
From: David Marchand @ 2021-10-20  6:20 UTC (permalink / raw)
  To: Feifei Wang; +Cc: dev, nd, Ruifeng Wang

On Wed, Oct 20, 2021 at 5:03 AM Feifei Wang <feifei.wang2@arm.com> wrote:
>
> For dpdk/lib, directly use wait_until_equal API to replace tight loop.
>
> v2:
> 1. delete wrong 'volatile' in mcslock (David)
>
> Feifei Wang (2):
>   eal/common: use wait until equal API for tight loop
>   mcslock: use wait until equal API for tight loop
>
>  lib/eal/common/eal_common_mcfg.c      | 3 +--
>  lib/eal/include/generic/rte_mcslock.h | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
>

Series applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-10-20  6:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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     ` [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

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).