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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93729C54EBC for ; Sat, 7 Jan 2023 17:38:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D64CD854E5; Sat, 7 Jan 2023 18:38:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="C7a+4IuB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 54899854E5; Sat, 7 Jan 2023 18:38:49 +0100 (CET) Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C75D285369 for ; Sat, 7 Jan 2023 18:38:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x835.google.com with SMTP id i20so4665493qtw.9 for ; Sat, 07 Jan 2023 09:38:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=hHEb14XnHjKQipoxpXDKVWBXa831KCP9P89eyCgoXcc=; b=C7a+4IuBqBujpE19e2R54uIeqmkHHcBajuupZOFTd/HFJqK0z8LYc6JfZBQe2IhdzE 27+kVpz9U3f/QpOXg1+AhWAJm7lnjlzvIKihmyI5w+gVlIbLqMOoQeSGJRps+vS5sHAd /yR5XRttZl3M9bGefLSOgaz/3mXskVx9mJEDM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hHEb14XnHjKQipoxpXDKVWBXa831KCP9P89eyCgoXcc=; b=HnHpa4sUmPhpPS0cIsAN+3g8GvT7MWp1B99XX0nIsFlQO/08c2uPlAbA4IIr227dZH lElrI4uVy1TEXpcdxZFOPXLJKS+4YMeduA/cwU/HvD3qfJymE0K8yGnU7+Cp0Cay+Nyc BQfUMc6bQu22JN88QDVIRcTnRlXu5GDFL10G3OloAEc5Z07PST00CkKoXZDE3nW5xxZA E0MMI7Jnw3BbHYHQnWPm8o52qQwtYGOipXYMZYAg2RFcaF9ka4jnC4lX1S8guBd/iIxk y/b+cNH1nmpSxmUZ116923gAkF4imN8dekNBtSgqfWqQCvh3aswxfYNCyLBu8B+3V6oI 9zvQ== X-Gm-Message-State: AFqh2kqELBm1kf0gs95Npe+r1T8gbyLheB1aZXLzMv+zN3L3U26Dm+PE B6wCf91RCEj+tNgeIe91DS5ImQ== X-Google-Smtp-Source: AMrXdXuF7kwRnX2UTmIYM7LZGEtxxJ/TtKelcFdDsnp6txUSRW5sKr2pZaQ3us19SyPti41IxoqBEw== X-Received: by 2002:a05:622a:d:b0:3a8:1eb6:ee34 with SMTP id x13-20020a05622a000d00b003a81eb6ee34mr112109507qtw.50.1673113124611; Sat, 07 Jan 2023 09:38:44 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-64a1-0c30-ebd7-ca7b.res6.spectrum.com. [2603:6081:7b00:6400:64a1:c30:ebd7:ca7b]) by smtp.gmail.com with ESMTPSA id k19-20020a05620a415300b006feb0007217sm2457010qko.65.2023.01.07.09.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 09:38:43 -0800 (PST) Date: Sat, 7 Jan 2023 12:38:42 -0500 From: Tom Rini To: "Maier, Brandon L Collins" Cc: Simon Glass , "u-boot@lists.denx.de" Subject: Re: [PATCH v2 1/2] lib: zstd: update to latest Linux zstd 1.5.2 Message-ID: <20230107173842.GO3787616@bill-the-cat> References: <20221227144613.48752-1-brandon.maier@collins.com> <20230102163006.GM3787616@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="f2EeAIwuhmaV39Bp" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean --f2EeAIwuhmaV39Bp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 06, 2023 at 11:26:36PM +0000, Maier, Brandon L = Collins wrote: > > From: Tom Rini > > On Mon, Jan 02, 2023 at 04:02:06PM +0000, Maier, Brandon L > > > > > > I understand Linux replaced their custom zstd code with the Facebook = zstd > > code, so the changes are widespread. The new zstd does support many > > optional performance features as documented in zstd's lib/README[1], > > which I have already added a KConfig to disable all of them in this pat= ch. For > > reference, if I enable the performance options the build size increases= as so: > > > > > > aarch64: (for 2/2 boards) all +27432.0 rodata +320.0 text +27112.0 > > > arm: (for 5/5 boards) all +21801.6 rodata +256.0 text +21545.6 > > > sandbox: (for 2/2 boards) all +59004.0 bss +16.0 rodata +800.0 text > > +58188.0 > > > > > > I haven't had any luck finding another way to decrease build size. > > > > > > [1] > > https://github.com/facebook/zstd/blob/dev/lib/README.md#modular-build > >=20 > > After skimming over that, did you see if not disabling inlining, and > > letting the compiler figure it out is a big size penalty? >=20 > That is one of the settings I am already enabling. To clarify from that R= EADME, the settings I am enabling in U-Boot are HUF_FORCE_DECOMPRESS_X1, ZS= TD_FORCE_DECOMPRESS_SEQUENCES_SHORT, ZSTD_NO_INLINE, and ZSTD_STRIP_ERROR_S= TRINGS. Which is what upstream zstd uses for their own ZSTD_LIB_MINIFY opti= on in lib/libzstd.mk. >=20 > If I drop the ZSTD_NO_INLINE, the build sizes increase as follows: >=20 > aarch64: (for 2/2 boards) all +6212.0 rodata +8.0 text +6204.0 > arm: (for 5/5 boards) all +7408.0 text +7408.0 > sandbox: (for 2/2 boards) all +21928.0 bss -16.0 data +16.0 rodata +22= 4.0 text +21704.0 On top of the previous I assume, OK, darn. > > Also, while the arch-level details are good, a specific platform set of= numbers > > instead might give some ideas on where maybe reductions could come from. > =20 > I looked over each platform, but the size deltas are consistent within ea= ch architecture. >=20 > What stands out though is that the old ZSTD ARM code is about 4.6kb small= er (25%) than the old ZSTD AARCH64 code. The newer ZSTD doesn't do that, bo= th ARM and AARCH64 are about the same in size. That is why there is a 4k ju= mp in size for just the arm boards. Comparing the functions list between th= e two, both archs appear similar except ZSTD_decompressBlock_internal() gro= ws significantly on aarch64 for some reason. I haven't seen any obvious roo= t cause though. >=20 > Here is the full breakdown of platform size deltas >=20 > aarch64: (for 2/2 boards) all +535.5 rodata +965.5 text -430.0 > turris_mox : all +572 rodata +968 text -396 > mvebu_espressobin-88f3720: all +499 rodata +963 text -464 > arm: (for 5/5 boards) all +4489.6 rodata +940.0 text +3549.6 > turris_omnia : all +4608 rodata +940 text +3668 > m53menlo : all +4460 rodata +940 text +3520 > dh_imx6 : all +4460 rodata +940 text +3520 > stm32mp15_dhcom_basic: all +4460 rodata +940 text +3520 > stm32mp15_dhcor_basic: all +4460 rodata +940 text +3520 > sandbox: (for 2/2 boards) all +8.0 rodata +784.0 text -776.0 > sandbox : all +528 bss -32 rodata +768 text -208 > sandbox64 : all -512 bss +32 rodata +800 text -1344 >=20 >=20 > > Finally, what is the whole list of platforms that grow? >=20 > All of them except sandbox64 grow by some amount. >=20 > > It's all not ideal, yes, but it looks like BTRFS is the main user, righ= t now, which > > isn't widely enabled. So maybe we can look towards improving upstream a > > bit here, if motivated. >=20 > I can't speak for the BTRFS code as I don't have a suitable platform > to test it on. But the zstd code does appear to be broken on master. > Running the zstd compression test in sandbox or sandbox64 both > segfault. And I have similar problems trying to decompress FIT images > on our AARCH64 platform. The primary motivation to this patch is that > the new version does work. And this seems like the appropriate fix > given Linux has abandoned the original version of this code. Well, I guess in the end, non-functional smaller code is factually worse than larger functional code, so, I'll pick this up post v2023.01, thanks! --=20 Tom --f2EeAIwuhmaV39Bp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmO5riEACgkQFHw5/5Y0 tyyxXwwAjFrPj3Vkvfd9LXAmTfESfnLNuQxeRrn5qxt4zjZGlruLLC3qV4gmhWrI JFak3ZU5WwwN+nJhlM7lZjcbifJ5EMxAksPfgE+jAshrkt1JiPTmuqHCVSsm865h l2zTx4MzRjDyGRQ3YKQhtF/cz8hkAR/sLrIgYy9m4YhauhIfquArEsFxmw64mFPa D96BVnIzWKa5eNaomx/bq3JPSPWIhHzH2wkKE7y+KhYQZBqzhGmCPs6wRF/ZEIjW +li0BZILFo2UNhVYCMnozvyw5zagkAbvbuIlyOIBLkIDQtLlSjAR2CqyvTGDuLxe Bj2uGCHdDXnxkAosI7Gvx/8NltLsclIa1cbo3v1AQnN/KsWGc7XT5VQ3mOjvFn/r WVEm51oEUJwxaJjNdB46cJr23CzYVdMKzjmiPxDCqQKOnaNLjHKjWsHC31VL+VsF uXTO+MGDIwcEDqtK4YqGBSBVDVmLcRwHTN4ZJd/WhEjsmYaVs1LmvzO4F5Wu2p/f mYW1NbHv =j7oN -----END PGP SIGNATURE----- --f2EeAIwuhmaV39Bp--