Skip to contentSkip to conversation

Rebase powerpc selftests

PATCH In review Rashmica Gupta 2 participants 7 messages Dec 23, 2015 – May 10, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Rebase powerpc selftests

Rebase the previous powerpc selftests against the current next tree.

Rashmica Gupta (5):
selftests/powerpc: Make reg.h common to all powerpc selftests selftests/powerpc: Standardise TM calls selftests/powerpc: Add test for forking inside transaction selftests/powerpc: Add TM test to check if TAR is corrupted selftests/powerpc: Add test to check if TM SPRs are corrupted

 tools/testing/selftests/powerpc/pmu/ebb/ebb.c      |   1 -
 tools/testing/selftests/powerpc/pmu/ebb/reg.h      |  49 -------
 .../selftests/powerpc/pmu/ebb/reg_access_test.c    |   1 -
 tools/testing/selftests/powerpc/reg.h              |  43 +++++++
 tools/testing/selftests/powerpc/tm/.gitignore      |   3 +
 tools/testing/selftests/powerpc/tm/Makefile        |   3 +-
 tools/testing/selftests/powerpc/tm/tm-fork.c       |  42 ++++++
 .../testing/selftests/powerpc/tm/tm-resched-dscr.c |  16 +--
 .../testing/selftests/powerpc/tm/tm-signal-stack.c |   4 +-
 tools/testing/selftests/powerpc/tm/tm-tar.c        |  90 +++++++++++++
 tools/testing/selftests/powerpc/tm/tm-tmspr.c      | 143 +++++++++++++++++++++
 tools/testing/selftests/powerpc/utils.h            |   1 +
 12 files changed, 331 insertions(+), 65 deletions(-)
 delete mode 100644 tools/testing/selftests/powerpc/pmu/ebb/reg.h
 create mode 100644 tools/testing/selftests/powerpc/reg.h
 create mode 100644 tools/testing/selftests/powerpc/tm/tm-fork.c
 create mode 100644 tools/testing/selftests/powerpc/tm/tm-tar.c
 create mode 100644 tools/testing/selftests/powerpc/tm/tm-tmspr.c
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/5 selftests/powerpc: Make reg.h common to all powerpc selftests

Currently there is a reg.h in pmu/ebb that has defines that are useful in other powerpc selftests so move this up into selftests/powerpc folder. Also include in utils.h - as this is often used in self tests. Add in some other useful register defines.

---
 tools/testing/selftests/powerpc/pmu/ebb/ebb.c      |  1 -
 tools/testing/selftests/powerpc/pmu/ebb/reg.h      | 49 ----------------------
 .../selftests/powerpc/pmu/ebb/reg_access_test.c    |  1 -
 tools/testing/selftests/powerpc/reg.h              | 43 +++++++++++++++++++
 tools/testing/selftests/powerpc/utils.h            |  1 +
 5 files changed, 44 insertions(+), 51 deletions(-)
 delete mode 100644 tools/testing/selftests/powerpc/pmu/ebb/reg.h
 create mode 100644 tools/testing/selftests/powerpc/reg.h
tools/testing/selftests/powerpc/pmu/ebb/ebb.c +0 -1
index e67452f1bcff..46681fec549b 100644
@@ -15,7 +15,6 @@
 #include <sys/ioctl.h>
 
 #include "trace.h"
-#include "reg.h"
 #include "ebb.h"
 
 
tools/testing/selftests/powerpc/pmu/ebb/reg.h deleted +0 -49

49 lines not on this page · raw message

tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c +0 -1
index 5b1188f10c15..f923228bca22 100644
@@ -7,7 +7,6 @@
 #include <stdlib.h>
 
 #include "ebb.h"
