[v1,1/2] eal/common: use wait until equal API for tight loop

Message ID 20210825080127.495645-2-feifei.wang2@arm.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series replace tight loop with wait until equal api |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Feifei Wang Aug. 25, 2021, 8:01 a.m. UTC
  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(-)
  

Patch

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