[RFC PATCH for 4.21 00/16] rseq updates, new cpu_opv system call

From: Mathieu Desnoyers
Date: Wed Oct 10 2018 - 15:20:02 EST


Hi,

Considering it's already late in the 4.19 rc cycle, I'm submitting this
patchset as RFC for 4.21 to give everyone plenty of time to provide
feedback.

This series contain:

- rseq selftests (this could be 4.20 material):
- Added reference counter within user-space __rseq_abi structure, for
integration of rseq application/libraries with future use by glibc,
- Adapt number of threads to the number of online cpus.

- cpu_opv (4.21 material):
- Implement push_task_to_cpu() (scheduler),
- Introduce vm_map_user_ram()/vm_unmap_user_ram() (mm),
- Provide is_vma_noncached() (mm),
- Introduce cpu_opv system call, with vmap space limiting,
- Wire up cpu_opv on x86, powerpc, arm,
- Provide cpu_opv selftests.

The cpu_opv system call covers the use-cases that rseq does not handle,
namely single-stepping with debuggers, moving data between per-cpu data
structures without interfering with cpu affinity masks, and using rseq
from signal handlers nested between thread creation and rseq
registration by glibc, or between rseq unregistration by glibc and
thread teardown.

Thanks,

Mathieu

Mathieu Desnoyers (16):
rseq/selftests: Add reference counter to coexist with glibc
rseq/selftests: Adapt number of threads to the number of detected cpus
sched: Implement push_task_to_cpu (v2)
mm: Introduce vm_map_user_ram, vm_unmap_user_ram
mm: Provide is_vma_noncached
cpu_opv: Provide cpu_opv system call (v8)
cpu_opv: limit amount of virtual address space used by cpu_opv
x86: Wire up cpu_opv system call
powerpc: Wire up cpu_opv system call
arm: Wire up cpu_opv system call
cpu-opv/selftests: Provide cpu-op library
cpu-opv/selftests: Provide basic test
cpu-opv/selftests: Provide percpu_op API
cpu-opv/selftests: Provide basic percpu ops test
cpu-opv/selftests: Provide parametrized tests
cpu-opv/selftests: Provide Makefile, scripts, gitignore

MAINTAINERS | 8 +
arch/arm/tools/syscall.tbl | 1 +
arch/powerpc/include/asm/systbl.h | 1 +
arch/powerpc/include/uapi/asm/unistd.h | 1 +
arch/x86/entry/syscalls/syscall_32.tbl | 1 +
arch/x86/entry/syscalls/syscall_64.tbl | 1 +
include/linux/mm.h | 24 +
include/linux/syscalls.h | 3 +
include/linux/vmalloc.h | 4 +
include/uapi/linux/cpu_opv.h | 114 ++
init/Kconfig | 17 +
kernel/Makefile | 1 +
kernel/cpu_opv.c | 1190 +++++++++++++++++
kernel/sched/core.c | 42 +
kernel/sched/sched.h | 9 +
kernel/sys_ni.c | 1 +
kernel/sysctl.c | 15 +
mm/vmalloc.c | 64 +
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/cpu-opv/.gitignore | 6 +
tools/testing/selftests/cpu-opv/Makefile | 39 +
.../testing/selftests/cpu-opv/basic_cpu_opv_test.c | 1362 ++++++++++++++++++++
.../selftests/cpu-opv/basic_percpu_ops_test.c | 295 +++++
tools/testing/selftests/cpu-opv/cpu-op.c | 353 +++++
tools/testing/selftests/cpu-opv/cpu-op.h | 42 +
tools/testing/selftests/cpu-opv/param_test.c | 1187 +++++++++++++++++
tools/testing/selftests/cpu-opv/percpu-op.h | 151 +++
tools/testing/selftests/cpu-opv/run_param_test.sh | 134 ++
tools/testing/selftests/rseq/rseq.c | 32 +-
tools/testing/selftests/rseq/run_param_test.sh | 7 +-
30 files changed, 5096 insertions(+), 10 deletions(-)
create mode 100644 include/uapi/linux/cpu_opv.h
create mode 100644 kernel/cpu_opv.c
create mode 100644 tools/testing/selftests/cpu-opv/.gitignore
create mode 100644 tools/testing/selftests/cpu-opv/Makefile
create mode 100644 tools/testing/selftests/cpu-opv/basic_cpu_opv_test.c
create mode 100644 tools/testing/selftests/cpu-opv/basic_percpu_ops_test.c
create mode 100644 tools/testing/selftests/cpu-opv/cpu-op.c
create mode 100644 tools/testing/selftests/cpu-opv/cpu-op.h
create mode 100644 tools/testing/selftests/cpu-opv/param_test.c
create mode 100644 tools/testing/selftests/cpu-opv/percpu-op.h
create mode 100755 tools/testing/selftests/cpu-opv/run_param_test.sh

--
2.11.0