-#include "reg.h"
 
 
 /*
tools/testing/selftests/powerpc/reg.h new file +43 -0

43 lines not on this page · raw message

tools/testing/selftests/powerpc/utils.h +1 -0
index 175ac6ad10dd..5231b35c7279 100644
@@ -9,6 +9,7 @@
 #include <stdint.h>
 #include <stdbool.h>
 #include <linux/auxvec.h>
+#include "reg.h"
 
 /* Avoid headaches with PRI?64 - just use %ll? always */
 typedef unsigned long long u64;
Signature · 1 line
2.5.0
#3 lore raw

PATCH 2/5 selftests/powerpc: Standardise TM calls

In reply to Rashmica Gupta

Currently tbegin, tend etc are written as opcodes or asm instructions. So standardise these to asm instructions.

---
 tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | 16 +++++-----------
 tools/testing/selftests/powerpc/tm/tm-signal-stack.c |  4 ++--
 2 files changed, 7 insertions(+), 13 deletions(-)
tools/testing/selftests/powerpc/tm/tm-resched-dscr.c +5 -11
index 8fde93d6021f..d9c49f41515e 100644
@@ -31,12 +31,6 @@
 #include "utils.h"
 #include "tm.h"
 
-#define TBEGIN          ".long 0x7C00051D ;"
-#define TEND            ".long 0x7C00055D ;"
-#define TCHECK          ".long 0x7C00059C ;"
-#define TSUSPEND        ".long 0x7C0005DD ;"
-#define TRESUME         ".long 0x7C2005DD ;"
-#define SPRN_TEXASR     0x82
 #define SPRN_DSCR       0x03
 
 int test_body(void)
@@ -55,13 +49,13 @@ int test_body(void)
 			"mtspr   %[sprn_dscr], 3;"
 
 			/* start and suspend a transaction */
-			TBEGIN
+			"tbegin.;"
 			"beq     1f;"
-			TSUSPEND
+			"tsuspend.;"
 
 			/* hard loop until the transaction becomes doomed */
 			"2: ;"
-			TCHECK
+			"tcheck 0;"
 			"bc      4, 0, 2b;"
 
 			/* record DSCR and TEXASR */
@@ -70,8 +64,8 @@ int test_body(void)
 			"mfspr   3, %[sprn_texasr];"
 			"std     3, %[texasr];"
 
-			TRESUME
-			TEND
+			"tresume.;"
+			"tend.;"
 			"li      %[rv], 0;"
 			"1: ;"
 			: [rv]"=r"(rv), [dscr2]"=m"(dscr2), [texasr]"=m"(texasr)
tools/testing/selftests/powerpc/tm/tm-signal-stack.c +2 -2
index e44a238c1d77..1f0eb567438d 100644
@@ -60,9 +60,9 @@ int tm_signal_stack()
 		exit(1);
 	asm volatile("li 1, 0 ;"		/* stack ptr == NULL */
 		     "1:"
-		     ".long 0x7C00051D ;"	/* tbegin */
+		     "tbegin.;"
 		     "beq 1b ;"			/* retry forever */
-		     ".long 0x7C0005DD ; ;"	/* tsuspend */
+		     "tsuspend.;"
 		     "ld 2, 0(1) ;"		/* trigger segv" */
 		     : : : "memory");
 
Signature · 1 line
2.5.0
#4 lore raw

PATCH 3/5 selftests/powerpc: Add test for forking inside transaction

In reply to Rashmica Gupta

This test does a fork syscall inside a transaction. Basic sniff test to see if we can enter the kernel during a transaction.

---
 tools/testing/selftests/powerpc/tm/.gitignore |  1 +
 tools/testing/selftests/powerpc/tm/Makefile   |  2 +-
 tools/testing/selftests/powerpc/tm/tm-fork.c  | 42 +++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/tm/tm-fork.c
tools/testing/selftests/powerpc/tm/.gitignore +1 -0
index 7d0f14b8cb2e..d216eddcd493 100644
@@ -3,3 +3,4 @@ tm-syscall
 tm-signal-msr-resv
 tm-signal-stack
 tm-vmxcopy
