]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Linux 5.16 compat: don't use XSTATE_XSAVE to save FPU state
authorAttila Fülöp <attila@fueloep.org>
Wed, 9 Feb 2022 20:50:10 +0000 (21:50 +0100)
committerGitHub <noreply@github.com>
Wed, 9 Feb 2022 20:50:10 +0000 (12:50 -0800)
commit8e94ac0e36c552ec1a852be8efc0a2811cef2932
treedc8100be54ce923d1104d29fe464de9fc61a9f18
parente2909fae8f2c3b15459fd4c0acc1999c6907864b
Linux 5.16 compat: don't use XSTATE_XSAVE to save FPU state

Linux 5.16 moved XSTATE_XSAVE and XSTATE_XRESTORE out of our reach,
so add our own XSAVE{,OPT,S} code and use it for Linux 5.16.

Please note that this differs from previous behavior in that it
won't handle exceptions created by XSAVE an XRSTOR. This is sensible
for three reasons.

 - Exceptions during XSAVE and XRSTOR can only occur if the feature
   is not supported or enabled or the memory operand isn't aligned
   on a 64 byte boundary. If this happens something else went
   terribly wrong, and it may be better to stop execution.

 - Previously we just printed a warning and didn't handle the fault,
   this is arguable for the above reason.

 - All other *SAVE instruction also don't handle exceptions, so this
   at least aligns behavior.

Finally add a test to catch such a regression in the future.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes #13042
Closes #13059
config/kernel-fpu.m4
config/toolchain-simd.m4
configure.ac
include/os/linux/kernel/linux/simd_x86.h
module/zcommon/zfs_prop.c
tests/runfiles/linux.run
tests/zfs-tests/tests/functional/Makefile.am
tests/zfs-tests/tests/functional/simd/Makefile.am [new file with mode: 0644]
tests/zfs-tests/tests/functional/simd/simd_supported.ksh [new file with mode: 0755]