Skip to content

x86/fpu: Preparatory cleanups for AMX support (part 1)

Thomas Gleixner kvm lkml 2 versions – Applied

Status from this message: The following commit has been merged into the x86/fpu branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest30 patches 1 replyApplied
  2. v131 patches 63 repliesSuperseded

Changes in v2 from the cover letter

- Fixed the issue in the !XSAVE code path of the kvm UABI copy function - Paolo

- Renamed the KVM functions - Boris, Paolo, Sean

- Fixed the comments and changelog issues - Boris

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/30x86/fpu: Remove pointless argument from switch_fpu_finish()arch/x86/include/asm/fpu/internal.h arch/x86/kernel/process_32.c arch/x86/kernel/process_64.c+3 -50 replies
2/30x86/fpu: Update stale commentsarch/x86/kernel/fpu/signal.c+3 -100 replies
3/30x86/pkru: Remove useless includearch/x86/events/perf_event.h arch/x86/include/asm/pkru.h+2 -10 replies
4/30x86/fpu: Restrict xsaves()/xrstors() to independent statesarch/x86/kernel/fpu/xstate.c+7 -150 replies
5/30x86/fpu: Cleanup the on_boot_cpu clutterarch/x86/kernel/fpu/init.c arch/x86/kernel/fpu/xstate.c+0 -250 replies
6/30x86/fpu: Remove pointless memset in fpu_clone()arch/x86/kernel/fpu/core.c+0 -60 replies
7/30x86/process: Clone FPU in copy_thread()arch/x86/kernel/process.c+3 -10 replies
8/30x86/fpu: Do not inherit FPU context for kernel and IO worker threadsarch/x86/kernel/fpu/core.c+26 -110 replies
9/30x86/fpu: Cleanup xstate xcomp_bv initializationarch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c arch/x86/kernel/fpu/init.c +3 more+49 -330 replies
10/30x86/fpu/xstate: Provide and use for_each_xfeature()arch/x86/kernel/fpu/xstate.c+23 -330 replies
11/30x86/fpu/xstate: Mark all init only functions __initarch/x86/kernel/fpu/xstate.c+5 -50 replies
12/30x86/fpu: Move KVMs FPU swapping to FPU corearch/x86/include/asm/fpu/api.h arch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c +4 more+48 -600 replies
13/30x86/fpu: Replace KVMs home brewed FPU copy from userarch/x86/include/asm/fpu/api.h arch/x86/kernel/fpu/core.c arch/x86/kernel/fpu/xstate.c +1 more+43 -740 replies
14/30x86/fpu: Rework copy_xstate_to_uabi_buf()arch/x86/kernel/fpu/xstate.c arch/x86/kernel/fpu/xstate.h+29 -80 replies
15/30x86/fpu: Replace KVMs home brewed FPU copy to userarch/x86/include/asm/fpu/api.h arch/x86/kernel/fpu/core.c arch/x86/kvm/x86.c+22 -530 replies
16/30x86/fpu: Mark fpu__init_prepare_fx_sw_frame() as __initarch/x86/include/asm/fpu/signal.h arch/x86/kernel/fpu/internal.h arch/x86/kernel/fpu/signal.c +1 more+12 -30 replies
17/30x86/fpu: Move context switch and exit to user inlines into sched.harch/x86/include/asm/fpu/internal.h arch/x86/include/asm/fpu/sched.h arch/x86/kernel/fpu/core.c +3 more+72 -630 replies
18/30x86/fpu: Clean up cpu feature testsarch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c arch/x86/kernel/fpu/internal.h +1 more+14 -180 replies
19/30x86/fpu: Make os_xrstor_booting() privatearch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/xstate.c+23 -250 replies
20/30x86/fpu: Move os_xsave() and os_xrstor() to corearch/x86/include/asm/fpu/internal.h arch/x86/include/asm/fpu/xstate.h arch/x86/kernel/fpu/signal.c +1 more+175 -1710 replies
21/30x86/fpu: Move legacy ASM wrappers to corearch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/core.c arch/x86/kernel/fpu/legacy.h +2 more+111 -1010 replies
22/30x86/fpu: Make WARN_ON_FPU() privatearch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/init.c arch/x86/kernel/fpu/internal.h+8 -90 replies
23/30x86/fpu: Move fpregs_restore_userregs() to corearch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/context.h arch/x86/kernel/fpu/core.c +2 more+88 -831 reply
24/30x86/fpu: Move mxcsr related code to corearch/x86/include/asm/fpu/xcr.h arch/x86/kernel/fpu/init.c arch/x86/kernel/fpu/legacy.h +3 more+12 -130 replies
25/30x86/fpu: Move fpstate functions to api.harch/x86/include/asm/fpu/api.h arch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/internal.h +1 more+13 -100 replies
26/30x86/fpu: Remove internal.h dependency from fpu/signal.harch/x86/ia32/ia32_signal.c arch/x86/include/asm/fpu/api.h arch/x86/include/asm/fpu/internal.h +5 more+18 -120 replies
27/30x86/sev: Include fpu/xcr.harch/x86/kernel/sev.c+1 -10 replies
28/30x86/fpu: Mop up the internal.h leftoversarch/x86/include/asm/fpu/api.h arch/x86/include/asm/fpu/internal.h arch/x86/kernel/fpu/init.c +1 more+14 -180 replies
29/30x86/fpu: Replace the includes of fpu/internal.harch/x86/include/asm/fpu/internal.h arch/x86/kernel/cpu/bugs.c arch/x86/kernel/cpu/common.c +9 more+10 -370 replies
30/30x86/fpu: Provide a proper function for ex_handler_fprestore()arch/x86/include/asm/fpu/api.h arch/x86/kernel/fpu/core.c arch/x86/kernel/fpu/internal.h +1 more+10 -60 replies

