Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3645989imu; Sun, 11 Nov 2018 20:23:19 -0800 (PST) X-Google-Smtp-Source: AJdET5dE+Hyv0c/5sTh0Ja6/kbZS7xLqDvF4NnQzpUdsjZA0etcraH89PCxTHg5VMEa719DT7F+s X-Received: by 2002:a63:193:: with SMTP id 141mr9806198pgb.136.1541996599572; Sun, 11 Nov 2018 20:23:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541996599; cv=none; d=google.com; s=arc-20160816; b=hIVNGiEQk81NbZBnpXB4xNBPT+jjWVIA/syiv/DeyM5YGKPaqYWyVpGlfpBoSFQ7M2 ZfHxclWB4DhMaJLRhHZ9dzNfLjHeTyKGsKOo/XuSCd874rSE5r5CX7BoMHcjqNLewO4E F944hvWpQi4sWC9zzjilsTkZzidPtGTSel7wwObV5v1+oyfKQggwEzOJIHIN9A2MmuyD huN/6LCCRnqfcTxYD9EhbvHkS4WJH7bkuCOUF4H21fSVf8OpLTqrgmiVXFbBNffjutRn P2d+vyUZOZjKEROcdKub+yjRJ6Jjn6DOThwzo+imM6X8gPaJHD6Sr+VVsfqzETC7fl/G Ehvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=02S7gP8CBtLu/d2vn+LP1VB7jEPtnklyU3WqzRNVQTc=; b=C2Wu1XdLI5HQlUXi9fbp87Jf/Peqyyvyd9hOEwpEyOzn9Z3PB9wlRF5ibWORdQUy41 PRhQUREl4LsTovLjtr+Co94lA6KWijgqmi2BjoQg4itV0/29TbN88DH6ODCpGw8QsANk KkXsHT0VQjCtMp/xcZUpGH298kKI8b/xsiCz33VHJ+JCRwQNT12plx0oDaWpr8ngsJoA /ZSK4ENtlXh+FT+/b0sfMsrrWPL5N2dodsUmuen7g0sYPRl1Tu+A67t6YYds3SYhX4mz vKA/xs/OihkDcEVQSR15M5dK64GtBJlg5a+GyDMR5HBHAuehWGrFXG6wuCMMJf+WF5cl XFzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VzrSRQ+J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cd11-v6si18717200plb.59.2018.11.11.20.23.04; Sun, 11 Nov 2018 20:23:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VzrSRQ+J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730897AbeKLON2 (ORCPT + 99 others); Mon, 12 Nov 2018 09:13:28 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33412 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730481AbeKLON2 (ORCPT ); Mon, 12 Nov 2018 09:13:28 -0500 Received: by mail-wr1-f68.google.com with SMTP id u9-v6so7758941wrr.0; Sun, 11 Nov 2018 20:22:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=02S7gP8CBtLu/d2vn+LP1VB7jEPtnklyU3WqzRNVQTc=; b=VzrSRQ+JM8AQLv7s6XcDBlE0ZdMcRcFn+6R+TNTqMLem6BSiFRB3dsOATP099IGwpd ujEP/GRork6e1NAWzbnuRxVWZlTp4B/TA1/FsIBQ152QWUAbp1Z2iJpWUmkG6G3pcNVp 3D4bZk3y4+eGJM1qVcwn9yq7zT/LunSQnwxjx7/CvV4cp++6YMRnPfWGXpaFozbhxDB0 xil5IcRk1ThTK9AnTHYQm1HWfxj3mAuAJihoW5G1NBvfVqzcMYi79X6YkAtryz5UweP0 fVc37qOiSTUvs6rpobcLPxKINjBBLEPgoKVeOTEwZHBu0C0YQLSY0epaeHqSXAHbW2Ys RE4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=02S7gP8CBtLu/d2vn+LP1VB7jEPtnklyU3WqzRNVQTc=; b=mtwAb8NWIL6ouOu5I4/ZMZPYBNbvlYddPs+NG61QZSMp/LrCjrNicwMwc2+fdAraKQ pPKqgyAjKoqxTaoRBgO/pbWyTkV5S+LbFmeqlXmdhdFmMf1nCt+HIhy+XaYCLdhZ5Okl PvE2baf8LBvEmtDBVIYe/pgqEdMBJJSqb8HL4NbD8xhmXPJCZBsRe9iF02GUbeBzditQ fPqNprngyJDQJMdlhYmBpJl7V0nrO28j1TbI/cyPetPz6cetqMH3x7BWVggtJJQtDa4x xLu3sWk+yGBu6IcTLWlUgL4JSa7dhoMpI8CjzZGwhKe4Ra0M83m5a+qOHy4KayCRkBx6 v1Gg== X-Gm-Message-State: AGRZ1gIshVYw7CK7r1iuwseiICmwKSJOuX5IfvPI3KATWkWuxlO2g4TQ NGEDCW5rELuLsaLxJXPfLk0= X-Received: by 2002:adf:df0a:: with SMTP id y10-v6mr14821319wrl.127.1541996524481; Sun, 11 Nov 2018 20:22:04 -0800 (PST) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id j189-v6sm26136436wmf.18.2018.11.11.20.22.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Nov 2018 20:22:03 -0800 (PST) Date: Mon, 12 Nov 2018 05:22:00 +0100 From: Ingo Molnar To: Adam Borowski Cc: linux-kernel@vger.kernel.org, Nick Terrell , Russell King , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, Ralf Baechle , Paul Burton , James Hogan , linux-mips@linux-mips.org, Jonas Bonn , Stefan Kristiansson , Stafford Horne , openrisc@lists.librecores.org, "James E.J. Bottomley" , Helge Deller , linux-parisc@vger.kernel.org, Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Martin Schwidefsky , Heiko Carstens , linux-s390@vger.kernel.org, Yoshinori Sato , Rich Felker , linux-sh@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org Subject: Re: [PATCH 02/17] x86: Add support for ZSTD-compressed kernel Message-ID: <20181112042200.GA96061@gmail.com> References: <20181109185953.xwyelyqnygbskkxk@angband.pl> <20181109190304.8573-1-kilobyte@angband.pl> <20181109190304.8573-2-kilobyte@angband.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181109190304.8573-2-kilobyte@angband.pl> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Adam Borowski wrote: > From: Nick Terrell > > Integrates the ZSTD decompression code to the x86 pre-boot code. > > Zstandard requires slightly more memory during the kernel decompression > on x86 (192 KB vs 64 KB), and the memory usage is independent of the > window size. > > Zstandard requires memory proportional to the window size used during > compression for decompressing the ramdisk image, since streaming mode is > used. Newer versions of zstd (1.3.2+) list the window size of a file > with `zstd -lv '. The absolute maximum amount of memory required > is just over 8 MB. > > Signed-off-by: Nick Terrell > --- > Documentation/x86/boot.txt | 6 +++--- > arch/x86/Kconfig | 1 + > arch/x86/boot/compressed/Makefile | 5 ++++- > arch/x86/boot/compressed/misc.c | 4 ++++ > arch/x86/boot/header.S | 8 +++++++- > arch/x86/include/asm/boot.h | 6 ++++-- > 6 files changed, 23 insertions(+), 7 deletions(-) Acked-by: Ingo Molnar > diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S > index 4c881c850125..af2efb256527 100644 > --- a/arch/x86/boot/header.S > +++ b/arch/x86/boot/header.S > @@ -526,8 +526,14 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr > # the size-dependent part now grows so fast. > # > # extra_bytes = (uncompressed_size >> 8) + 65536 > +# > +# ZSTD compressed data grows by at most 3 bytes per 128K, and only has a 22 > +# byte fixed overhead but has a maximum block size of 128K, so it needs a > +# larger margin. > +# > +# extra_bytes = (uncompressed_size >> 8) + 131072 > > -#define ZO_z_extra_bytes ((ZO_z_output_len >> 8) + 65536) > +#define ZO_z_extra_bytes ((ZO_z_output_len >> 8) + 131072) This change would also affect other decompressors, not just ZSTD, correct? Might want to split this change out into a separate preparatory patch to allow it to be bisected to, or at least mention it in the changelog more explicitly? Thanks, Ingo