Skip to content

RFC rseq updates, new cpu_opv system call (v2)

Mathieu Desnoyers linux-api linux-kselftest linux-mm linuxppc-dev lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest16 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16rseq/selftests: Expose reference counter to coexist with glibc (v2)tools/testing/selftests/rseq/rseq.c tools/testing/selftests/rseq/rseq.h+17 -70 replies
2/16rseq/selftests: Adapt number of threads to the number of detected cpustools/testing/selftests/rseq/run_param_test.sh+5 -20 replies
3/16mm: Replace BUG_ON() by WARN_ON() in vm_unmap_ram()mm/vmalloc.c+7 -55 replies
4/16mm: Introduce vm_map_user_ram, vm_unmap_user_ram (v2)include/linux/vmalloc.h mm/vmalloc.c+70 -00 replies
5/16mm: Provide is_vma_noncachedinclude/linux/mm.h+24 -00 replies
6/16cpu_opv: Provide cpu_opv system call (v9)MAINTAINERS include/linux/syscalls.h include/uapi/linux/cpu_opv.h +4 more+1054 -00 replies
7/16cpu_opv: limit amount of virtual address space used by cpu_opvkernel/cpu_opv.c kernel/sysctl.c+88 -10 replies
8/16x86: Wire up cpu_opv system callarch/x86/entry/syscalls/syscall_32.tbl arch/x86/entry/syscalls/syscall_64.tbl+2 -00 replies
9/16powerpc: Wire up cpu_opv system callarch/powerpc/include/asm/systbl.h arch/powerpc/include/uapi/asm/unistd.h+2 -00 replies
10/16arm: Wire up cpu_opv system callarch/arm/tools/syscall.tbl+1 -00 replies
11/16cpu-opv/selftests: Provide cpu-op librarytools/testing/selftests/cpu-opv/cpu-op.c tools/testing/selftests/cpu-opv/cpu-op.h+405 -00 replies
12/16cpu-opv/selftests: Provide basic testtools/testing/selftests/cpu-opv/basic_cpu_opv_test.c+1207 -00 replies
13/16cpu-opv/selftests: Provide percpu_op APItools/testing/selftests/cpu-opv/percpu-op.h+151 -00 replies
14/16cpu-opv/selftests: Provide basic percpu ops testtools/testing/selftests/cpu-opv/basic_percpu_ops_test.c+295 -00 replies
15/16cpu-opv/selftests: Provide parametrized teststools/testing/selftests/cpu-opv/param_test.c+1187 -00 replies
16/16cpu-opv/selftests: Provide Makefile, scripts, gitignoreMAINTAINERS tools/testing/selftests/Makefile tools/testing/selftests/cpu-opv/.gitignore +2 more+181 -00 replies

Reviews trailers per patch

1 of 16 patches has a Reviewed-by or Acked-by.

PatchMatthew Wilcox
1/16
2/16
3/16
4/16R-b
5/16
6/16
7/16
8/16
9/16
10/16
11/16
12/16
13/16
14/16
15/16
16/16

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH for 4.21 00/16] rseq updates, new cpu_opv system call (v2)

Hi,

Here is an updated patchset submitted as RFC for 4.21 (next merge window).

This series contain:

- rseq selftests:
- 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:
- 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.

The cpu_opv system call has been greatly simplified since the last round based on feedback from Peter Zijlstra and Will Deacon at OSS Europe. Major simplifications are:

- Remove unnecessary operations. Only keep compare, memcpy, memcpy_release, add, add_release,
- Remove the "mb" instruction in favor of a release semantic,
- Use IPI to execute operations on remote CPUs rather than try to migrate the current thread,
- Reduce the maximum operation vector size from 16 to 4 elements, thus removing the need to perform memory allocation in the cpu_opv system call (there is enough space on the stack). Add a new flag allowing user-space to query the maximum vector size supported by the kernel for future extensibility.

Feedback is welcome!

Thanks,

Mathieu

Mathieu Desnoyers (16):
rseq/selftests: Expose reference counter to coexist with glibc (v2) rseq/selftests: Adapt number of threads to the number of detected cpus
mm: Replace BUG_ON() by WARN_ON() in vm_unmap_ram()
mm: Introduce vm_map_user_ram, vm_unmap_user_ram (v2)
mm: Provide is_vma_noncached
cpu_opv: Provide cpu_opv system call (v9)
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                       |   69 ++
 init/Kconfig                                       |   17 +
 kernel/Makefile                                    |    1 +
 kernel/cpu_opv.c                                   | 1027 +++++++++++++++++
 kernel/sys_ni.c                                    |    1 +
 kernel/sysctl.c                                    |   15 +
 mm/vmalloc.c                                       |   78 +-
 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 | 1207 ++++++++++++++++++++
 .../selftests/cpu-opv/basic_percpu_ops_test.c      |  295 +++++
 tools/testing/selftests/cpu-opv/cpu-op.c           |  362 ++++++
 tools/testing/selftests/cpu-opv/cpu-op.h           |   43 +
 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                |   23 +-
 tools/testing/selftests/rseq/rseq.h                |    1 +
 tools/testing/selftests/rseq/run_param_test.sh     |    7 +-
 29 files changed, 4694 insertions(+), 14 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
Signature · 1 line
2.11.0