zfs: backport AES-GCM performance accelleration

Bug #1881107 reported by Colin Ian King
This bug affects 4 people
Affects Status Importance Assigned to Milestone
zfs-linux (Ubuntu)
Colin Ian King
Colin Ian King
Colin Ian King

Bug Description

== SRU Justification ==

Upstream commit 31b160f0a6c673c8f926233af2ed6d5354808393 contains AES-GCM acceleration changes that significantly improve encrypted performance.

Tests on a memory backed pool show performance improvements of ~15-22% for AES-CCM writes, ~17-20% AES-CCM reads, 34-36% AES-GCM writes and ~79-80% AES-GCM reads on a Sandybridge x86-64 CPU, so this looks like a promising optimization that will benefit a lot of users.

== The fix ==

Backport of upstream 31b160f0a6c673c8f926233af2ed6d5354808393 - this is already backported in Groovy ZFS 0.8.3-1ubuntu13

== Test case ==

Run ZFS performance tests from ubuntu_performance_zfs_encryption ubuntu kernel team autotests. With the fix the encryption runs significantly faster, as noted earlier in the SRU justification.

Also test with the 4 types of ZFS ubuntu autotests, should not fail any of these.

== Regression Potential ==

This fix alters the crypto engine and adds in new optimizations for CPUs that have capable instruction sets. There is a risk that this new crypto code is erroneous.

Changed in zfs-linux (Ubuntu):
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Colin Ian King (colin-king)
Changed in zfs-linux (Ubuntu Focal):
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Colin Ian King (colin-king)
Changed in zfs-linux (Ubuntu Groovy):
status: In Progress → Fix Released
Revision history for this message
Colin Ian King (colin-king) wrote :

benchmarked on Haswell Intel 8 thread CPU:

Benchmarks: original

15:29:15 INFO | zfs_encryption_aes_128_ccm_wr_rate_mbytes_per_second_average 79.6500
15:29:15 INFO | zfs_encryption_aes_128_ccm_rd_rate_mbytes_per_second_average 68.9800
15:29:15 INFO | zfs_encryption_aes_192_ccm_wr_rate_mbytes_per_second_average 79.4400
15:29:15 INFO | zfs_encryption_aes_192_ccm_rd_rate_mbytes_per_second_average 67.0700
15:29:15 INFO | zfs_encryption_aes_256_ccm_wr_rate_mbytes_per_second_average 78.2600
15:29:15 INFO | zfs_encryption_aes_256_ccm_rd_rate_mbytes_per_second_average 64.2200
15:29:15 INFO | zfs_encryption_aes_128_gcm_wr_rate_mbytes_per_second_average 79.2000
15:29:15 INFO | zfs_encryption_aes_128_gcm_rd_rate_mbytes_per_second_average 79.4600
15:29:15 INFO | zfs_encryption_aes_192_gcm_wr_rate_mbytes_per_second_average 78.9500
15:29:15 INFO | zfs_encryption_aes_192_gcm_rd_rate_mbytes_per_second_average 77.5500
15:29:15 INFO | zfs_encryption_aes_256_gcm_wr_rate_mbytes_per_second_average 78.3500
15:29:15 INFO | zfs_encryption_aes_256_gcm_rd_rate_mbytes_per_second_average 76.0900

Benchmarks: optimized

15:13:33 INFO | zfs_encryption_aes_128_ccm_wr_rate_mbytes_per_second_average 89.2900
15:13:33 INFO | zfs_encryption_aes_128_ccm_rd_rate_mbytes_per_second_average 73.2800
15:13:33 INFO | zfs_encryption_aes_192_ccm_wr_rate_mbytes_per_second_average 88.9800
15:13:33 INFO | zfs_encryption_aes_192_ccm_rd_rate_mbytes_per_second_average 70.9100
15:13:33 INFO | zfs_encryption_aes_256_ccm_wr_rate_mbytes_per_second_average 88.3000
15:13:33 INFO | zfs_encryption_aes_256_ccm_rd_rate_mbytes_per_second_average 68.4500
15:13:33 INFO | zfs_encryption_aes_128_gcm_wr_rate_mbytes_per_second_average 113.1000
15:13:33 INFO | zfs_encryption_aes_128_gcm_rd_rate_mbytes_per_second_average 353.2000
15:13:33 INFO | zfs_encryption_aes_192_gcm_wr_rate_mbytes_per_second_average 112.7000
15:13:33 INFO | zfs_encryption_aes_192_gcm_rd_rate_mbytes_per_second_average 349.7000
15:13:33 INFO | zfs_encryption_aes_256_gcm_wr_rate_mbytes_per_second_average 111.6000
15:13:33 INFO | zfs_encryption_aes_256_gcm_rd_rate_mbytes_per_second_average 344.6000

description: updated
Revision history for this message
Richard Laager (rlaager) wrote : Re: [Bug 1881107] Re: zfs: backport AES-GCM performance accelleration

There is another AES-GCM performance acceleration commit for systems without MOVBE.


Revision history for this message
Colin Ian King (colin-king) wrote :

I'll be doing the latter fix once I've got this through SRU process. I'm trying to make a low-risk set of updates.

Revision history for this message
Chris Halse Rogers (raof) wrote :

Do we have the tests run on hardware that does not support the relevant instructions, in addition to running them on CPUs with the AES instructions?

Changed in zfs-linux (Ubuntu Focal):
status: In Progress → Fix Committed
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello Colin, or anyone else affected,

Accepted zfs-linux into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/zfs-linux/0.8.3-1ubuntu12.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Colin Ian King (colin-king) wrote :

I've tested this on a Haswell, Intel Core2 Duo and Conroe CPUs under emulation. The latter two CPUS don't have AES instruction sets and work fine. Attached are some benchmarks.

Also regression tested on Intel Core2 Duo and Haswell with the ubuntu zfs autotests, so I believe I've covered AES and non-AES code paths in the testing.

tags: added: verification-done verification-done-focal
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package zfs-linux - 0.8.3-1ubuntu12.1

zfs-linux (0.8.3-1ubuntu12.1) focal; urgency=medium

  * Backport AES-GCM performance accelleration (LP: #1881107)
   - backport of upstream zfs commit 31b160f0a6c673c8f926233af2ed6d5354808393
     ("ICP: Improve AES-GCM performance").
     tests on a memory backed pool show performance improvements of ~15-22%
     for AES-CCM writes, ~17-20% AES-CCM reads, 34-36% AES-GCM writes and
     ~79-80% AES-GCM reads.

 -- Colin Ian King <email address hidden> Tue, 28 May 2020 11:54:33 +0100

Changed in zfs-linux (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for zfs-linux has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Josef Rypáček (jrypacek) wrote :

I can confirm the fix will enhance speed ~ 3 times on my machine, but fixed ZFS kernel module is not included even in current focal-updates kernel (linux-modules-5.4.0-39-generic).
I had to install zfs-dkms to get zfs kernel module of version 0.8.3-1ubuntu12.1.

I was trying to find what version will include fixed zfs module, but without success.

Revision history for this message
Matthias Köhne (mattone) wrote :

I can confirm it. At the moment the kernel module is not patched and you need to install the package zfs-dkms.

without patch:

with patch (apt install zfs-dkms && reboot):

Ubuntu 20.04 LTS
linux-image-5.4.0-40-generic (5.4.0-40.44) amd64
zfs-dkms (0.8.3-1ubuntu12.1) all

CPU: AMD Opteron(tm) X3216 APU
zfs encryption: aes-256-gcm

Revision history for this message
Colin Ian King (colin-king) wrote :

Yep, this will be sync'd from the dkms source into the kernel once this is released.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers