Skip to content

RFC x86,fpu: make FPU context switching much lazier

[email protected] lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 21 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5x86,fpu: split prev/next task fpu state handlingarch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c arch/x86/kernel/process_32.c +1 more+39 -502 replies
2/5x86,fpu: delay FPU register loading until switch to userspacearch/x86/entry/common.c arch/x86/include/asm/fpu/api.h arch/x86/include/asm/fpu/internal.h +5 more+71 -4815 replies
3/5x86,fpu: add kernel fpu argument to __kernel_fpu_beginarch/x86/include/asm/efi.h arch/x86/include/asm/fpu/api.h arch/x86/kernel/fpu/core.c +1 more+11 -70 replies
4/5x86,fpu: lazily skip FPU restore when still loadedarch/x86/include/asm/fpu/internal.h arch/x86/kernel/process.c arch/x86/kvm/x86.c+23 -14 replies
5/5x86,fpu: kinda sorta fix up signal patharch/x86/kernel/fpu/core.c arch/x86/kernel/fpu/signal.c+5 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 0/5] x86,fpu: make FPU context switching much lazier

This series is an attempt at making the x86 FPU context switching code much lazier. By only reloading the FPU context when a task switches to user mode, we can avoid switching FPU context for tasks that spin in kernel mode, and avoid reloading the FPU context for tasks that get interrupted by a kernel thread or briefly go idle.

It also allows us to skip restoring the userspace FPU context when exiting a KVM guest.

This series is still BROKEN. The first 3 patches seem to work fine in my tests (but should not, due to missing signal path code), while the 4th test makes it easier to trigger bugs.

I am posting this to ask about obvious issues people may see, ideas on what direction I should take this series in, and to avoid code conflicts with Andy's plans wrt. lazy fpu mode.