linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v8 0/9] Restartable sequences system call
@ 2016-08-19 20:07 Mathieu Desnoyers
  2016-08-19 20:07 ` [RFC PATCH v8 1/9] " Mathieu Desnoyers
                   ` (8 more replies)
  0 siblings, 9 replies; 27+ messages in thread
From: Mathieu Desnoyers @ 2016-08-19 20:07 UTC (permalink / raw)
  To: Peter Zijlstra, Paul E. McKenney, Boqun Feng, Andy Lutomirski,
	Dave Watson
  Cc: linux-kernel, linux-api, Paul Turner, Andrew Morton,
	Russell King, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Andrew Hunter, Andi Kleen, Chris Lameter, Ben Maurer,
	Steven Rostedt, Josh Triplett, Linus Torvalds, Catalin Marinas,
	Will Deacon, Michael Kerrisk, Mathieu Desnoyers

Hi,

Here is v8 of the restartable sequences system call patchset, after
taking care of feedback received from Peter Zijlstra, Andy Lutomirski,
Boqun Feng, and Dave Watson. Added PowerPC architecture support provided
by Boqun Feng. It is based on Linux kernel v4.8-rc2.

The small library provided in kernel selftests now allows to perform
either a single final commit (do_rseq()), a speculative store before the
final commit (do_rseq2()), or a speculative memcpy before the final
commit (do_rseq_memcpy()).

Feedback is welcome!

Thanks,

Mathieu

Boqun Feng (2):
  Restartable sequences: powerpc architecture support
  Restartable sequences: Wire up powerpc system call

Mathieu Desnoyers (7):
  Restartable sequences system call
  tracing: instrument restartable sequences
  Restartable sequences: ARM 32 architecture support
  Restartable sequences: wire up ARM 32 system call
  Restartable sequences: x86 32/64 architecture support
  Restartable sequences: wire up x86 32/64 system call
  Restartable sequences: self-tests

 MAINTAINERS                                        |   11 +
 arch/Kconfig                                       |    7 +
 arch/arm/Kconfig                                   |    1 +
 arch/arm/include/uapi/asm/unistd.h                 |    1 +
 arch/arm/kernel/calls.S                            |    1 +
 arch/arm/kernel/signal.c                           |    7 +
 arch/powerpc/Kconfig                               |    1 +
 arch/powerpc/include/asm/systbl.h                  |    1 +
 arch/powerpc/include/asm/unistd.h                  |    2 +-
 arch/powerpc/include/uapi/asm/unistd.h             |    1 +
 arch/powerpc/kernel/signal.c                       |    3 +
 arch/x86/Kconfig                                   |    1 +
 arch/x86/entry/common.c                            |    1 +
 arch/x86/entry/syscalls/syscall_32.tbl             |    1 +
 arch/x86/entry/syscalls/syscall_64.tbl             |    1 +
 arch/x86/kernel/signal.c                           |    6 +
 fs/exec.c                                          |    1 +
 include/linux/sched.h                              |   72 ++
 include/trace/events/rseq.h                        |   64 ++
 include/uapi/linux/Kbuild                          |    1 +
 include/uapi/linux/rseq.h                          |  106 ++
 init/Kconfig                                       |   13 +
 kernel/Makefile                                    |    1 +
 kernel/fork.c                                      |    2 +
 kernel/rseq.c                                      |  296 ++++++
 kernel/sched/core.c                                |    1 +
 kernel/sys_ni.c                                    |    3 +
 tools/testing/selftests/rseq/.gitignore            |    3 +
 tools/testing/selftests/rseq/Makefile              |   13 +
 .../testing/selftests/rseq/basic_percpu_ops_test.c |  286 +++++
 tools/testing/selftests/rseq/basic_test.c          |  107 ++
 tools/testing/selftests/rseq/param_test.c          | 1116 ++++++++++++++++++++
 tools/testing/selftests/rseq/rseq-arm.h            |  168 +++
 tools/testing/selftests/rseq/rseq-ppc.h            |  273 +++++
 tools/testing/selftests/rseq/rseq-x86.h            |  306 ++++++
 tools/testing/selftests/rseq/rseq.c                |  231 ++++
 tools/testing/selftests/rseq/rseq.h                |  454 ++++++++
 37 files changed, 3562 insertions(+), 1 deletion(-)
 create mode 100644 include/trace/events/rseq.h
 create mode 100644 include/uapi/linux/rseq.h
 create mode 100644 kernel/rseq.c
 create mode 100644 tools/testing/selftests/rseq/.gitignore
 create mode 100644 tools/testing/selftests/rseq/Makefile
 create mode 100644 tools/testing/selftests/rseq/basic_percpu_ops_test.c
 create mode 100644 tools/testing/selftests/rseq/basic_test.c
 create mode 100644 tools/testing/selftests/rseq/param_test.c
 create mode 100644 tools/testing/selftests/rseq/rseq-arm.h
 create mode 100644 tools/testing/selftests/rseq/rseq-ppc.h
 create mode 100644 tools/testing/selftests/rseq/rseq-x86.h
 create mode 100644 tools/testing/selftests/rseq/rseq.c
 create mode 100644 tools/testing/selftests/rseq/rseq.h

