[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201025161931.GA1119983@rani.riverdale.lan>
Date: Sun, 25 Oct 2020 12:19:31 -0400
From: Arvind Sankar <nivedita@...m.mit.edu>
To: Arvind Sankar <nivedita@...m.mit.edu>
Cc: linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] efi/x86: Only copy the compressed kernel image in
efi_relocate_kernel()
On Sun, Oct 11, 2020 at 10:20:12AM -0400, Arvind Sankar wrote:
> The image_size argument to efi_relocate_kernel() is currently specified
> as init_size, but this is unnecessarily large. The compressed kernel is
> much smaller, in fact, its image only extends up to the start of _bss,
> since at this point, the .bss section is still uninitialized.
>
> Depending on compression level, this can reduce the amount of data
> copied by 4-5x.
>
> Signed-off-by: Arvind Sankar <nivedita@...m.mit.edu>
Ping
> ---
> drivers/firmware/efi/libstub/x86-stub.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
> index 3672539cb96e..f14c4ff5839f 100644
> --- a/drivers/firmware/efi/libstub/x86-stub.c
> +++ b/drivers/firmware/efi/libstub/x86-stub.c
> @@ -715,8 +715,11 @@ unsigned long efi_main(efi_handle_t handle,
> (IS_ENABLED(CONFIG_X86_32) && buffer_end > KERNEL_IMAGE_SIZE) ||
> (IS_ENABLED(CONFIG_X86_64) && buffer_end > MAXMEM_X86_64_4LEVEL) ||
> (image_offset == 0)) {
> + extern char _bss[];
> +
> status = efi_relocate_kernel(&bzimage_addr,
> - hdr->init_size, hdr->init_size,
> + (unsigned long)_bss - bzimage_addr,
> + hdr->init_size,
> hdr->pref_address,
> hdr->kernel_alignment,
> LOAD_PHYSICAL_ADDR);
> --
> 2.26.2
>
Powered by blists - more mailing lists