[v8,2/5] eal: use wait event for read pflock

Message ID 20211029082021.945586-3-feifei.wang2@arm.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series add new definitions for wait scheme |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Feifei Wang Oct. 29, 2021, 8:20 a.m. UTC
  Instead of polling for read pflock update, use wait event scheme for
this case.

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

Comments

Jerin Jacob Oct. 29, 2021, 1:55 p.m. UTC | #1
On Fri, Oct 29, 2021 at 1:50 PM Feifei Wang <feifei.wang2@arm.com> wrote:
>
> Instead of polling for read pflock update, use wait event scheme for
> this case.
>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>


> ---
>  lib/eal/include/generic/rte_pflock.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/lib/eal/include/generic/rte_pflock.h b/lib/eal/include/generic/rte_pflock.h
> index e57c179ef2..7573b036bf 100644
> --- a/lib/eal/include/generic/rte_pflock.h
> +++ b/lib/eal/include/generic/rte_pflock.h
> @@ -121,9 +121,7 @@ rte_pflock_read_lock(rte_pflock_t *pf)
>                 return;
>
>         /* Wait for current write phase to complete. */
> -       while ((__atomic_load_n(&pf->rd.in, __ATOMIC_ACQUIRE)
> -               & RTE_PFLOCK_WBITS) == w)
> -               rte_pause();
> +       rte_wait_event(&pf->rd.in, RTE_PFLOCK_WBITS, ==, w, __ATOMIC_ACQUIRE);
>  }
>
>  /**
> --
> 2.25.1
>
  
David Marchand Oct. 31, 2021, 8:37 a.m. UTC | #2
On Fri, Oct 29, 2021 at 10:20 AM Feifei Wang <feifei.wang2@arm.com> wrote:
>
> Instead of polling for read pflock update, use wait event scheme for
> this case.

Please look at git history for this file.
Prefix should be pflock:



>
> Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
  

Patch

diff --git a/lib/eal/include/generic/rte_pflock.h b/lib/eal/include/generic/rte_pflock.h
index e57c179ef2..7573b036bf 100644
--- a/lib/eal/include/generic/rte_pflock.h
+++ b/lib/eal/include/generic/rte_pflock.h
@@ -121,9 +121,7 @@  rte_pflock_read_lock(rte_pflock_t *pf)
 		return;
 
 	/* Wait for current write phase to complete. */
-	while ((__atomic_load_n(&pf->rd.in, __ATOMIC_ACQUIRE)
-		& RTE_PFLOCK_WBITS) == w)
-		rte_pause();
+	rte_wait_event(&pf->rd.in, RTE_PFLOCK_WBITS, ==, w, __ATOMIC_ACQUIRE);
 }
 
 /**