All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/25] powerpc: Switch signal 32 to using unsafe_put_user() and friends
@ 2020-08-18 17:19 ` Christophe Leroy
  0 siblings, 0 replies; 65+ messages in thread
From: Christophe Leroy @ 2020-08-18 17:19 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linux-kernel, linuxppc-dev

This series leads to a reduction from 2.55s to 1.73s of
the system CPU time with the following microbench app
on an mpc832x with KUAP (approx 32%)

This series replaces copies to users by unsafe_put_user() and friends
with user_write_access_begin() dance in signal32.

The advantages are:
- No KUAP unlock/lock at every copy
- More readable code.
- Better generated code.

Without KUAP, the difference is in the noise.

	void sigusr1(int sig) { }

	int main(int argc, char **argv)
	{
		int i = 100000;

		signal(SIGUSR1, sigusr1);
		for (;i--;)
		    raise(SIGUSR1);
		exit(0);
	}

An additional 0.10s reduction is achieved by removing
CONFIG_PPC_FPU, as the mpc832x has no FPU.

A bit less spectacular on an 8xx as KUAP is less heavy, prior to
the series (with KUAP) it ran in 8.10 ms. Once applies the removal
of FPU regs handling, we get 7.05s. With the full series, we get 6.9s.
If artificially re-activating FPU regs handling with the full series,
we get 7.6s.

So for the 8xx, the removal of the FPU regs copy is what makes the
difference, but the rework of handle_signal also have a benefit.

Same as above, without KUAP the difference is in the noise.

Difference since v1(RFC):
- Almost copies to user are now replaced by unsafe_ alternative.
- Reworked a bit the FPU registers handling following feedback from Michael.
- Fixed a few build failures reported by Mr Robot on the RFC.

Christophe Leroy (25):
  powerpc/signal: Move inline functions in signal.h
  powerpc/ptrace: Move declaration of ptrace_get_reg() and
    ptrace_set_reg()
  powerpc/ptrace: Consolidate reg index calculation
  powerpc/ptrace: Create ptrace_get_fpr() and ptrace_put_fpr()
  powerpc/signal: Don't manage floating point regs when no FPU
  powerpc/32s: Allow deselecting CONFIG_PPC_FPU on mpc832x
  powerpc/signal: Remove BUG_ON() in handler_signal functions
  powerpc/signal: Move access_ok() out of get_sigframe()
  powerpc/signal: Remove get_clean_sp()
  powerpc/signal: Call get_tm_stackpointer() from get_sigframe()
  powerpc/signal: Refactor bad frame logging
  powerpc/signal32: Simplify logging in handle_rt_signal32()
  powerpc/signal32: Move handle_signal32() close to handle_rt_signal32()
  powerpc/signal32: Rename local pointers in handle_rt_signal32()
  powerpc/signal32: Misc changes to make handle_[rt_]_signal32() more
    similar
  powerpc/signal32: Move signal trampoline setup to handle_[rt_]signal32
  powerpc/signal32: Switch handle_signal32() to user_access_begin()
    logic
  powerpc/signal32: Switch handle_rt_signal32() to user_access_begin()
    logic
  powerpc/signal32: Remove ifdefery in middle of if/else
  signal: Add unsafe_put_compat_sigset()
  powerpc/signal32: Add and use unsafe_put_sigset_t()
  powerpc/signal32: Switch swap_context() to user_access_begin() logic
  powerpc/signal: Create 'unsafe' versions of
    copy_[ck][fpr/vsx]_to_user()
  powerpc/signal32: Isolate non-copy actions in save_user_regs() and
    save_tm_user_regs()
  powerpc/signal32: Transform save_user_regs() and save_tm_user_regs()
    in 'unsafe' version

 arch/powerpc/Kconfig                     |   1 +
 arch/powerpc/include/asm/processor.h     |  16 +-
 arch/powerpc/include/asm/ptrace.h        |   6 -
 arch/powerpc/kernel/asm-offsets.c        |   2 +
 arch/powerpc/kernel/head_32.S            |   4 +
 arch/powerpc/kernel/process.c            |   4 +
 arch/powerpc/kernel/ptrace/Makefile      |   3 +-
 arch/powerpc/kernel/ptrace/ptrace-decl.h |  21 +
 arch/powerpc/kernel/ptrace/ptrace-fpu.c  |  40 ++
 arch/powerpc/kernel/ptrace/ptrace-view.c |   2 +
 arch/powerpc/kernel/ptrace/ptrace.c      |  54 +-
 arch/powerpc/kernel/ptrace/ptrace32.c    |   2 +
 arch/powerpc/kernel/signal.c             |  59 +--
 arch/powerpc/kernel/signal.h             | 115 ++++-
 arch/powerpc/kernel/signal_32.c          | 598 +++++++++++------------
 arch/powerpc/kernel/signal_64.c          |  21 +-
 arch/powerpc/kernel/traps.c              |   2 +
 arch/powerpc/platforms/Kconfig.cputype   |  15 +-
 include/linux/compat.h                   |  32 ++
 19 files changed, 566 insertions(+), 431 deletions(-)
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-fpu.c

-- 
2.25.0


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

end of thread, other threads:[~2020-12-10 13:04 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 17:19 [PATCH v2 00/25] powerpc: Switch signal 32 to using unsafe_put_user() and friends Christophe Leroy
2020-08-18 17:19 ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 01/25] powerpc/signal: Move inline functions in signal.h Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 02/25] powerpc/ptrace: Move declaration of ptrace_get_reg() and ptrace_set_reg() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 03/25] powerpc/ptrace: Consolidate reg index calculation Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 04/25] powerpc/ptrace: Create ptrace_get_fpr() and ptrace_put_fpr() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 05/25] powerpc/signal: Don't manage floating point regs when no FPU Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 06/25] powerpc/32s: Allow deselecting CONFIG_PPC_FPU on mpc832x Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 07/25] powerpc/signal: Remove BUG_ON() in handler_signal functions Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 08/25] powerpc/signal: Move access_ok() out of get_sigframe() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 09/25] powerpc/signal: Remove get_clean_sp() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 10/25] powerpc/signal: Call get_tm_stackpointer() from get_sigframe() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 11/25] powerpc/signal: Refactor bad frame logging Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-19  1:19   ` Joe Perches
2020-08-19  1:19     ` Joe Perches
2020-08-18 17:19 ` [PATCH v2 12/25] powerpc/signal32: Simplify logging in handle_rt_signal32() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 13/25] powerpc/signal32: Move handle_signal32() close to handle_rt_signal32() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 14/25] powerpc/signal32: Rename local pointers in handle_rt_signal32() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 15/25] powerpc/signal32: Misc changes to make handle_[rt_]_signal32() more similar Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 16/25] powerpc/signal32: Move signal trampoline setup to handle_[rt_]signal32 Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 17/25] powerpc/signal32: Switch handle_signal32() to user_access_begin() logic Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 18/25] powerpc/signal32: Switch handle_rt_signal32() " Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 19/25] powerpc/signal32: Remove ifdefery in middle of if/else Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 20/25] signal: Add unsafe_put_compat_sigset() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 21/25] powerpc/signal32: Add and use unsafe_put_sigset_t() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 22/25] powerpc/signal32: Switch swap_context() to user_access_begin() logic Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 23/25] powerpc/signal: Create 'unsafe' versions of copy_[ck][fpr/vsx]_to_user() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-09-29  2:04   ` Christopher M. Riedl
2020-09-29  2:04     ` Christopher M. Riedl
2020-09-29  5:22     ` Christophe Leroy
2020-09-29  5:33       ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 24/25] powerpc/signal32: Isolate non-copy actions in save_user_regs() and save_tm_user_regs() Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-18 17:19 ` [PATCH v2 25/25] powerpc/signal32: Transform save_user_regs() and save_tm_user_regs() in 'unsafe' version Christophe Leroy
2020-08-18 17:19   ` Christophe Leroy
2020-08-27  9:07   ` kernel test robot
2020-08-27 15:59     ` Christophe Leroy
2020-09-29  2:55   ` Christopher M. Riedl
2020-09-29  2:55     ` Christopher M. Riedl
2020-09-29  5:21     ` Christophe Leroy
2020-12-10 11:29 ` [PATCH v2 00/25] powerpc: Switch signal 32 to using unsafe_put_user() and friends Michael Ellerman
2020-12-10 11:29   ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.