Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1194090pxa; Thu, 6 Aug 2020 01:46:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkTxx6xlhmPgaItK0l4Y/7OgHo+XeXQ2Nj5Nq0Zp2U0h8fUq9bseaKJfeCAAM7d4QMTgtg X-Received: by 2002:a17:906:7855:: with SMTP id p21mr3281550ejm.492.1596703598467; Thu, 06 Aug 2020 01:46:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596703598; cv=none; d=google.com; s=arc-20160816; b=v0i4KHpjiIokvRy+ufs+KuWlur4UmIwb8oC0QGSVgNUImn8Be+0IBxa2A+aNcUAftj U71I/RlWbah2xy/0bfjt+PuiyQYGmLGyrTpX5cOza6rsRs5lXOtnUUBb6rOZoBKQ1ket aTZHSX45TV+StTvct4JMeskakpgtBbwdhb/A7NXTp/jX5d9E9BS22RJnuAu8wLov1N0+ tKsEzWvEIBAhwatCxsAwFcXp9gLXLMj3qX6XOM5RVQkvbKX748iyZKTEVBWmZFXa0WUX uVCXNois+A/jyushqPMuXtzvIhDusyUS9Spx3m23lOn7HKUJ+MdoHBnkLbx3TnOV4LFB sINg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=b581h/DwwqCtloal8vDOli1r/qOdK2w3K3dkhJG5PnA=; b=p+PBvzNbGiD+UKPFaaAFu2nNulgSgmaMBxlGXwOY+kMjqZo/cnNBiBUBzFHHfTsSrO uZNx5izeBTzdEOiAue5eJLmcpAHX7GOc7Zq527z/TC3RkzYIqtP/2nj5jAvYEFZbl2Qw MolooFjdXzpiEfiVO5QKPVz25vdGejwiED5npUA7mT7G7qevAHClfNefiqttDcflwXCd XZpVvM5Er1zwxx74cdeJq/DILho8HRC/FGKXfsnIEep2tIRO++H0+Rvim0Ms5sgb/X/6 7nvt1FPYS2H741m9OSLjRCm7EFa2RL5izPF7Cag84da6D99MDKu8V6aUZ6wNB2+nMnZh Q0Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bUkysNgo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a9si2829746ejd.356.2020.08.06.01.46.15; Thu, 06 Aug 2020 01:46:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bUkysNgo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728935AbgHFIp4 (ORCPT + 99 others); Thu, 6 Aug 2020 04:45:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727768AbgHFIpy (ORCPT ); Thu, 6 Aug 2020 04:45:54 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D7FBC061574 for ; Thu, 6 Aug 2020 01:45:54 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id a5so33530129ioa.13 for ; Thu, 06 Aug 2020 01:45:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b581h/DwwqCtloal8vDOli1r/qOdK2w3K3dkhJG5PnA=; b=bUkysNgoI/3DolrnPuLM+/o0BheysqbMk/Gnm3+hhcZD3pgCZEhmWMtDB0aGT7PzcS VrnonLKgLaBJy1HYiWsdumIc1hZmzaZWwMBY/xE9EfOOom8OvBZkoH54e7KFuyuVFy58 7eTkBclebOf6NWr8VMFAVIjTcNDJnaIJhkgNlPG5nDnUZlsSfo/h/SrMt3ptnw5o+44f 5aK1FFzw3/8HAIgr2H2plYwUBqtSYZh7Am1Jmb/KBHjoI7MEwz5qGCzjL+6QtayOdcdB JmpKGe1xl+hQEQ4BjMOI7yCdERrwzOyrQYswFpTk29jwCGf8pmw+DfagMZOPwdNeHF9F OBnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b581h/DwwqCtloal8vDOli1r/qOdK2w3K3dkhJG5PnA=; b=LpprW2dyJBvyDP0pQPDK9aJ5va89AQ4arbvbEF0lg16uklS85Z0J11V/otaagwTpz5 uI7QwZEIVrFPtz/Tfw69Cus5e/+fFHtFTtq+vJRWWsUB6z6FLbQJd2V3Cyyw+AdBJcHV 3jYRAP++eB8myoxlNqRKFnP1gLiuqxEl8zDCchM5XqqqVURoChG35SQCxb/5gxreJo74 KZ9GAXoVuRO2NFjOonUg6JnRm9IEWXg4e9qXzD9SbW4WPFhTjIpFDlH6+QrIm8AIFeiz 49ziu4qFCTYtUCUbtBZ5o5AO93EXplNRVwNzkfnJUw+sEcCkKfcBnKz4Et9eFlt7i+ZD KBOQ== X-Gm-Message-State: AOAM530b9ePfDk1RUSEwSzaj+iHyBCamhoJUTTFsnz04ySCW5L601B2b DTqaMSUBDnFdZ5rChuq2qLVu0+Zh4MKGWMXDMBY= X-Received: by 2002:a5e:dd02:: with SMTP id t2mr8159451iop.90.1596703553451; Thu, 06 Aug 2020 01:45:53 -0700 (PDT) MIME-Version: 1.0 References: <20200805230555.84214-1-nolange79@gmail.com> <20200806003042.GB1551@shell.armlinux.org.uk> In-Reply-To: <20200806003042.GB1551@shell.armlinux.org.uk> From: Norbert Lange Date: Thu, 6 Aug 2020 10:45:42 +0200 Message-ID: Subject: Re: [PATCH] arm: Add support for ZSTD compressed kernel To: Russell King - ARM Linux admin Cc: Arnd Bergmann , linux-kernel , Petr Malat , Kees Cook , Adam Borowski , Sedat Dilek , Andrew Morton , Nick Terrell Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Do., 6. Aug. 2020 um 02:30 Uhr schrieb Russell King - ARM Linux admin : > > On Thu, Aug 06, 2020 at 01:05:55AM +0200, Norbert Lange wrote: > > diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S > > index 434a16982e34..1af01bfe6638 100644 > > --- a/arch/arm/boot/compressed/head.S > > +++ b/arch/arm/boot/compressed/head.S > > @@ -614,7 +614,11 @@ not_relocated: mov r0, #0 > > */ > > mov r0, r4 > > mov r1, sp @ malloc space above stack > > +#if defined(CONFIG_KERNEL_ZSTD) > > + add r2, sp, #0x30000 @ Context needs ~160K > > That's going to mess up kexec: > > /* > * The zImage length does not include its stack (4k) or its > * malloc space (64k). Include this. > */ > len += 0x11000; > > I guess we need to add this to the information provided to kexec. Ouch, I guess it's rather impossible to load a new ZSTD kernel with a old kexec version in that case. Some ideas to fix that would be: - Increase the padding to "192K + 4K is enough for everyone" in kexec - Add the required/recommended stack+heap size to zImage so kexec can use it. - change boot logic to place heap before/after the *output* range. with the various ways of booting arm this will likely cause other issues in some combinations. - try to reduce zstd context size safetly below 64K. I believe the entropy tables are computed once and never modified, so those could be part of the zImage (at some loss of compression rate of course). Would need some host tool to inject those. Norbert