Skip to contentSkip to conversation

selftests/powerpc: Add ptrace hw breakpoint test

PATCH Applied Michael Neuling 3 participants 5 messages May 22, 2018 – May 25, 2018

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 selftests/powerpc: Add ptrace hw breakpoint test

This test the ptrace hw breakpoints via PTRACE_SET_DEBUGREG and PPC_PTRACE_SETHWDEBUG. This test was use to find the bugs fixed by these recent commits:

4f7c06e26e powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG cd6ef7eebf powerpc/ptrace: Fix enforcement of DAWR constraints

---
This test (and the next) could be expanded to do a bunch more but it's been sitting out of tree too long, so trying to get them upstream.

---
 .../selftests/powerpc/ptrace/.gitignore       |   1 +
 .../testing/selftests/powerpc/ptrace/Makefile |   2 +-
 .../selftests/powerpc/ptrace/ptrace-hwbreak.c | 341 ++++++++++++++++++
 3 files changed, 343 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c
tools/testing/selftests/powerpc/ptrace/.gitignore +1 -0
index 349acfafc9..9dcc16ea81 100644
@@ -8,3 +8,4 @@ ptrace-vsx
 ptrace-tm-vsx
 ptrace-tm-spd-vsx
 ptrace-tm-spr
+ptrace-hwbreak
tools/testing/selftests/powerpc/ptrace/Makefile +1 -1
index 4803052665..0e2f4601d1 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 TEST_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
               ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx \
-              ptrace-tm-spd-vsx ptrace-tm-spr
+              ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c new file +341 -0

341 lines not on this page · raw message

Signature · 1 line
2.17.0
#1 lore raw

PATCH 2/2 selftests/powerpc: Add perf breakpoint test

This tests perf hardware breakpoints (ie PERF_TYPE_BREAKPOINT) on powerpc.

---
 .../selftests/powerpc/ptrace/.gitignore       |   1 +
 .../testing/selftests/powerpc/ptrace/Makefile |   3 +-
 .../selftests/powerpc/ptrace/perf-hwbreak.c   | 214 ++++++++++++++++++
 3 files changed, 217 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c
tools/testing/selftests/powerpc/ptrace/.gitignore +1 -0
index 9dcc16ea81..07ec449a27 100644
@@ -9,3 +9,4 @@ ptrace-tm-vsx
 ptrace-tm-spd-vsx
 ptrace-tm-spr
 ptrace-hwbreak
+perf-hwbreak
tools/testing/selftests/powerpc/ptrace/Makefile +2 -1
index 0e2f4601d1..532f5dda37 100644
@@ -1,13 +1,14 @@
 # SPDX-License-Identifier: GPL-2.0
 TEST_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
               ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx \
-              ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak
+              ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak perf-hwbreak
 
 include ../../lib.mk
 
 all: $(TEST_PROGS)
 
 CFLAGS += -m64 -I../../../../../usr/include -I../tm -mhtm -fno-pie
+LDLIBS += -lpthread
 
 $(TEST_PROGS): ../harness.c ../utils.c ../lib/reg.S ptrace.h
 
tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c new file +214 -0

214 lines not on this page · raw message

Signature · 1 line
2.17.0
#2 lore raw

Re: [PATCH 2/2] selftests/powerpc: Add perf breakpoint test

Quoted 2 lines · Michael Neuling

This tests perf hardware breakpoints (ie PERF_TYPE_BREAKPOINT) on powerpc.

This doesn't work for me on a P8 guest:

test: perf-hwbreak
tags: git_version:bb5602e
!! killing perf-hwbreak
!! child died by signal 15
failure: perf-hwbreak

That means the harness killed it after 2 minutes.

Sometimes it gets further:

test: perf-hwbreak
tags: git_version:v4.17-rc3-109-gbb20240fb508
threads=16 loops=1048576 scalar test
!! killing perf-hwbreak
!! child died by signal 15
failure: perf-hwbreak

Do we just need to bump the timeout up, or is something going wrong here?

cheers

#3 lore raw

Re: [PATCH 2/2] selftests/powerpc: Add perf breakpoint test

Quoted 20 lines · Michael Ellerman

Michael Neuling <[email protected]> writes:
=20

Quoted 2 lines

This tests perf hardware breakpoints (ie PERF_TYPE_BREAKPOINT) on powerpc.

=20
This doesn't work for me on a P8 guest:
=20
test: perf-hwbreak
tags: git_version:bb5602e
!! killing perf-hwbreak
!! child died by signal 15
failure: perf-hwbreak
=20
=20
That means the harness killed it after 2 minutes.
=20
Sometimes it gets further:
=20
test: perf-hwbreak
tags: git_version:v4.17-rc3-109-gbb20240fb508

Quoted 8 lines

threads=3D16 loops=3D1048576 scalar test
!! killing perf-hwbreak
!! child died by signal 15
failure: perf-hwbreak
=20
=20
Do we just need to bump the timeout up, or is something going wrong here?

Yeah, sorry my bad. The test was trying to randomly test all the combinati= ons.
=20
I've rewritten it now to explicitly test all the combinations. This gives i= t a
more consistent runtime. I do randomly vary the loop count but this is only=
a
small variation (~10%) to avoid using a count from a previous test.

Mikey

#4 lore raw
In reply to Michael Neuling
Quoted 8 lines · Michael Neuling

This test the ptrace hw breakpoints via PTRACE_SET_DEBUGREG and PPC_PTRACE_SETHWDEBUG. This test was use to find the bugs fixed by these recent commits:

4f7c06e26e powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG cd6ef7eebf powerpc/ptrace: Fix enforcement of DAWR constraints

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/9c2ddfe55c42bf4b9bc336a0650ab7

cheers