Re: [PATCH v8 6/7] x86: Add support for ZSTD compressed kernel

From: Ingo Molnar
Date: Fri Jul 24 2020 - 08:26:47 EST



* Nick Terrell <nickrterrell@xxxxxxxxx> wrote:

> --- a/arch/x86/boot/compressed/misc.c
> +++ b/arch/x86/boot/compressed/misc.c
> @@ -12,6 +12,11 @@
> * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
> */
>
> +/* decompressors bring in EXPORT_SYMBOL which is meaningless and will
> + * cause compiler errors in some cases.
> + */
> +#define __DISABLE_EXPORTS
> +
> #include "misc.h"
> #include "error.h"
> #include "pgtable.h"
> @@ -77,6 +82,10 @@ static int lines, cols;
> #ifdef CONFIG_KERNEL_LZ4
> #include "../../../../lib/decompress_unlz4.c"
> #endif
> +
> +#ifdef CONFIG_KERNEL_ZSTD
> +#include "../../../../lib/decompress_unzstd.c"
> +#endif
> /*
> * NOTE: When adding a new decompressor, please update the analysis in
> * ../header.S.
> diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h
> index 680c320363db..d6dd43d25d9f 100644
> --- a/arch/x86/include/asm/boot.h
> +++ b/arch/x86/include/asm/boot.h
> @@ -24,9 +24,11 @@
> # error "Invalid value for CONFIG_PHYSICAL_ALIGN"
> #endif
>
> -#ifdef CONFIG_KERNEL_BZIP2
> +#if defined(CONFIG_KERNEL_BZIP2)
> # define BOOT_HEAP_SIZE 0x400000
> -#else /* !CONFIG_KERNEL_BZIP2 */
> +#elif defined(CONFIG_KERNEL_ZSTD)
> +# define BOOT_HEAP_SIZE 0x30000
> +#else
> # define BOOT_HEAP_SIZE 0x10000
> #endif

So the other patches explain why the decompression buffer extra space
was increased from 64k to 128k, but is there a similar
calculation/estimate for bumping BOOT_HEAD_SIZE from 64k to 192k?

Admittedly the BZ2 exception doesn't set a good example, but maybe we
can do this for ZSTD?

Thanks,

Ingo