From patchwork Wed Apr 12 21:21:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 13209533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6AC2C77B6C for ; Wed, 12 Apr 2023 21:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=isPhNqjQolo/NjWLgJC6OA1oZ3PrFhuKhZYEPvakzQo=; b=d4FQJxCyIayT+a D6e0peBAHwYM//O1bu+fRYu6fOeOseBnrnn2crkzyGMkYouVVfxagWYbjU1lnkMkXleOK58pxTMRK 9//I+Mj/EI64Q8Vm5u/3CGy7nGDJlsqtOgRJY5Yp06PlE1s66Hw4AEhlqN3PjK+qQXLnaB+VZ1Q6F Y1JDymBqfz8WnEzUAqKEKlwhUnVpSP07ITZCpZEUd4ttBoORGsrN6waIyO+XYudjZ1MBdNeZrYXOa sr3yIZ5ROZXqCr/eQnps77oTmnsWUfYOpwBDHIMxZoQyA8EBI4RfHFb88FyBdviehh+Dz4TgIxUFT /UkAVL50WXYBrasN9Vqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmhvP-004Ndd-0i; Wed, 12 Apr 2023 21:22:43 +0000 Received: from mout.gmx.net ([212.227.17.21]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmhvF-004NZs-2I for linux-arm-kernel@lists.infradead.org; Wed, 12 Apr 2023 21:22:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1681334525; i=j.neuschaefer@gmx.net; bh=O8EbCtqxtHYhZl3Wus9zpBDqTyNgSWv3QZ/g5KBbeZI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=OEA1FhescqUfkOmuDqtkrGYkKZCy/DMEnk/LaDmgvBNs6cqpozk4B5wSbdVg4eX+0 jA55Hn+8mgTDiLiJxRBXYzrhFkxTydPaae1mBbv9EbLrqTZdeeWYTRdDeA2ysIHdWe T2au7ZXelcTcVcaqof0jmgi2RFJ3ed08v4XSOUmqSy2YPWT6FEYzFJDBE66qLlX55A G8gUPrynRofubUWeiO5vh20659JGdvj+8KHG/VPf2VS6bJ027Hv9i5RSjdo/5QZ4fC Jl1N5WtMV8ONYplNfVOxh77gD05BSzzrBsqyp4ZJf/e7cO1qJFFJOGGgoDoehmWX6a EffFTMVy6YMBQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from probook ([185.66.193.41]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N63RQ-1qShXR3GeW-016N3I; Wed, 12 Apr 2023 23:22:05 +0200 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= To: linux-arm-kernel@lists.infradead.org Cc: Russell King , Nick Terrell , Arnd Bergmann , Tony Lindgren , Geert Uytterhoeven , Linus Walleij , Sebastian Reichel , Nick Hawkins , Christophe Leroy , =?utf-8?q?Jonathan_Neusch?= =?utf-8?q?=C3=A4fer?= , Florian Fainelli , Nick Desaulniers , Xin Li , Seung-Woo Kim , Paul Bolle , Bart Van Assche , linux-kernel@vger.kernel.org, "Russell King (Oracle)" , Kees Cook Subject: [PATCH 3/3] ARM: compressed: Enable ZSTD compression Date: Wed, 12 Apr 2023 23:21:26 +0200 Message-Id: <20230412212126.3966502-4-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230412212126.3966502-1-j.neuschaefer@gmx.net> References: <20230412212126.3966502-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:NLKJGLSHU/mKfwCFI6t1irU5z5u/MoO8jr3NJmsYweqgxdI5Qej 8HKkQD920FU6M/3UgPqB3iyyeKTUracoZXdCvl6zR9JR8iCBQopsrIkYbHNi829tR8F85qN gfcXNwiXoc7xB1PZcoSLxNCks6kZ4E9WWqCJxk/io62ncpopqYU+SGyVLaLVgRb6vXLg/q0 nlxUZapXHoRUQp5KeUkCg== UI-OutboundReport: notjunk:1;M01:P0:7C88/EJwyYk=;EeZbn8oZQQ/XlBkmsNhLXC3DX7O R87+ukUz9LEx9YhSUTia1vUhBfnlR+q/60srJ9GvSFs3KRBjshvC2NEXiM+VR6mKcx5zKDJGv p08RzsUUX0moiNRGbI4unwoyVbI+tI93CkBjnl8PAGA7QRRK0y6SJWoDU9Z6+BXglJ/sLlvKY EaHPhCyVSyMPTxMDDdfcpd8SSksT5Q91jf2+YQBm/c1XYi/M5Lk4HFxw/bARvBqEYaqe8ZOgy Pt309QyAELbHcVzb/45JWFFsKWO5Jr8LkhAMDaULrGq+E+PBZskNxU3h4O3fxbC4xcjHHhAGu ihSPkV7N88zZL+B6EeNYQYn3s8ayZU8PV9AuCvIWH0pNJEVa9b7CkH66XbkJJDHmhF1Rb0aYP zXzk+Q6pSnSiV4mb7x0IAZcNIw6PtbLnkGQ11w0yJEW4PtthEZmL+opLCg2ddmRmZwQ8GYVch K1ED8gy3/+lWlpp31ahWDrq/7jZdlcdDYH0pX+IGtAVBVtY3xEqK91270ofa6CJGr9KylJ4zv YYTCFR+6ffFOkvpqnw9rEtN0tk65MjseXOK1Cy9CVFA+CLzm9jW1S1rVvSMvuny/W69DYM2gW qp/uM7ccNaBPcdpmdrYGo1EOFi+J8OVw+/qf1dJf14uliHL3T2hWP0MWIEvUl4WseV0Nui1/t EZ98duNQ5kZCmiLiWc5MnmLIDvIYB7RDHzV9gJHZRXww/BGdI18S0EkE3774F4BTjifZodfgy hGN73q3Tku/qeJsvWustKlGnEch6/OkzV54elWHrrYxj8ugoX9nZP+Iy5pE2A8/aMNr8myvCo 1Tofwfxw2qg5xMBP24MahPlPk/HgM7JPwsjqNTQyVfCclALIHvIdgmk2TJGxGM6EyZFS6ddXx nbe4+8TGXLF4Rax/CoyhO1MswNk+4dp9n2+FcBxMsZ9A/xBlSYdVKYfqy6ITGFrIlc2l2lCJp eyu5pQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230412_142234_039142_1D4B5A52 X-CRM114-Status: GOOD ( 13.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli --- 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 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);