Reviews trailers per patch

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

PatchPaolo Bonzini
1/30
2/30
3/30
4/30
5/30
6/30
7/30
8/30
9/30
10/30
11/30
12/30R-b
13/30
14/30
15/30
16/30
17/30
18/30
19/30
20/30
21/30
22/30
23/30
24/30
25/30
26/30
27/30
28/30
29/30
30/30

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

Read the v2 thread

Cover letter [patch V2 00/30] x86/fpu: Preparatory cleanups for AMX support (part 1)

This is the rework of the V1 part-1 series of the effort to support the new AMX feature:

     https://lore.kernel.org/r/[email protected]

This part cleans up existing mess. Historical leftovers, shortcomings and especially the universal kitchen sink asm/fpu/internal.h which is included all over the place for the wrong reasons.

This series has a value independent of AMX, but allows to make the integration and conversion to the new world order of dynamically enabled feature bits simpler.

The serries is based on:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/fpu

and also available from git:

git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu-1

The full series which has the full AMX support included can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu

Changes vs. V1:

- Fixed the issue in the !XSAVE code path of the kvm UABI copy function - Paolo

- Renamed the KVM functions - Boris, Paolo, Sean

- Fixed the comments and changelog issues - Boris

Thanks,

tglx

---
 arch/x86/events/perf_event.h        |    1 
 arch/x86/ia32/ia32_signal.c         |    1 
 arch/x86/include/asm/fpu/api.h      |   31 ++
 arch/x86/include/asm/fpu/internal.h |  530 ------------------------------------
 arch/x86/include/asm/fpu/signal.h   |   13 
 arch/x86/include/asm/fpu/xcr.h      |   11 
 arch/x86/include/asm/fpu/xstate.h   |    6 
 arch/x86/include/asm/pkru.h         |    2 
 arch/x86/kernel/cpu/bugs.c          |    2 
 arch/x86/kernel/cpu/common.c        |    2 
 arch/x86/kernel/fpu/bugs.c          |    2 
 arch/x86/kernel/fpu/core.c          |  161 ++++++++--
 arch/x86/kernel/fpu/init.c          |   29 -
 arch/x86/kernel/fpu/regset.c        |    6 
 arch/x86/kernel/fpu/signal.c        |   21 -
 arch/x86/kernel/fpu/xstate.c        |  172 ++++++-----
 arch/x86/kernel/process.c           |    6 
 arch/x86/kernel/process_32.c        |    5 
 arch/x86/kernel/process_64.c        |    5 
 arch/x86/kernel/ptrace.c            |    1 
 arch/x86/kernel/sev.c               |    2 
 arch/x86/kernel/signal.c            |    1 
 arch/x86/kernel/smpboot.c           |    2 
 arch/x86/kernel/traps.c             |    2 
 arch/x86/kvm/svm/sev.c              |    2 
 arch/x86/kvm/vmx/vmx.c              |    2 
 arch/x86/kvm/x86.c                  |  192 +------------
 arch/x86/math-emu/fpu_entry.c       |    2 
 arch/x86/mm/extable.c               |    4 
 arch/x86/power/cpu.c                |    2 
 b/arch/x86/include/asm/fpu/sched.h  |   68 ++++
 b/arch/x86/kernel/fpu/context.h     |   85 +++++
 b/arch/x86/kernel/fpu/internal.h    |   30 ++
 b/arch/x86/kernel/fpu/legacy.h      |  115 +++++++
 b/arch/x86/kernel/fpu/xstate.h      |  198 +++++++++++++
 35 files changed, 824 insertions(+), 890 deletions(-)