Skip to contentSkip to conversation

test: fix memory barrier test failure on power CPUs

PATCH Superseded David Christensen 2 participants 3 messages Apr 30, 2019 – May 6, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 test: fix memory barrier test failure on power CPUs

The memory barrier test fails on IBM Power 9 systems. Add additional barriers to accommodate the weakly ordered model used on Power CPUs.

---
 app/test/test_barrier.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
app/test/test_barrier.c +8 -1
index 58a3280..6136ee1 100644
@@ -36,7 +36,7 @@
 #include "test.h"
 
 #define ADD_MAX		8
-#define ITER_MAX	0x100000000
+#define ITER_MAX	0x1000000
 
 enum plock_use_type {
 	USE_MB,
@@ -92,12 +92,19 @@ struct lcore_plock_test {
 	other = self ^ 1;
 
 	l->flag[self] = 1;
+#ifdef RTE_ARCH_PPC_64
+	rte_smp_wmb();
+#endif
 	l->victim = self;
 
 	store_load_barrier(l->utype);
 
 	while (l->flag[other] == 1 && l->victim == self)
 		rte_pause();
+
+#ifdef RTE_ARCH_PPC_64
+	rte_smp_rmb();
+#endif
 }
 
 static void
Signature · 1 line
1.8.3.1
#1 lore raw

Hi,

01/05/2019 00:33, David Christensen:

Quoted 4 lines

The memory barrier test fails on IBM Power 9 systems. Add additional barriers to accommodate the weakly ordered model used on Power CPUs.

[...]

app/test/test_barrier.c line 39

Quoted 8 lines
app/test/test_barrier.c +1 -1
@@ -36,7 +36,7 @@
 #include "test.h"
 
 #define ADD_MAX		8
-#define ITER_MAX	0x100000000
+#define ITER_MAX	0x1000000

This is a revert of a change done in patch 3.

app/test/test_barrier.c struct lcore_plock_test { · line 97

Quoted 7 lines
app/test/test_barrier.c +3 -0
@@ -92,12 +92,19 @@ struct lcore_plock_test {
 	other = self ^ 1;
 
 	l->flag[self] = 1;
+#ifdef RTE_ARCH_PPC_64
+	rte_smp_wmb();
+#endif

You should not have such #ifdef in a test case supposed to run on all architectures with the same code. What can be fixed in EAL?

#2 lore raw
Quoted 4 lines

app/test/test_barrier.c line 39

Quoted 2 lines
app/test/test_barrier.c +1 -1
-#define ITER_MAX	0x100000000
+#define ITER_MAX	0x1000000

This is a revert of a change done in patch 3.

I'll fix and resubmit.

Quoted 11 lines

app/test/test_barrier.c struct lcore_plock_test { · line 97

Quoted 7 lines
app/test/test_barrier.c +3 -0
@@ -92,12 +92,19 @@ struct lcore_plock_test {
  	other = self ^ 1;
 
  	l->flag[self] = 1;
+#ifdef RTE_ARCH_PPC_64
+	rte_smp_wmb();
+#endif

You should not have such #ifdef in a test case supposed to run on all architectures with the same code. What can be fixed in EAL?

I'll go ahead and remove the ifdefs since the code for rte_smp_wmb() resolves to different architecture specific code (compiler memory barriers in the x86 case).

Dave