Skip to contentSkip to conversation

test/mcslock: wait for lcore completion

PATCH Applied Aaron Conole 4 participants 4 messages Aug 7, 2019 – Aug 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/mcslock: wait for lcore completion

It's possible that the mcsunlock occurs before the test_mcslock_try has a chance to execute, which will result in the trylock being successful, making the test case fail. Fix this by waiting until all lcores have completed their test before unlocking the master lock.

Fixes 32dcb9fd2a22 ("test/mcslock: add MCS queued lock unit test")
Cc Phil Yang <[email protected]>
Cc Gavin Hu <[email protected]>
Cc Honnappa Nagarahalli <[email protected]>
---
 app/test/test_mcslock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_mcslock.c +1 -1
index ed384b81d..e9359df2e 100644
@@ -225,8 +225,8 @@ test_mcslock(void)
 	RTE_LCORE_FOREACH_SLAVE(i) {
 		rte_eal_remote_launch(test_mcslock_try, NULL, i);
 	}
-	rte_mcslock_unlock(&p_ml_try, &ml_try_me);
 	rte_eal_mp_wait_lcore();
+	rte_mcslock_unlock(&p_ml_try, &ml_try_me);
 
 	/* Test is_locked API */
 	if (rte_mcslock_is_locked(p_ml)) {
Signature · 1 line
2.21.0
#1 lore raw
Quoted 38 lines

-----Original Message-----
From: Aaron Conole <[email protected]>
Sent: Wednesday, August 7, 2019 10:59 PM
To: [email protected]
Cc: Phil Yang (Arm Technology China) <[email protected]>; Gavin Hu (Arm Technology China) <[email protected]>; Honnappa Nagarahalli <[email protected]>
Subject: [PATCH] test/mcslock: wait for lcore completion

It's possible that the mcsunlock occurs before the test_mcslock_try has a chance to execute, which will result in the trylock being successful, making the test case fail. Fix this by waiting until all lcores have completed their test before unlocking the master lock.

Fixes 32dcb9fd2a22 ("test/mcslock: add MCS queued lock unit test")
Cc Phil Yang <[email protected]>
Cc Gavin Hu <[email protected]>
Cc Honnappa Nagarahalli <[email protected]>
---
 app/test/test_mcslock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_mcslock.c +1 -2
index ed384b81d..e9359df2e 100644
@@ -225,8 +225,8 @@ test_mcslock(void)
 	RTE_LCORE_FOREACH_SLAVE(i) {
 		rte_eal_remote_launch(test_mcslock_try, NULL, i);
 	}
-	rte_mcslock_unlock(&p_ml_try, &ml_try_me);
 	rte_eal_mp_wait_lcore();
+	rte_mcslock_unlock(&p_ml_try, &ml_try_me);
 
 	/* Test is_locked API */
 	if (rte_mcslock_is_locked(p_ml)) {
--
Quoted 1 line

2.21.0

Thanks for the patch.

#2 lore raw

08/08/2019 05:44, Phil Yang (Arm Technology China):

Quoted 7 lines

From: Aaron Conole <[email protected]>

Quoted 6 lines

It's possible that the mcsunlock occurs before the test_mcslock_try has a chance to execute, which will result in the trylock being successful, making the test case fail. Fix this by waiting until all lcores have completed their test before unlocking the master lock.

Quoted 8 lines
Quoted 5 lines
Fixes 32dcb9fd2a22 ("test/mcslock: add MCS queued lock unit test")
Cc Phil Yang <[email protected]>
Cc Gavin Hu <[email protected]>
Cc Honnappa Nagarahalli <[email protected]>

Thanks for the patch.

Applied, thanks

Reviewed-by on v1 1/1
#3 lore raw
In reply to Aaron Conole
Quoted 30 lines · Aaron Conole

It's possible that the mcsunlock occurs before the test_mcslock_try has a chance to execute, which will result in the trylock being successful, making the test case fail. Fix this by waiting until all lcores have completed their test before unlocking the master lock.

Fixes 32dcb9fd2a22 ("test/mcslock: add MCS queued lock unit test")
Cc Phil Yang <[email protected]>
Cc Gavin Hu <[email protected]>
Cc Honnappa Nagarahalli <[email protected]>
---
 app/test/test_mcslock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_mcslock.c +1 -2
index ed384b81d..e9359df2e 100644
@@ -225,8 +225,8 @@ test_mcslock(void)
        RTE_LCORE_FOREACH_SLAVE(i) {
                rte_eal_remote_launch(test_mcslock_try, NULL, i);
        }
-       rte_mcslock_unlock(&p_ml_try, &ml_try_me);
        rte_eal_mp_wait_lcore();
+       rte_mcslock_unlock(&p_ml_try, &ml_try_me);
 
        /* Test is_locked API */
        if (rte_mcslock_is_locked(p_ml)) {
--
Quoted 2 lines

2.21.0

Thanks.

Signature · 1 line
David Marchand