-- 
2.1.4

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [RFC PATCH v8 1/9] Restartable sequences system call
@ 2016-11-26 23:43 Paul Turner
  0 siblings, 0 replies; 27+ messages in thread
From: Paul Turner @ 2016-11-26 23:43 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Mathieu Desnoyers, Peter Zijlstra, Paul E. McKenney, Boqun Feng,
	Andy Lutomirski, Dave Watson, LKML, Linux API, Andrew Morton,
	Russell King, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Andrew Hunter, Andi Kleen, Chris Lameter, Ben Maurer,
	Steven Rostedt, Josh Triplett, Linus Torvalds, Catalin Marinas,
	Will Deacon, Michael Kerrisk

On Sat, Aug 27, 2016 at 5:21 AM, Pavel Machek <pavel@ucw.cz> wrote:
>
> Hi!
>
>> Expose a new system call allowing each thread to register one userspace
>> memory area to be used as an ABI between kernel and user-space for two
>> purposes: user-space restartable sequences and quick access to read the
>> current CPU number value from user-space.
>>
>> * Restartable sequences (per-cpu atomics)
>>
>> Restartables sequences allow user-space to perform update operations on
>> per-cpu data without requiring heavy-weight atomic operations.
>>
>> The restartable critical sections (percpu atomics) work has been started
>> by Paul Turner and Andrew Hunter. It lets the kernel handle restart of
>> critical sections. [1] [2] The re-implementation proposed here brings a
>> few simplifications to the ABI which facilitates porting to other
>> architectures and speeds up the user-space fast path. A locking-based
>> fall-back, purely implemented in user-space, is proposed here to deal
>> with debugger single-stepping. This fallback interacts with rseq_start()
>> and rseq_finish(), which force retries in response to concurrent
>> lock-based activity.
>
> Hmm. Purely software fallback needed for singlestepping... Looks like this is malware
> writer's dream come true...
>
> Also if you ever get bug in the restartable code, debugger will be useless to debug it...
> unless new abilities are added to debuggers to manually schedule threads on CPUs.
>
> Is this good idea?

We've had some off-list discussion.

I have a revised version which incoprorates some of Mattheiu's
improvements, but avoids this requirement nearly ready for posting.

- Paul

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2016-11-26 23:43 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-19 20:07 [RFC PATCH v8 0/9] Restartable sequences system call Mathieu Desnoyers
2016-08-19 20:07 ` [RFC PATCH v8 1/9] " Mathieu Desnoyers
2016-08-19 20:23   ` Linus Torvalds
2016-08-19 20:44     ` Josh Triplett
2016-08-19 20:59       ` Linus Torvalds
2016-08-19 20:56     ` Andi Kleen
2016-08-19 21:19       ` Paul E. McKenney
2016-08-19 21:32         ` Linus Torvalds
2016-08-19 23:35           ` Paul E. McKenney
2016-08-19 21:24       ` Josh Triplett
2016-08-19 22:59         ` Dave Watson
2016-08-25 17:08     ` Mathieu Desnoyers
2016-08-25 17:56       ` Ben Maurer
2016-08-27  4:22         ` Josh Triplett
2016-08-29 15:16           ` Mathieu Desnoyers
2016-08-29 16:10             ` Josh Triplett
2016-08-30  2:01             ` Boqun Feng
2016-08-27 12:21   ` Pavel Machek
2016-08-19 20:07 ` [RFC PATCH v8 2/9] tracing: instrument restartable sequences Mathieu Desnoyers
2016-08-19 20:07 ` [RFC PATCH v8 3/9] Restartable sequences: ARM 32 architecture support Mathieu Desnoyers
2016-08-19 20:07 ` [RFC PATCH v8 4/9] Restartable sequences: wire up ARM 32 system call Mathieu Desnoyers
2016-08-19 20:07 ` [RFC PATCH v8 5/9] Restartable sequences: x86 32/64 architecture support Mathieu Desnoyers
2016-08-19 20:07 ` [RFC PATCH v8 6/9] Restartable sequences: wire up x86 32/64 system call Mathieu Desnoyers
2016-08-19 20:07 ` [RFC PATCH v8 7/9] Restartable sequences: powerpc architecture support Mathieu Desnoyers
2016-08-19 20:07 ` [RFC PATCH v8 8/9] Restartable sequences: Wire up powerpc system call Mathieu Desnoyers
2016-08-19 20:07 ` [RFC PATCH v8 9/9] Restartable sequences: self-tests Mathieu Desnoyers
2016-11-26 23:43 [RFC PATCH v8 1/9] Restartable sequences system call Paul Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).