Skip to contentSkip to conversation

lib-zlib-add-s390-hardware-support-for-kernel-zlib_deflate.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jan 31, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: lib/zlib: add s390 hardware support for kernel zlib_deflate
has been removed from the -mm tree. Its filename was
lib-zlib-add-s390-hardware-support-for-kernel-zlib_deflate.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Mikhail Zaslonko <[email protected]>
Subject: lib/zlib: add s390 hardware support for kernel zlib_deflate

Patch series "S390 hardware support for kernel zlib", v3.

With IBM z15 mainframe the new DFLTCC instruction is available. It implements deflate algorithm in hardware (Nest Acceleration Unit - NXU) with estimated compression and decompression performance orders of magnitude faster than the current zlib.

This patchset adds s390 hardware compression support to kernel zlib. The code is based on the userspace zlib implementation:

	https://github.com/madler/zlib/pull/410

The coding style is also preserved for future maintainability. There is only limited set of userspace zlib functions represented in kernel. Apart from that, all the memory allocation should be performed in advance. Thus, the workarea structures are extended with the parameter lists required for the DEFLATE CONVENTION CALL instruction.

Since kernel zlib itself does not support gzip headers, only Adler-32 checksum is processed (also can be produced by DFLTCC facility). Like it was implemented for userspace, kernel zlib will compress in hardware on level 1, and in software on all other levels. Decompression will always happen in hardware (when enabled).

Two DFLTCC compression calls produce the same results only when they both are made on machines of the same generation, and when the respective buffers have the same offset relative to the start of the page. Therefore care should be taken when using hardware compression when reproducible results are desired. However it does always produce the standard conform output which can be inflated anyway.

The new kernel command line parameter 'dfltcc' is introduced to configure s390 zlib hardware support:

Format: { on | off | def_only | inf_only | always }
on: s390 zlib hardware support for compression on
level 1 and decompression (default)
off: No s390 zlib hardware support
def_only: s390 zlib hardware support for deflate
only (compression on level 1)
inf_only: s390 zlib hardware support for inflate
only (decompression)
always: Same as 'on' but ignores the selected compression
level always using hardware support (used for debugging)

The main purpose of the integration of the NXU support into the kernel zlib is the use of hardware deflate in btrfs filesystem with on-the-fly compression enabled. Apart from that, hardware support can also be used during boot for decompressing the kernel or the ramdisk image

With the patch for btrfs expanding zlib buffer from 1 to 4 pages (patch 6) the following performance results have been achieved using the ramdisk with btrfs. These are relative numbers based on throughput rate and compression ratio for zlib level 1:

  Input data              Deflate rate   Inflate rate   Compression ratio
                          NXU/Software   NXU/Software   NXU/Software
  stream of zeroes        1.46           1.02           1.00
  random ASCII data       10.44          3.00           0.96
  ASCII text (dickens)    6,21           3.33           0.94
  binary data (vmlinux)   8,37           3.90           1.02

This means that s390 hardware deflate can provide up to 10 times faster compression (on level 1) and up to 4 times faster decompression (refers to all compression levels) for btrfs zlib.

Disclaimer: Performance results are based on IBM internal tests using DD command-line utility on btrfs on a Fedora 30 based internal driver in native LPAR on a z15 system. Results may vary based on individual workload, configuration and software levels.

This patch (of 9):

Create zlib_dfltcc library with the s390 DEFLATE CONVERSION CALL implementation and related compression functions. Update zlib_deflate functions with the hooks for s390 hardware support and adjust workspace structures with extra parameter lists required for hardware deflate.

---

 lib/Kconfig                      |    7 
 lib/Makefile                     |    1 
 lib/zlib_deflate/deflate.c       |   79 ++++----
 lib/zlib_deflate/deftree.c       |   54 -----
 lib/zlib_deflate/defutil.h       |  134 +++++++++++++-
 lib/zlib_dfltcc/Makefile         |   11 +
 lib/zlib_dfltcc/dfltcc.c         |   52 +++++
 lib/zlib_dfltcc/dfltcc.h         |  115 ++++++++++++
 lib/zlib_dfltcc/dfltcc_deflate.c |  274 +++++++++++++++++++++++++++++
 lib/zlib_dfltcc/dfltcc_syms.c    |   17 +
 lib/zlib_dfltcc/dfltcc_util.h    |  110 +++++++++++
 11 files changed, 752 insertions(+), 102 deletions(-)
lib/Kconfig renamed from lib/Kconfig~lib-zlib-add-s390-hardware-support-for-kernel-zlib_deflate +7 -0
@@ -278,6 +278,13 @@ config ZLIB_DEFLATE
 	tristate
 	select BITREVERSE
 
+config ZLIB_DFLTCC
+	def_bool y
+	depends on S390
+	prompt "Enable s390x DEFLATE CONVERSION CALL support for kernel zlib"
+	help
+	 Enable s390x hardware support for zlib in the kernel.
+
 config LZO_COMPRESS
 	tristate
 
lib/Makefile renamed from lib/Makefile~lib-zlib-add-s390-hardware-support-for-kernel-zlib_deflate +1 -0
@@ -140,6 +140,7 @@ obj-$(CONFIG_842_COMPRESS) += 842/
 obj-$(CONFIG_842_DECOMPRESS) += 842/
 obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/
 obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/
+obj-$(CONFIG_ZLIB_DFLTCC) += zlib_dfltcc/
 obj-$(CONFIG_REED_SOLOMON) += reed_solomon/
 obj-$(CONFIG_BCH) += bch.o
 obj-$(CONFIG_LZO_COMPRESS) += lzo/
lib/zlib_deflate/deflate.c renamed from lib/zlib_deflate/deflate.c~lib-zlib-add-s390-hardware-support-for-kernel-zlib_deflate +41 -38

132 lines not on this page · raw message

lib/zlib_deflate/deftree.c renamed from lib/zlib_deflate/deftree.c~lib-zlib-add-s390-hardware-support-for-kernel-zlib_deflate +0 -54

72 lines not on this page · raw message

lib/zlib_deflate/defutil.h renamed from lib/zlib_deflate/defutil.h~lib-zlib-add-s390-hardware-support-for-kernel-zlib_deflate +124 -10

155 lines not on this page · raw message

lib/zlib_dfltcc/dfltcc.c new file +52 -0

52 lines not on this page · raw message

lib/zlib_dfltcc/dfltcc_deflate.c new file +274 -0

274 lines not on this page · raw message

lib/zlib_dfltcc/dfltcc.h new file +115 -0

115 lines not on this page · raw message

lib/zlib_dfltcc/dfltcc_syms.c new file +17 -0
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * linux/lib/zlib_dfltcc/dfltcc_syms.c
+ *
+ * Exported symbols for the s390 zlib dfltcc support.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/zlib.h>
+#include "dfltcc.h"
+
+EXPORT_SYMBOL(dfltcc_can_deflate);
+EXPORT_SYMBOL(dfltcc_deflate);
+EXPORT_SYMBOL(dfltcc_reset);
+MODULE_LICENSE("GPL");
lib/zlib_dfltcc/dfltcc_util.h new file +110 -0

110 lines not on this page · raw message

lib/zlib_dfltcc/Makefile new file +11 -0
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# This is a modified version of zlib, which does all memory
+# allocation ahead of time.
+#
+# This is the code for s390 zlib hardware support.
+#
+
+obj-$(CONFIG_ZLIB_DFLTCC) += zlib_dfltcc.o
+
+zlib_dfltcc-objs := dfltcc.o dfltcc_deflate.o dfltcc_syms.o

_

Patches currently in -mm which might be from [email protected] are