Rebase powerpc selftests
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
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
@@ -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
@@ -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
@@ -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
Michael Ellerman
reviewerRe: [1/5] selftests/powerpc: Make reg.h common to all powerpc selftests
Quoted 4 lines · Rashmica Gupta
Currently there is a
reg.hin pmu/ebb that has defines that are useful in other powerpc selftests so move this up into selftests/powerpc folder. Also include inutils.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
PATCH 2/5 selftests/powerpc: Standardise TM calls
In reply to Rashmica GuptaCurrently 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
@@ -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 0x03int 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
@@ -60,9 +60,9 @@ int tm_signal_stack()exit (1 ); asmvolatile ("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
PATCH 3/5 selftests/powerpc: Add test for forking inside transaction
In reply to Rashmica GuptaThis 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
@@ -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
@@ -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
PATCH 4/5 selftests/powerpc: Add TM test to check if TAR is corrupted
In reply to Rashmica GuptaIf 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
@@ -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
@@ -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
PATCH 5/5 selftests/powerpc: Add test to check if TM SPRs are corrupted
In reply to Rashmica GuptaTesting 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
@@ -5,3 +5,4 @@ tm-signal-stack tm-vmxcopy tm-fork tm-tar +tm-tmspr
tools/testing/selftests/powerpc/tm/Makefile +2 -1
@@ -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