]> git.droids-corp.org - dpdk.git/commitdiff
test/mcslock: wait for lcore completion
authorAaron Conole <aconole@redhat.com>
Wed, 7 Aug 2019 14:58:44 +0000 (10:58 -0400)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 8 Aug 2019 10:19:59 +0000 (12:19 +0200)
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")
Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
app/test/test_mcslock.c

index ed384b81d92bc1441a51a905a8b1d03582c822fa..e9359df2eebe749a0ab88c3eae6fe3ec6d21ad14 100644 (file)
@@ -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)) {