git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/nfp: disable for 32-bit meson builds
[dpdk.git]
/
app
/
test
/
test_barrier.c
diff --git
a/app/test/test_barrier.c
b/app/test/test_barrier.c
index
c219d56
..
43b5f62
100644
(file)
--- a/
app/test/test_barrier.c
+++ b/
app/test/test_barrier.c
@@
-55,8
+55,8
@@
struct plock {
*/
struct plock_test {
struct plock lock;
*/
struct plock_test {
struct plock lock;
- uint
32
_t val;
- uint
32
_t iter;
+ uint
64
_t val;
+ uint
64
_t iter;
};
/*
};
/*
@@
-65,8
+65,8
@@
struct plock_test {
*/
struct lcore_plock_test {
struct plock_test *pt[2]; /* shared, lock-protected data */
*/
struct lcore_plock_test {
struct plock_test *pt[2]; /* shared, lock-protected data */
- uint
32
_t sum[2]; /* local copy of the shared data */
- uint
32
_t iter; /* number of iterations to perfom */
+ uint
64
_t sum[2]; /* local copy of the shared data */
+ uint
64
_t iter; /* number of iterations to perfom */
uint32_t lc; /* given lcore id */
};
uint32_t lc; /* given lcore id */
};
@@
-92,12
+92,14
@@
plock_lock(struct plock *l, uint32_t self)
other = self ^ 1;
l->flag[self] = 1;
other = self ^ 1;
l->flag[self] = 1;
+ rte_smp_wmb();
l->victim = self;
store_load_barrier(l->utype);
while (l->flag[other] == 1 && l->victim == self)
rte_pause();
l->victim = self;
store_load_barrier(l->utype);
while (l->flag[other] == 1 && l->victim == self)
rte_pause();
+ rte_smp_rmb();
}
static void
}
static void
@@
-130,7
+132,8
@@
static int
plock_test1_lcore(void *data)
{
uint64_t tm;
plock_test1_lcore(void *data)
{
uint64_t tm;
- uint32_t i, lc, ln, n;
+ uint32_t lc, ln;
+ uint64_t i, n;
struct lcore_plock_test *lpt;
lpt = data;
struct lcore_plock_test *lpt;
lpt = data;
@@
-166,9
+169,9
@@
plock_test1_lcore(void *data)
tm = rte_get_timer_cycles() - tm;
tm = rte_get_timer_cycles() - tm;
- printf("%s(%u): %
u
iterations finished, in %" PRIu64
+ printf("%s(%u): %
" PRIu64 "
iterations finished, in %" PRIu64
" cycles, %#Lf cycles/iteration, "
" cycles, %#Lf cycles/iteration, "
- "local sum={%
u, %u
}\n",
+ "local sum={%
" PRIu64 ", %" PRIu64 "
}\n",
__func__, lc, i, tm, (long double)tm / i,
lpt->sum[0], lpt->sum[1]);
return 0;
__func__, lc, i, tm, (long double)tm / i,
lpt->sum[0], lpt->sum[1]);
return 0;
@@
-184,11
+187,11
@@
plock_test1_lcore(void *data)
* and local data are the same.
*/
static int
* and local data are the same.
*/
static int
-plock_test(uint
32
_t iter, enum plock_use_type utype)
+plock_test(uint
64
_t iter, enum plock_use_type utype)
{
int32_t rc;
uint32_t i, lc, n;
{
int32_t rc;
uint32_t i, lc, n;
- uint
32
_t *sum;
+ uint
64
_t *sum;
struct plock_test *pt;
struct lcore_plock_test *lpt;
struct plock_test *pt;
struct lcore_plock_test *lpt;
@@
-199,10
+202,10
@@
plock_test(uint32_t iter, enum plock_use_type utype)
lpt = calloc(n, sizeof(*lpt));
sum = calloc(n + 1, sizeof(*sum));
lpt = calloc(n, sizeof(*lpt));
sum = calloc(n + 1, sizeof(*sum));
- printf("%s(iter=%
u
, utype=%u) started on %u lcores\n",
+ printf("%s(iter=%
" PRIu64 "
, utype=%u) started on %u lcores\n",
__func__, iter, utype, n);
__func__, iter, utype, n);
- if (pt == NULL || lpt == NULL) {
+ if (pt == NULL || lpt == NULL
|| sum == NULL
) {
printf("%s: failed to allocate memory for %u lcores\n",
__func__, n);
free(pt);
printf("%s: failed to allocate memory for %u lcores\n",
__func__, n);
free(pt);
@@
-247,7
+250,7
@@
plock_test(uint32_t iter, enum plock_use_type utype)
rc = 0;
for (i = 0; i != n; i++) {
rc = 0;
for (i = 0; i != n; i++) {
- printf("%s: sum[%u]=%
u, pt[%u].val=%u, pt[%u].iter=%u
;\n",
+ printf("%s: sum[%u]=%
" PRIu64 ", pt[%u].val=%" PRIu64 ", pt[%u].iter=%" PRIu64 "
;\n",
__func__, i, sum[i], i, pt[i].val, i, pt[i].iter);
/* race condition occurred, lock doesn't work properly */
__func__, i, sum[i], i, pt[i].val, i, pt[i].iter);
/* race condition occurred, lock doesn't work properly */