All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] x86: load FPU registers on return to userland
@ 2018-09-12 13:33 Sebastian Andrzej Siewior
  2018-09-12 13:33 ` [RFC PATCH 01/10] x86/entry: remove _TIF_ALLWORK_MASK Sebastian Andrzej Siewior
                   ` (9 more replies)
  0 siblings, 10 replies; 41+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-09-12 13:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: x86, Andy Lutomirski, Paolo Bonzini, Radim Krčmář,
	kvm, Jason A. Donenfeld, Rik van Riel

This is a refurbished series originally started by by Rik van Riel. The
goal is load the FPU registers on return to userland and not on every
context switch. By this optimisation we can:
- avoid loading the registers if the task stays in kernel and does
  not return to userland
- make kernel_fpu_begin() cheaper: it only saves the registers on the
  first invocation. The second invocation does not need save them again.

To access the FPU registers in kernel we need:
- disable preemption to avoid that the scheduler switches tasks. By
  doing so it would set TIF_LOAD_FPU and the FPU registers would be not
  valid.
- disable BH because the softirq might use kernel_fpu_begin() and then
  set TIF_LOAD_FPU instead loading the FPU registers on completion.

This seems to work with userland & xmm registers. Haven't tested the
pkeys feature and KVM yet.

Sebastian



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

end of thread, other threads:[~2018-09-27 14:21 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-12 13:33 [RFC PATCH] x86: load FPU registers on return to userland Sebastian Andrzej Siewior
2018-09-12 13:33 ` [RFC PATCH 01/10] x86/entry: remove _TIF_ALLWORK_MASK Sebastian Andrzej Siewior
2018-09-27 14:21   ` Sebastian Andrzej Siewior
2018-09-12 13:33 ` [RFC PATCH 02/10] kvm: x86: make kvm_{load|put}_guest_fpu() static Sebastian Andrzej Siewior
2018-09-12 13:33 ` [RFC PATCH 03/10] x86/fpu: add (__)make_fpregs_active helpers Sebastian Andrzej Siewior
2018-09-12 13:33 ` [RFC PATCH 04/10] x86/fpu: eager switch PKRU state Sebastian Andrzej Siewior
2018-09-12 14:18   ` Paolo Bonzini
2018-09-12 15:24     ` Andy Lutomirski
2018-09-12 15:30       ` Paolo Bonzini
2018-09-14 20:35     ` [RFC PATCH 04/10 v2 ] " Sebastian Andrzej Siewior
2018-09-17  8:37       ` Paolo Bonzini
2018-09-18 14:27         ` Sebastian Andrzej Siewior
2018-09-18 15:07           ` Paolo Bonzini
2018-09-18 15:11             ` Rik van Riel
2018-09-18 15:29               ` Paolo Bonzini
2018-09-18 16:04                 ` Sebastian Andrzej Siewior
2018-09-18 17:29                   ` Rik van Riel
2018-09-19  5:55                     ` Paolo Bonzini
2018-09-19 16:57                       ` Sebastian Andrzej Siewior
2018-09-19 17:00                         ` Paolo Bonzini
2018-09-19 17:19                           ` Sebastian Andrzej Siewior
2018-09-19 19:38                           ` Rik van Riel
2018-09-19 19:49                           ` Andy Lutomirski
2018-09-12 15:20   ` [RFC PATCH 04/10] " Andy Lutomirski
2018-09-12 15:30     ` Rik van Riel
2018-09-12 15:49       ` Andy Lutomirski
2018-09-19 16:58         ` Sebastian Andrzej Siewior
2018-09-12 13:33 ` [RFC PATCH 05/10] x86/pkeys: Drop the preempt-disable section Sebastian Andrzej Siewior
2018-09-12 13:33 ` [RFC PATCH 06/10] x86/fpu: Always store the registers in copy_fpstate_to_sigframe() Sebastian Andrzej Siewior
2018-09-12 13:33 ` [RFC PATCH 07/10] x86/entry: add TIF_LOAD_FPU Sebastian Andrzej Siewior
2018-09-12 13:33 ` [RFC PATCH 08/10] x86/fpu: prepare copy_fpstate_to_sigframe for TIF_LOAD_FPU Sebastian Andrzej Siewior
2018-09-12 13:33 ` [RFC PATCH 09/10] x86/fpu: copy non-resident FPU state at fork time Sebastian Andrzej Siewior
2018-09-12 13:33 ` [RFC PATCH 10/10] x86/fpu: defer FPU state load until return to userspace Sebastian Andrzej Siewior
2018-09-12 15:47   ` Andy Lutomirski
2018-09-19 17:05     ` Sebastian Andrzej Siewior
2018-09-21  3:45       ` Andy Lutomirski
2018-09-21  4:15         ` Andy Lutomirski
2018-09-26 11:12           ` Sebastian Andrzej Siewior
2018-09-26 14:34             ` Andy Lutomirski
2018-09-26 15:32               ` Sebastian Andrzej Siewior
2018-09-26 16:24                 ` Andy Lutomirski

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.