+tm-fork
tools/testing/selftests/powerpc/tm/Makefile +1 -1
index 737f72c964e6..2db475b12720 100644
@@ -1,4 +1,4 @@
-TEST_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack tm-vmxcopy
+TEST_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack tm-vmxcopy tm-fork
 
 all: $(TEST_PROGS)
 
tools/testing/selftests/powerpc/tm/tm-fork.c new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.5.0
#5 lore raw

PATCH 4/5 selftests/powerpc: Add TM test to check if TAR is corrupted

In reply to Rashmica Gupta

If the transaction is aborted, the TAR should be rolled back to the checkpointed value before the transaction began. The value written to the TAR when the transaction is suspended should only remain there if the transaction completes successfully.

---
 tools/testing/selftests/powerpc/tm/.gitignore |  1 +
 tools/testing/selftests/powerpc/tm/Makefile   |  2 +-
 tools/testing/selftests/powerpc/tm/tm-tar.c   | 90 +++++++++++++++++++++++++++
 3 files changed, 92 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/tm/tm-tar.c
tools/testing/selftests/powerpc/tm/.gitignore +1 -0
index d216eddcd493..2ac376410c70 100644
@@ -4,3 +4,4 @@ tm-signal-msr-resv
 tm-signal-stack
 tm-vmxcopy
 tm-fork
+tm-tar
tools/testing/selftests/powerpc/tm/Makefile +1 -1
index 2db475b12720..cb4b3bf57a4d 100644
@@ -1,4 +1,4 @@
-TEST_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack tm-vmxcopy tm-fork
+TEST_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack tm-vmxcopy tm-fork tm-tar
 
 all: $(TEST_PROGS)
 
tools/testing/selftests/powerpc/tm/tm-tar.c new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
2.5.0
#6 lore raw

PATCH 5/5 selftests/powerpc: Add test to check if TM SPRs are corrupted

In reply to Rashmica Gupta

Testing that the TM SPRs are behaving the way they should. Uses more threads than cpus to see if the following register values persist with context switching:
- the FS (failure summary) flag in TEXASR
- TFIAR and TFHAR

---
 tools/testing/selftests/powerpc/tm/.gitignore |   1 +
 tools/testing/selftests/powerpc/tm/Makefile   |   3 +-
 tools/testing/selftests/powerpc/tm/tm-tmspr.c | 143 ++++++++++++++++++++++++++
 3 files changed, 146 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/tm/tm-tmspr.c
tools/testing/selftests/powerpc/tm/.gitignore +1 -0
index 2ac376410c70..bb942db845bf 100644
@@ -5,3 +5,4 @@ tm-signal-stack
 tm-vmxcopy
 tm-fork
 tm-tar
+tm-tmspr
tools/testing/selftests/powerpc/tm/Makefile +2 -1
index cb4b3bf57a4d..d0505dbd22d5 100644
@@ -1,4 +1,4 @@
-TEST_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack tm-vmxcopy tm-fork tm-tar
+TEST_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack tm-vmxcopy tm-fork tm-tar tm-tmspr
 
 all: $(TEST_PROGS)
 
@@ -6,6 +6,7 @@ $(TEST_PROGS): ../harness.c ../utils.c
 
 tm-syscall: tm-syscall-asm.S
 tm-syscall: CFLAGS += -mhtm -I../../../../../usr/include
+tm-tmspr: CFLAGS += -pthread
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/tm/tm-tmspr.c new file +143 -0

143 lines not on this page · raw message

Signature · 1 line
2.5.0
#2 lore raw

Re: [1/5] selftests/powerpc: Make reg.h common to all powerpc selftests

In reply to Rashmica Gupta
Quoted 4 lines · Rashmica Gupta

Currently there is a reg.h in pmu/ebb that has defines that are useful in other powerpc selftests so move this up into selftests/powerpc folder. Also include in utils.h - as this is often used in self tests. Add in some other useful register defines.

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/5263230effb72fd27d7d9340cc

cheers