APPLIED[J]: [Jammy][PULL] Intel: enable x86 AMX

Andrea Righi andrea.righi at canonical.com
Tue Apr 5 14:34:44 UTC 2022


On Mon, Apr 04, 2022 at 04:31:25PM +0200, Andrea Righi wrote:
> BugLink: https://bugs.launchpad.net/bugs/1967750
> 
> [Impact]
> 
> Enable AMX (aka TMUL) new instructions on the 5.15 kernel.
> 
> [Test case]
> 
> Tests have been performed directly by Intel.
> 
> [Fix]
> 
> Apply the following upstream commits (most of them are clean
> cherry-picks, except 4 of them that require small context adjustment):
> 
> 20df73756148 ("selftests/x86/amx: Update the ARCH_REQ_XCOMP_PERM test")
> 063452fd94d1 ("x86/fpu/xstate: Fix the ARCH_REQ_XCOMP_PERM implementation")
> fa31a4d669bd ("x86/cpufeatures: Put the AMX macros in the word 18 block")
> 6c3118c32129 ("signal: Skip the altstack update when not needed")
> 52d0b8b18776 ("x86/fpu/signal: Initialize sw_bytes in save_xstate_epilog()")
> d7a9590f608d ("Documentation/x86: Add documentation for using dynamic XSTATE features")
> 101c669d165d ("selftests/x86/amx: Add context switch test")
> 6a3e0651b4a0 ("selftests/x86/amx: Add test cases for AMX state management")
> 2308ee57d93d ("x86/fpu/amx: Enable the AMX feature in 64-bit mode")
> db3e7321b4b8 ("x86/fpu: Add XFD handling for dynamic states")
> 2ae996e0c1a3 ("x86/fpu: Calculate the default sizes independently")
> eec2113eabd9 ("x86/fpu/amx: Define AMX state components and have it used for boot-time checks")
> 70c3f1671b0c ("x86/fpu/xstate: Prepare XSAVE feature table for gaps in state component numbers")
> 500afbf645a0 ("x86/fpu/xstate: Add fpstate_realloc()/free()")
> 783e87b40495 ("x86/fpu/xstate: Add XFD #NM handler")
> 672365477ae8 ("x86/fpu: Update XFD state where required")
> 5529acf47ec3 ("x86/fpu: Add sanity checks for XFD")
> 8bf26758ca96 ("x86/fpu: Add XFD state to fpstate")
> dae1bd583896 ("x86/msr-index: Add MSRs for XFD")
> c351101678ce ("x86/cpufeatures: Add eXtended Feature Disabling (XFD) feature bit")
> e61d6310a0f8 ("x86/fpu: Reset permission and fpstate on exec()")
> 9e798e9aa14c ("x86/fpu: Prepare fpu_clone() for dynamically enabled features")
> 53599b4d54b9 ("x86/fpu/signal: Prepare for variable sigframe length")
> 4b7ca609a33d ("x86/signal: Use fpu::__state_user_size for sigalt stack validation")
> 23686ef25d4a ("x86/fpu: Add basic helpers for dynamically enabled features")
> db8268df0983 ("x86/arch_prctl: Add controls for dynamic XSTATE components")
> c33f0a81a2cf ("x86/fpu: Add fpu_state_config::legacy_features")
> 6f6a7c09c406 ("x86/fpu: Add members to struct fpu to cache permission information")
> 84e4dccc8fce ("x86/fpu/xstate: Provide xstate_calculate_size()")
> 3aac3ebea08f ("x86/signal: Implement sigaltstack size validation")
> 1bdda24c4af6 ("signal: Add an optional check for altstack size")
> 582b01b6ab27 ("x86/fpu: Remove old KVM FPU interface")
> d69c1382e1b7 ("x86/kvm: Convert FPU handling to a single swap buffer")
> 69f6ed1d14c6 ("x86/fpu: Provide infrastructure for KVM FPU cleanup")
> 75c52dad5e32 ("x86/fpu: Prepare for sanitizing KVM FPU code")
> d72c87018d00 ("x86/fpu/xstate: Move remaining xfeature helpers to core")
> eda32f4f93b4 ("x86/fpu: Rework restore_regs_from_fpstate()")
> daddee247319 ("x86/fpu: Mop up xfeatures_mask_uabi()")
> 1c253ff2287f ("x86/fpu: Move xstate feature masks to fpu_*_cfg")
> 2bd264bce238 ("x86/fpu: Move xstate size to fpu_*_cfg")
> cd9ae7617449 ("x86/fpu/xstate: Cleanup size calculations")
> 617473acdfe4 ("x86/fpu: Cleanup fpu__init_system_xstate_size_legacy()")
> 578971f4e228 ("x86/fpu: Provide struct fpu_config")
> 5509cc78080d ("x86/fpu/signal: Use fpstate for size and features")
> 49e4eb4125d5 ("x86/fpu/xstate: Use fpstate for copy_uabi_to_xstate()")
> 3ac8d75778fc ("x86/fpu: Use fpstate in __copy_xstate_to_uabi_buf()")
> ad6ede407aae ("x86/fpu: Use fpstate in fpu_copy_kvm_uabi_to_fpstate()")
> 0b2d39aa0357 ("x86/fpu/xstate: Use fpstate for xsave_to_user_sigframe()")
> 073e627a4537 ("x86/fpu/xstate: Use fpstate for os_xsave()")
> be31dfdfd75b ("x86/fpu: Use fpstate::size")
> 248452ce21ae ("x86/fpu: Add size and mask information to fpstate")
> 2dd8eedc80b1 ("x86/process: Move arch_thread_struct_whitelist() out of line")
> f0cbc8b3cdf7 ("x86/fpu: Do not leak fpstate pointer on fork")
> 2f27b5034244 ("x86/fpu: Remove fpu::state")
> 63d6bdf36ce1 ("x86/math-emu: Convert to fpstate")
> c20942ce5128 ("x86/fpu/core: Convert to fpstate")
> 7e049e8b7459 ("x86/fpu/signal: Convert to fpstate")
> caee31a36c33 ("x86/fpu/regset: Convert to fpstate")
> cceb496420fa ("x86/fpu: Convert tracing to fpstate")
> 1c57572d754f ("x86/KVM: Convert to fpstate")
> 087df48c298c ("x86/fpu: Replace KVMs xstate component clearing")
> 18b3fa1ad15f ("x86/fpu: Convert restore_fpregs_from_fpstate() to struct fpstate")
> f83ac56acdad ("x86/fpu: Convert fpstate_init() to struct fpstate")
> 87d0e5be0fac ("x86/fpu: Provide struct fpstate")
> bf5d00470787 ("x86/fpu: Replace KVMs home brewed FPU copy to user")
> 079ec41b22b9 ("x86/fpu: Provide a proper function for ex_handler_fprestore()")
> b56d2795b297 ("x86/fpu: Replace the includes of fpu/internal.h")
> 6415bb809263 ("x86/fpu: Mop up the internal.h leftovers")
> ff0c37e191f2 ("x86/sev: Include fpu/xcr.h")
> 0ae67cc34f76 ("x86/fpu: Remove internal.h dependency from fpu/signal.h")
> 90489f1dee8b ("x86/fpu: Move fpstate functions to api.h")
> d9d005f32aac ("x86/fpu: Move mxcsr related code to core")
> 9848fb96839b ("x86/fpu: Move fpregs_restore_userregs() to core")
> cdcb6fa14e14 ("x86/fpu: Make WARN_ON_FPU() private")
> 34002571cb41 ("x86/fpu: Move legacy ASM wrappers to core")
> df95b0f1aa56 ("x86/fpu: Move os_xsave() and os_xrstor() to core")
> b579d0c3750e ("x86/fpu: Make os_xrstor_booting() private")
> d06241f52cfe ("x86/fpu: Clean up CPU feature tests")
> 63e81807c1f9 ("x86/fpu: Move context switch and exit to user inlines into sched.h")
> 9603445549da ("x86/fpu: Mark fpu__init_prepare_fx_sw_frame() as __init")
> ca834defd33b ("x86/fpu: Rework copy_xstate_to_uabi_buf()")
> ea4d6938d4c0 ("x86/fpu: Replace KVMs home brewed FPU copy from user")
> a0ff0611c2fb ("x86/fpu: Move KVMs FPU swapping to FPU core")
> 63cf05a19a5d ("x86/fpu/xstate: Mark all init only functions __init")
> ffd3e504c9e0 ("x86/fpu/xstate: Provide and use for_each_xfeature()")
> 126fe0401883 ("x86/fpu: Cleanup xstate xcomp_bv initialization")
> 509e7a30cd0a ("x86/fpu: Do not inherit FPU context for kernel and IO worker threads")
> 2d16a1876f20 ("x86/process: Clone FPU in copy_thread()")
> 01f9f62d3ae7 ("x86/fpu: Remove pointless memset in fpu_clone()")
> dc2f39fd1bf2 ("x86/fpu: Cleanup the on_boot_cpu clutter")
> f5daf836f292 ("x86/fpu: Restrict xsaves()/xrstors() to independent states")
> b50854eca0e0 ("x86/pkru: Remove useless include")
> d2d926482cdf ("x86/fpu: Update stale comments")
> 9568bfb4f04b ("x86/fpu: Remove pointless argument from switch_fpu_finish()")
> 724fc0248d45 ("x86/fpu/signal: Fix missed conversion to correct boolean retval in save_xstate_epilog()")
> a2a8fd9a3efd ("x86/fpu/signal: Change return code of restore_fpregs_from_user() to boolean")
> be0040144152 ("x86/fpu/signal: Change return code of check_xstate_in_sigframe() to boolean")
> 1193f408cd51 ("x86/fpu/signal: Change return type of __fpu_restore_sig() to boolean")
> f3305be5feec ("x86/fpu/signal: Change return type of fpu__restore_sig() to boolean")
> ee4ecdfbd289 ("x86/signal: Change return type of restore_sigcontext() to boolean")
> 2af07f3a6e9f ("x86/fpu/signal: Change return type of copy_fpregs_to_sigframe() helpers to boolean")
> 052adee66828 ("x86/fpu/signal: Change return type of copy_fpstate_to_sigframe() to boolean")
> fcfb7163329c ("x86/fpu/signal: Move xstate clearing out of copy_fpregs_to_sigframe()")
> 4164a482a5d9 ("x86/fpu/signal: Move header zeroing out of xsave_to_user_sigframe()")
> 4339d0c63c2d ("x86/fpu/signal: Clarify exception handling in restore_fpregs_from_user()")
> 0c2e62ba04cd ("x86/extable: Remove EX_TYPE_FAULT from MCE safe fixups")
> c6304556f3ae ("x86/fpu: Use EX_TYPE_FAULT_MCE_SAFE for exception fixups")
> c1c97d175493 ("x86/copy_mc: Use EX_TYPE_DEFAULT_MCE_SAFE for exception fixups")
> 2cadf5248b93 ("x86/extable: Provide EX_TYPE_DEFAULT_MCE_SAFE and EX_TYPE_FAULT_MCE_SAFE")
> 46d28947d987 ("x86/extable: Rework the exception table mechanics")
> 083b32d6f4fa ("x86/mce: Get rid of stray semicolons")
> e42404afc4ca ("x86/mce: Deduplicate exception handling")
> 32fd8b59f91f ("x86/extable: Get rid of redundant macros")
> 326b567f82df ("x86/extable: Tidy up redundant handler functions")
> 
> [Regression potential]
> 
> The changes are limited to x86, mostly fpu code and signal handling, so
> we may see regressions on x86, especially on FPU-intensive workloads.

Applied to jammy/linux.

-Andrea



More information about the kernel-team mailing list