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

Offload SHA256 to FreeBSD's OCF. #13649

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

gldisater
Copy link
Contributor

@gldisater gldisater commented Jul 13, 2022

Motivation and Context

Improve the performance of SHA256 checksum usage by ZFS.

Description

Check if OCF has hardware acceleration available. If so, use it instead of the software implementation that's built into OpenZFS. Allan Jude did a review of this patch and wanted the crypto_os.h files and cleaned up style issues.

FreeBSD 13 will need https://cgit.freebsd.org/src/commit/?id=c71f2370c5d480cf70f12ee276e044681c57aefc to be backported to it before this patch will work on 13

How Has This Been Tested?

On Intel without SHA256 acceleration and on Ryzen and Apple M1, created a zpool and dataset using SHA256, dd 100GB of /dev/random into the dataset and scrub the pool. Apply the patch, recompile the FreeBSD kernel and reboot. Scrub the pool.

On Apple M1 the pre-patch scrub is 1000MB/s and 80% cpu usage, after the patch and loading ossl.ko to provide the SHA256 acceleration results in 1.7GB/s and 30% cpu usage.

On my Ryzen 1700 I don't have fast enough SSDs to saturate my cpu, about 25-30% cpu usage before at 500MB/s. After is 5-8%

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)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Signed-off-by: Jeremy Faulkner <[email protected]>
@mcmilk
Copy link
Contributor

mcmilk commented Jul 13, 2022

Hello,

the Intel QAT stuff is also hacked into OpenZFS this way... I think we should have it switchable at running time.

There are two methods for this right now:

  1. the current default way with module parameter and also the on the fly switch via echo
  2. the Z.I.A. way ... which may get into ZFS some day

@ghost ghost added the Status: Code Review Needed Ready for review and testing label Aug 5, 2022
@ghost ghost requested review from a user and amotin August 5, 2022 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Code Review Needed Ready for review and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants