Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 5.0 compat: SIMD compatibility (zfs-0.8-release) #9515

Closed

Conversation

behlendorf
Copy link
Contributor

Motivation and Context

Backport of the SIMD patches merged to master for inclusion in
the 0.8.x series. Opened for a full CI run.

Description

Restore the SIMD optimization for 4.19.38 LTS, 4.14.120 LTS,
and 5.0 and newer kernels.

This commit squashes the following commits from master in to
a single commit which can be applied to 0.8.2.

10fa254 - Linux 4.14, 4.19, 5.0+ compat: SIMD save/restore
b88ca2a - Enable SIMD for encryption
095b541 - Fix CONFIG_X86_DEBUG_FPU build failure
e5db313 - Linux 5.0 compat: SIMD compatibility

How Has This Been Tested?

Locally tested using the mprime -t torture tests while concurrently
writing to and scrubbing an encrypted raidz2 pool. This exercises
the vector implementation for fletcher4, aes, and raidz parity calculations.

No failures were reported by mprime -t after several hours of run time.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

@behlendorf behlendorf added the Type: Performance Performance improvement or performance problem label Oct 25, 2019
@sempervictus
Copy link
Contributor

Does this still permit people who have re-exported the relevant kernel symbol to use that codepath? IIRC, grsec re-exports the originally un-exported symbol, and so do all of our branches.

@behlendorf
Copy link
Contributor Author

@sempervictus yes it does. If the kernel exports the needed symbols they will be used. You can verify this in the configure output:

Using provided kernel symbols (one of these):

checking whether kernel fpu is available... kernel_fpu_*
checking whether kernel fpu is available... __kernel_fpu_* 

Using internal ZFS implementation:

checking whether kernel fpu is available... internal

Optimizations are disabled:

checking whether kernel fpu is available... unavailable

Restore the SIMD optimization for 4.19.38 LTS, 4.14.120 LTS,
and 5.0 and newer kernels.

This commit squashes the following commits from master in to
a single commit which can be applied to 0.8.2.

10fa254 - Linux 4.14, 4.19, 5.0+ compat: SIMD save/restore
b88ca2a - Enable SIMD for encryption
095b541 - Fix CONFIG_X86_DEBUG_FPU build failure
e5db313 - Linux 5.0 compat: SIMD compatibility

Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
TEST_ZIMPORT_SKIP="yes"
@nh2
Copy link

nh2 commented Dec 2, 2019

What's the state of this? I see very high z_wr_iss CPU usage on my 4.19.86 kernel on NixOS.

fxsave and xsave require the target address to be 16-/64-byte aligned.

kmalloc(_node) does not (yet) offer such fine-grained control over
alignment[0,1], even though it does "the right thing" most of the time
for power-of-2 sizes. unfortunately, alignment is completely off when
using certain debugging or hardening features/configs, such as KASAN,
slub_debug=Z or the not-yet-upstream SLAB_CANARY.

Use alloc_pages_node() instead which allows us to allocate page-aligned
memory. Since fpregs_state is padded to a full page anyway, and this
code is only relevant for x86 which has 4k pages, this approach should
not allocate any unnecessary memory but still guarantee the needed
alignment.

0: https://lwn.net/Articles/787740/
1: https://lore.kernel.org/linux-block/20190826111627.7505-1-vbabka@suse.cz/

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#9608
Closes openzfs#9674
@behlendorf
Copy link
Contributor Author

@nh2 this is now ready for inclusion in 0.8.3. One additional commit has been added to resolve an issue which only manifests itself with some Linux kernel debug options.

@tonyhutter tonyhutter mentioned this pull request Dec 27, 2019
12 tasks
@behlendorf
Copy link
Contributor Author

Closing. These changes have been included in #9776.

@behlendorf behlendorf closed this Dec 30, 2019
@behlendorf behlendorf deleted the zfs-0.8.2-simd-squash branch April 19, 2021 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Performance Performance improvement or performance problem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants