diff mbox series

[3/3] ARM: compressed: Enable ZSTD compression

Message ID 20230412212126.3966502-4-j.neuschaefer@gmx.net (mailing list archive)
State New, archived
Headers show
Series ARM ZSTD boot compression | expand

Commit Message

J. Neuschäfer April 12, 2023, 9:21 p.m. UTC
With the previous two commits, it is possible to enable ZSTD
in the decompressor stub for 32-bit ARM.

Unfortunately, ZSTD decompression has been quite slow in my tests
(on ARM926EJ-S, ARMv5T):

 - LZO:  7.2 MiB,  6 seconds
 - ZSTD: 5.6 MiB, 60 seconds

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
 arch/arm/Kconfig                      | 1 +
 arch/arm/boot/compressed/Makefile     | 3 ++-
 arch/arm/boot/compressed/decompress.c | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)

--
2.39.2

Comments

Linus Walleij April 12, 2023, 9:45 p.m. UTC | #1
On Wed, Apr 12, 2023 at 11:22 PM Jonathan Neuschäfer
<j.neuschaefer@gmx.net> wrote:

> With the previous two commits, it is possible to enable ZSTD
> in the decompressor stub for 32-bit ARM.
>
> Unfortunately, ZSTD decompression has been quite slow in my tests
> (on ARM926EJ-S, ARMv5T):
>
>  - LZO:  7.2 MiB,  6 seconds
>  - ZSTD: 5.6 MiB, 60 seconds
>
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

Disappointingly slow, but not all systems are 926, and
not all memory hierarchies are as slow.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Florian Fainelli April 12, 2023, 9:49 p.m. UTC | #2
On 4/12/23 14:21, Jonathan Neuschäfer wrote:
> With the previous two commits, it is possible to enable ZSTD
> in the decompressor stub for 32-bit ARM.
> 
> Unfortunately, ZSTD decompression has been quite slow in my tests
> (on ARM926EJ-S, ARMv5T):
> 
>   - LZO:  7.2 MiB,  6 seconds
>   - ZSTD: 5.6 MiB, 60 seconds
> 
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e24a9820e12fa..065a1746a257a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -108,6 +108,7 @@  config ARM
 	select HAVE_KERNEL_LZMA
 	select HAVE_KERNEL_LZO
 	select HAVE_KERNEL_XZ
+	select HAVE_KERNEL_ZSTD
 	select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M
 	select HAVE_KRETPROBES if HAVE_KPROBES
 	select HAVE_MOD_ARCH_SPECIFIC
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index dec565a5b1f21..55bfca154b12a 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -81,6 +81,7 @@  compress-$(CONFIG_KERNEL_LZO)  = lzo_with_size
 compress-$(CONFIG_KERNEL_LZMA) = lzma_with_size
 compress-$(CONFIG_KERNEL_XZ)   = xzkern_with_size
 compress-$(CONFIG_KERNEL_LZ4)  = lz4_with_size
+compress-$(CONFIG_KERNEL_ZSTD) = zstd22_with_size

 libfdt_objs := fdt_rw.o fdt_ro.o fdt_wip.o fdt.o

@@ -98,7 +99,7 @@  OBJS	+= lib1funcs.o ashldi3.o bswapsdi2.o
 targets       := vmlinux vmlinux.lds piggy_data piggy.o \
 		 head.o $(OBJS)

-KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
+KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS

 ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \
 	     -I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
index 3d098b84ee391..2c4fd33444829 100644
--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -59,6 +59,10 @@  extern char * strchrnul(const char *, int);
 #include "../../../../lib/decompress_unlz4.c"
 #endif

+#ifdef CONFIG_KERNEL_ZSTD
+#include "../../../../lib/decompress_unzstd.c"
+#endif
+
 int do_decompress(u8 *input, int len, u8 *output, int outlen, void (*error)(char *x))
 {
 	return __decompress(input, len, NULL, NULL, output, outlen, NULL, error);