Re: [PATCH V2 08/12] MIPS: Align kernel load address to 64KB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jan 27, 2018 at 11:22:15AM +0800, Huacai Chen wrote:
> KEXEC assume kernel align to PAGE_SIZE, and 64KB is the largest
> PAGE_SIZE.

Please expand, maybe referring to sanity_check_segment_list() which does
the actual check. Maybe something like this:

 Kexec needs the new kernel's load address to be aligned on a page
 boundary (see sanity_check_segment_list()), but on MIPS the default
 vmlinuz load address is only explicitly aligned to 16 bytes.

 Since the largest PAGE_SIZE supported by MIPS kernels is 64KB, increase
 the alignment calculated by calc_vmlinuz_load_addr to 64KB.


I suppose it'd be a bit ugly for the kexec userland code to increase the
size of the load segment downwards to make it page aligned...

> 
> Signed-off-by: Huacai Chen <chenhc@xxxxxxxxxx>
> ---
>  arch/mips/boot/compressed/calc_vmlinuz_load_addr.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
> index 37fe58c..1dcaef4 100644
> --- a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
> +++ b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
> @@ -45,11 +45,10 @@ int main(int argc, char *argv[])
>  	vmlinuz_load_addr = vmlinux_load_addr + vmlinux_size;
>  
>  	/*
> -	 * Align with 16 bytes: "greater than that used for any standard data
> -	 * types by a MIPS compiler." -- See MIPS Run Linux (Second Edition).
> +	 * Align with 64KB: KEXEC assume kernel align to PAGE_SIZE

"Align to 64KB: kexec needs load sections to be aligned to PAGE_SIZE,
which may be as large as 64KB depending on the kernel configuration".

>  	 */
>  
> -	vmlinuz_load_addr += (16 - vmlinux_size % 16);
> +	vmlinuz_load_addr += (65536 - vmlinux_size % 65536);

Personally I find (64 * 1024) (or even SZ_64K) easier to read, but no
big deal.

Thanks
James

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux