On Tue, Feb 20, 2018 at 10:53:19PM +0000, Maciej W. Rozycki wrote: > On Tue, 20 Feb 2018, James Hogan wrote: > > > > > Since the largest PAGE_SIZE supported by MIPS kernels is 64KB, increase > > > > the alignment calculated by calc_vmlinuz_load_addr to 64KB. > > > > > > But why does it have to be hardcoded? Shouldn't it be inherited from > > > the image being loaded? I'm missing bits of context here, but that > > > would be either CONFIG_PAGE_SIZE_* settings or the ELF program header's > > > `p_align' value, depending on how this code operates. Wasting say 60kB > > > of memory on smaller systems due to excessive alignment might not be a > > > good idea. > > > > I presume there's nothing to stop a kernel with 64KB pages (and hence > > requiring 64KB alignment of load sections) loading a new kernel with 4KB > > pages (which is the one we're looking at). > > As I say, I'm missing bits of context. If you say that a 64kiB-page > kernel loads a 4kiB-page kernel, then the alignment for the latter is > obviously 4kiB. So I repeat my question: why hardcode the alignment to > 64kiB while we only need 4kiB in this case? Because its the 1st kernel which is doing the kexec'ing of the 2nd kernel. The 2nd kernel might not even have kexec enabled, but you still might want to boot it using kexec. The only alternative is for the kexec userland tools to be able to automatically adjust the load segments to load a bit more before the start of the kernel image so that its aligned, and i'm not sure how universally safe that would be. Cheers James
Attachment:
signature.asc
Description: Digital signature