Message ID | 1347007260-13271-3-git-send-email-matthew.leach@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Sep 07, 2012 at 09:41:00AM +0100, Matthew Leach wrote: > Ensure that the memory regions that are set within the segments > correspond to physical contiguous memory regions. > > Reviewed-by: Simon Horman <horms@verge.net.au> > Reviewed-by: Will Deacon <will.deacon@arm.com> > Signed-off-by: Matthew Leach <matthew.leach@arm.com> What about platforms which pull out bits of physical RAM from memblock via arm_memblock_steal() ? Doesn't this mean such platforms will reduce their available memory on each subsequent kexec?
On Fri, Sep 07, 2012 at 09:49:38AM +0100, Russell King - ARM Linux wrote: > On Fri, Sep 07, 2012 at 09:41:00AM +0100, Matthew Leach wrote: > > Ensure that the memory regions that are set within the segments > > correspond to physical contiguous memory regions. > > > > Reviewed-by: Simon Horman <horms@verge.net.au> > > Reviewed-by: Will Deacon <will.deacon@arm.com> > > Signed-off-by: Matthew Leach <matthew.leach@arm.com> > > What about platforms which pull out bits of physical RAM from memblock > via arm_memblock_steal() ? Doesn't this mean such platforms will reduce > their available memory on each subsequent kexec? I don't think that will happen. All that kexec does is check that the location where it wants to load the new kernel is physically contiguous -- the memblock configuration is not inherited by the target kernel. What *might* happen is that a memblock_steal on the host kernel could cause the kexec to fail with -EINVAL if the area removed corresponds to the area where the target kernel wants to be loaded. I think this is correct behaviour, because we have no idea what the stolen region is being used for. Will
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index a6bbc0f..524139a 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c @@ -8,6 +8,7 @@ #include <linux/reboot.h> #include <linux/io.h> #include <linux/irq.h> +#include <linux/memblock.h> #include <asm/pgtable.h> #include <linux/of_fdt.h> #include <asm/pgalloc.h> @@ -42,6 +43,12 @@ int machine_kexec_prepare(struct kimage *image) for (i = 0; i < image->nr_segments; i++) { current_segment = &image->segment[i]; + err = memblock_is_region_memory(current_segment->mem, + current_segment->memsz); + if (err) + return - EINVAL; + + err = get_user(header, (__be32*)current_segment->buf); if (err) return err;