Skip to content

Commit

Permalink
test/mcslock: remove unneeded per lcore copy
Browse files Browse the repository at this point in the history
[ upstream commit 5b3ada0 ]

Each core already comes with its local storage for mcslock (in its
stack), therefore there is no need to define an additional per-lcore
mcslock.

Fixes: 32dcb9f ("test/mcslock: add MCS queued lock unit test")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
  • Loading branch information
olivier-matz-6wind authored and bluca committed Feb 4, 2021
1 parent 4344784 commit a6e1385
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions app/test/test_mcslock.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
* lock multiple times.
*/

RTE_DEFINE_PER_LCORE(rte_mcslock_t, _ml_me);
RTE_DEFINE_PER_LCORE(rte_mcslock_t, _ml_try_me);
RTE_DEFINE_PER_LCORE(rte_mcslock_t, _ml_perf_me);

rte_mcslock_t *p_ml;
rte_mcslock_t *p_ml_try;
rte_mcslock_t *p_ml_perf;
Expand All @@ -53,7 +49,7 @@ static int
test_mcslock_per_core(__rte_unused void *arg)
{
/* Per core me node. */
rte_mcslock_t ml_me = RTE_PER_LCORE(_ml_me);
rte_mcslock_t ml_me;

rte_mcslock_lock(&p_ml, &ml_me);
printf("MCS lock taken on core %u\n", rte_lcore_id());
Expand All @@ -77,7 +73,7 @@ load_loop_fn(void *func_param)
const unsigned int lcore = rte_lcore_id();

/**< Per core me node. */
rte_mcslock_t ml_perf_me = RTE_PER_LCORE(_ml_perf_me);
rte_mcslock_t ml_perf_me;

/* wait synchro */
while (rte_atomic32_read(&synchro) == 0)
Expand Down Expand Up @@ -151,8 +147,8 @@ static int
test_mcslock_try(__rte_unused void *arg)
{
/**< Per core me node. */
rte_mcslock_t ml_me = RTE_PER_LCORE(_ml_me);
rte_mcslock_t ml_try_me = RTE_PER_LCORE(_ml_try_me);
rte_mcslock_t ml_me;
rte_mcslock_t ml_try_me;

/* Locked ml_try in the main lcore, so it should fail
* when trying to lock it in the worker lcore.
Expand All @@ -178,8 +174,8 @@ test_mcslock(void)
int i;

/* Define per core me node. */
rte_mcslock_t ml_me = RTE_PER_LCORE(_ml_me);
rte_mcslock_t ml_try_me = RTE_PER_LCORE(_ml_try_me);
rte_mcslock_t ml_me;
rte_mcslock_t ml_try_me;

/*
* Test mcs lock & unlock on each core
Expand Down

0 comments on commit a6e1385

Please sign in to comment.