Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kexec-tools] arm-zImage: prepare for more malloc requirements of zstd
@ 2026-08-29  9:46 Andreas Kemnade
  2026-08-31  9:59 ` Mukesh Pilaniya
  2026-08-31 10:31 ` Russell King
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Kemnade @ 2026-08-29  9:46 UTC (permalink / raw)
  To: kexec, Andrew Morton, Baoquan He, Mike Rapoport, Pasha Tatashin,
	Pratyush Yadav, Simon Horman
  Cc: Russell King, j.neuschaefer, Andreas Kemnade

As there are plans for zstd in zImage for ARM, which requires more malloc
size fo, decompression, increase the space.

References:
https://lore.kernel.org/lkml/ZFDMRst2O+RJUYuu@shell.armlinux.org.uk/#t
https://lore.kernel.org/lkml/20260828-zstd2-v2-0-4d9ce7150877@kemnade.info/

Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 kexec/arch/arm/kexec-zImage-arm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kexec/arch/arm/kexec-zImage-arm.c b/kexec/arch/arm/kexec-zImage-arm.c
index 8b474dd..97db7f3 100644
--- a/kexec/arch/arm/kexec-zImage-arm.c
+++ b/kexec/arch/arm/kexec-zImage-arm.c
@@ -663,9 +663,9 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
 
 	/*
 	 * The zImage length does not include its stack (4k) or its
-	 * malloc space (64k).  Include this.
+	 * malloc space (128k).  Include this.
 	 */
-	len += 0x11000;
+	len += 0x21000;
 
 	dbgprintf("zImage requires 0x%08llx bytes\n", (unsigned long long)len);
 
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH kexec-tools] arm-zImage: prepare for more malloc requirements of zstd
  2026-08-29  9:46 [PATCH kexec-tools] arm-zImage: prepare for more malloc requirements of zstd Andreas Kemnade
@ 2026-08-31  9:59 ` Mukesh Pilaniya
  2026-08-31 10:31 ` Russell King
  1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Pilaniya @ 2026-08-31  9:59 UTC (permalink / raw)
  To: Andreas Kemnade, kexec, Andrew Morton, Baoquan He, Mike Rapoport,
	Pasha Tatashin, Pratyush Yadav, Simon Horman
  Cc: Russell King, j.neuschaefer

Hi Andreas,

On 29/08/26 3:16 pm, Andreas Kemnade wrote:
> As there are plans for zstd in zImage for ARM, which requires more malloc
> size fo, decompression, increase the space.
> 
_size fo_ looks like a truncated _size for_ .

The high-level changes look good to me. Feel free to add:
Acked-by: Mukesh Pilaniya <mpilaniy@redhat.com>

> References:
> https://lore.kernel.org/lkml/ZFDMRst2O+RJUYuu@shell.armlinux.org.uk/#t
> https://lore.kernel.org/lkml/20260828-zstd2-v2-0-4d9ce7150877@kemnade.info/
> 
> Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
>  kexec/arch/arm/kexec-zImage-arm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kexec/arch/arm/kexec-zImage-arm.c b/kexec/arch/arm/kexec-zImage-arm.c
> index 8b474dd..97db7f3 100644
> --- a/kexec/arch/arm/kexec-zImage-arm.c
> +++ b/kexec/arch/arm/kexec-zImage-arm.c
> @@ -663,9 +663,9 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
>  
>  	/*
>  	 * The zImage length does not include its stack (4k) or its
> -	 * malloc space (64k).  Include this.
> +	 * malloc space (128k).  Include this.
>  	 */
> -	len += 0x11000;
> +	len += 0x21000;
>  
>  	dbgprintf("zImage requires 0x%08llx bytes\n", (unsigned long long)len);
>  

-- 
Regards,
Mukesh Pilaniya



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH kexec-tools] arm-zImage: prepare for more malloc requirements of zstd
  2026-08-29  9:46 [PATCH kexec-tools] arm-zImage: prepare for more malloc requirements of zstd Andreas Kemnade
  2026-08-31  9:59 ` Mukesh Pilaniya
@ 2026-08-31 10:31 ` Russell King
  1 sibling, 0 replies; 3+ messages in thread
From: Russell King @ 2026-08-31 10:31 UTC (permalink / raw)
  To: Andreas Kemnade
  Cc: kexec, Andrew Morton, Baoquan He, Mike Rapoport, Pasha Tatashin,
	Pratyush Yadav, Simon Horman, j.neuschaefer

On Sat, Aug 29, 2026 at 11:46:07AM +0200, Andreas Kemnade wrote:
> As there are plans for zstd in zImage for ARM, which requires more malloc
> size fo, decompression, increase the space.
> 
> References:
> https://lore.kernel.org/lkml/ZFDMRst2O+RJUYuu@shell.armlinux.org.uk/#t
> https://lore.kernel.org/lkml/20260828-zstd2-v2-0-4d9ce7150877@kemnade.info/
> 
> Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>

There's a better way to deal with this, added in commit adc5f7029376
("ARM: add malloc size to decompressor kexec size structure") in the
kernel. An additional member was added to the magic structure which
indicates the required malloc size.

In kexec-tools, this structure can be found as "struct zimage_tag"
but it is missing the extended entry in struct zimage_krnl_size.

This still requires the 4k stack to be added, but will give you the
size of the malloc. If this member is missing, then 64k should be
assumed.

Note that tag->hdr.size checks in kexec look incorrect, as this is
the number of 32-bit words from the start of the tag. It also looks
like find_extension_tag() assumes it's bytes rather than 32-bit
words. :(

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-31 10:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-29  9:46 [PATCH kexec-tools] arm-zImage: prepare for more malloc requirements of zstd Andreas Kemnade
2026-08-31  9:59 ` Mukesh Pilaniya
2026-08-31 10:31 ` Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox