OSDN Git Service

powerpc/kexec_file: Fix kexec load failure with lack of memory hole
authorHari Bathini <hbathini@linux.ibm.com>
Wed, 29 Jul 2020 11:43:49 +0000 (17:13 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 29 Jul 2020 13:47:54 +0000 (23:47 +1000)
commitb5667d13be8d0928a02b46e0c6f7ab891d32f697
tree92c308e2f5ca937f358484010dec940fda243b33
parent6ecd0163d36049b5f2435a8658f1320c9f3f2924
powerpc/kexec_file: Fix kexec load failure with lack of memory hole

The kexec purgatory has to run in real mode. Only the first memory
block maybe accessible in real mode. And, unlike the case with panic
kernel, no memory is set aside for regular kexec load. Another thing
to note is, the memory for crashkernel is reserved at an offset of
128MB. So, when crashkernel memory is reserved, the memory ranges to
load kexec segments shrink further as the generic code only looks for
memblock free memory ranges and in all likelihood only a tiny bit of
memory from 0 to 128MB would be available to load kexec segments.

With kdump being used by default in general, kexec file load is likely
to fail almost always. This can be fixed by changing the memory hole
lookup logic for regular kexec to use the same method as kdump. This
would mean that most kexec segments will overlap with crashkernel
memory region. That should still be ok as the pages, whose destination
address isn't available while loading, are placed in an intermediate
location till a flush to the actual destination address happens during
kexec boot sequence.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Tested-by: Pingfan Liu <piliu@redhat.com>
Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/159602302326.575379.14038896654942043093.stgit@hbathini
arch/powerpc/kexec/file_load_64.c