Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp552874ybg; Mon, 1 Jun 2020 08:15:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmBdf+id4Mbnve4z0lZ1OHAyiMBmtFLfkiJcCcmc4t5O4oTEA0n67zVlMshQfyCAeYSqsc X-Received: by 2002:a17:906:5617:: with SMTP id f23mr1908503ejq.331.1591024507931; Mon, 01 Jun 2020 08:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591024507; cv=none; d=google.com; s=arc-20160816; b=WE9w+qnL13mItPH1uq0RJODqFhVPfHAqdI1I3dwHg/mkqF0xZALhCwp2KTJMODSB0i 9DpPRcyQhOBUwkqgW5BIJN1SYpA+/uy3SfNK3zmEoUQtvnzyXq7g2G+Y7M+xe/P+nBO/ W0PDjLZv6jWrAdhVk2Qz6oMck3NqW7xhMV8rCXlLFsksb6f4ZnhfjVRN5+CLMqbwbjxE 12hctzl3osSBsrWdsFaInt7XImIgLTTnCl+Q0wBlbUbSQvPZTGQS3g9pnX4swHWMbV/l XsTVHK+avV5B6PmNYGD9f1xvERHX019Bt+Ja1LIARIj+dqfmmz7sVEWozLK+WNFUsqFj IANQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qyaZKCXXV6sKGAOCvFszwj+5rDsE8vvtfD9Kg6pCq+A=; b=cgPVp60dPCJF+4KnNvXAXFl8Gw7xgdxX3v5dGPQL5JujzsWlP6IJRcC7RMFJOSGvWV HARfCtePT3642fjJHyajrVHVJSAc490Tkaz1gyvbLhCTKQ26SztM05Sc8KEYf5wBUKbR mSAv0LP+oOAIaH9KLd3a9k7H5HmLZzVIsBSGl9a2fLiTUue5neUlRGIETvitNmtkFnhr Rai9RG0DMZ2AZMRumL6Y5chPugVXYMi9JHzidsxVhc0FE8zt0fkyaKWjXO2ztinymgCs oyZyWk2SveHDTgCYy5h7YucHE+lUD93mCcAz9IKbOyJlgl8luPl9M8qOiMaZO5JIAl3Y WZ8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="c5umpFK/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u24si629444ejr.662.2020.06.01.08.14.44; Mon, 01 Jun 2020 08:15:07 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="c5umpFK/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727776AbgFAPKq (ORCPT + 99 others); Mon, 1 Jun 2020 11:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726017AbgFAPKq (ORCPT ); Mon, 1 Jun 2020 11:10:46 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1554C05BD43 for ; Mon, 1 Jun 2020 08:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qyaZKCXXV6sKGAOCvFszwj+5rDsE8vvtfD9Kg6pCq+A=; b=c5umpFK/fS8VKhR9x6DY4E0vg flJd70nTs9XDy8KtVtirXxghIg35XLo+dBzrnlmsZNpsio9sat7SbnsO42zUkpFBo61WErrNq6GT0 2saUzmQ36pIRODEsOaOe8zkFpJCWT1yrt66ZvVSm1vBhMrIans7j5DkW0d0ELWP9yq6NxtTuVAAQv B174bdX/GlCgz4gt+kMnJqbFbMIb8xLPnkC9WMBK/nxUmG+7ZMS9CGou4pK8fOEC1+GGwVhXvU+gk JsQtVuUZqc3KuBfqcoTuoFnP9/4eUFI8qtG0q+w9ydvAScv+YYIeQYY6TAYtfkJkrFtcd9VdQvD+d gwf/+FRKA==; Received: from shell.armlinux.org.uk ([2002:4e20:1eda:1:5054:ff:fe00:4ec]:37552) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfm5A-0000d5-4q; Mon, 01 Jun 2020 16:10:32 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jfm59-0003Q9-Gu; Mon, 01 Jun 2020 16:10:31 +0100 Date: Mon, 1 Jun 2020 16:10:31 +0100 From: Russell King - ARM Linux admin To: Lukasz Stelmach Cc: Masahiro Yamada , Nick Desaulniers , Thomas Gleixner , Enrico Weigelt , Kees Cook , Ingo Molnar , Ben Dooks , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro , Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: Re: [PATCH 1/5] arm: decompressor: set malloc pool size for the decompressor Message-ID: <20200601151031.GM1551@shell.armlinux.org.uk> References: <20200601144607.GI1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 01, 2020 at 04:56:40PM +0200, Lukasz Stelmach wrote: > It was <2020-06-01 pon 15:46>, when Russell King - ARM Linux admin wrote: > > On Mon, Jun 01, 2020 at 04:27:50PM +0200, Łukasz Stelmach wrote: > >> Move the definition of malloc pool size of the decompressor to > >> a single place. This value will be exposed later for kexec_file loader. > >> > >> Signed-off-by: Łukasz Stelmach > >> --- > >> arch/arm/boot/compressed/Makefile | 2 ++ > >> arch/arm/boot/compressed/head.S | 6 ++++-- > >> 2 files changed, 6 insertions(+), 2 deletions(-) > >> > >> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile > >> index 9c11e7490292..b3594cd1588c 100644 > >> --- a/arch/arm/boot/compressed/Makefile > >> +++ b/arch/arm/boot/compressed/Makefile > >> @@ -125,6 +125,8 @@ KBSS_SZ = $(shell echo $$(($$($(NM) $(obj)/../../../../vmlinux | \ > >> sed -n -e 's/^\([^ ]*\) [AB] __bss_start$$/-0x\1/p' \ > >> -e 's/^\([^ ]*\) [AB] __bss_stop$$/+0x\1/p') )) ) > >> LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ) > >> +# malloc pool size > >> +LDFLAGS_vmlinux += --defsym _malloc_size=0x10000 > >> # Supply ZRELADDR to the decompressor via a linker symbol. > >> ifneq ($(CONFIG_AUTO_ZRELADDR),y) > >> LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR) > >> diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S > >> index e8e1c866e413..dcc1afa60fb9 100644 > >> --- a/arch/arm/boot/compressed/head.S > >> +++ b/arch/arm/boot/compressed/head.S > >> @@ -309,7 +309,8 @@ restart: adr r0, LC0 > >> #ifndef CONFIG_ZBOOT_ROM > >> /* malloc space is above the relocated stack (64k max) */ > >> add sp, sp, r0 > >> - add r10, sp, #0x10000 > >> + ldr r10, =_malloc_size > >> + add r10, r10, sp > > > > This says "locate _malloc_size in a literal pool somewhere, and load it > > using a PC-relative offset". Are you sure that the literal pool is > > sensibly located? > > > > Would it be better to use a definition for this? > > I've followed ZRELADDR way. I think both values should be handled the > same way (it makes it easier to comprehend IMHO). Is there any reason > not to? Should I change ZRELADDR for v2 too? There's a good reason. ZRELADDR can be a constant that does not fit into the ARMs immediate constants (8 bits of significant data plus a multiple of a 2-bit shift), whereas the size of the malloc space is guaranteed to fit. So, ZRELADDR has to use a literal load. This doesn't. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up