Restartable sequences: self-tests
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 30 May 2016 07:46:53 +0000 (09:46 +0200)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 21 Oct 2016 22:28:16 +0000 (18:28 -0400)
commitb54c5158b28f446e90421d377355c576c07feb21
tree66f78d29c9662ff0818520debbc7d29e53fe1bfa
parent2406ad22d6ba691f4d09ef1d1acedcaf91cd7c84
Restartable sequences: self-tests

Implements two basic tests of RSEQ functionality, and one more
exhaustive parameterizable test.

The first, "basic_test" only asserts that RSEQ works moderately
correctly.
E.g. that:
- The CPUID pointer works
- Code infinitely looping within a critical section will eventually be
  interrupted.
- Critical sections are interrupted by signals.

"basic_percpu_ops_test" is a slightly more "realistic" variant,
implementing a few simple per-cpu operations and testing their
correctness.

"param_test" is a parametrizable restartable sequences test. See
the "--help" output for usage.

As part of those tests, a helper library "rseq" implements a user-space
API around restartable sequences. It takes care of ensuring progress in
case of debugger single-stepping with a fall-back to locking, and
exposes the instruction pointer addresses where the rseq assembly blocks
begin and end, as well as the associated abort instruction pointer, in
the __rseq_table section. This section allows debuggers may know where
to place breakpoints when single-stepping through assembly blocks which
may be aborted at any point by the kernel.

The following rseq APIs are implemented in this helper library:
- do_rseq(): Restartable sequence made of zero or more loads, completed
  by a word-sized store,
- do_rseq2(): Restartable sequence made of zero or more loads, one
  speculative word-sized store, completed by a word-sized store,
- do_rseq_memcpy(): Restartable sequence made of zero or more loads,
  a speculative copy of a variable length memory region, completed by a
  word-sized store.

PowerPC tests have been implemented by Boqun Feng.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Russell King <linux@arm.linux.org.uk>
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Paul Turner <pjt@google.com>
CC: Andrew Hunter <ahh@google.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Andy Lutomirski <luto@amacapital.net>
CC: Andi Kleen <andi@firstfloor.org>
CC: Dave Watson <davejwatson@fb.com>
CC: Chris Lameter <cl@linux.com>
CC: Ingo Molnar <mingo@redhat.com>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Ben Maurer <bmaurer@fb.com>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
CC: Josh Triplett <josh@joshtriplett.org>
CC: Linus Torvalds <torvalds@linux-foundation.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Boqun Feng <boqun.feng@gmail.com>
CC: linux-api@vger.kernel.org
MAINTAINERS
tools/testing/selftests/rseq/.gitignore [new file with mode: 0644]
tools/testing/selftests/rseq/Makefile [new file with mode: 0644]
tools/testing/selftests/rseq/basic_percpu_ops_test.c [new file with mode: 0644]
tools/testing/selftests/rseq/basic_test.c [new file with mode: 0644]
tools/testing/selftests/rseq/param_test.c [new file with mode: 0644]
tools/testing/selftests/rseq/rseq-arm.h [new file with mode: 0644]
tools/testing/selftests/rseq/rseq-ppc.h [new file with mode: 0644]
tools/testing/selftests/rseq/rseq-x86.h [new file with mode: 0644]
tools/testing/selftests/rseq/rseq.c [new file with mode: 0644]
tools/testing/selftests/rseq/rseq.h [new file with mode: 0644]
This page took 0.025579 seconds and 5 git commands to generate.