[PATCH v2] ARM: kexec: selective MMU identity mapping

Nicolas Pitre nico at fluxnic.net
Wed Feb 2 17:27:40 EST 2011


On Wed, 2 Feb 2011, Russell King - ARM Linux wrote:

> On Wed, Feb 02, 2011 at 05:10:37PM -0500, Nicolas Pitre wrote:
> > On Wed, 2 Feb 2011, Russell King - ARM Linux wrote:
> > 
> > > On Wed, Feb 02, 2011 at 03:43:29PM +0100, Per Fransson wrote:
> > > > When restarting using the kernel kexec functionality the MMU
> > > > needs to be turned off. Any code which does this needs to use
> > > > identity mapped addresses to get reliable results. In the ARM
> > > > kexec case this identity mapping is done:
> > > > 
> > > > - using the page table of the current task
> > > > 
> > > > - for all addresses normally used by user space,
> > > >   i.e. 0x00000000-PAGE_OFFSET
> > > > 
> > > > If kexec is used at a kernel crash to collect a core dump this
> > > > means that we lose important information.
> > > > 
> > > > This is what this patches does:
> > > > 
> > > > * Actually turns off the MMU, which has been omitted by mistake
> > > > 
> > > > * Sets up a more selective identity mapping
> > > > 
> > > > * Restores the old mapping once the MMU is off
> > > > 
> > > > Signed-off-by: Per Fransson <per.xx.fransson at stericsson.com>
> > > > ---
> > > > v2 changes:
> > > > 
> > > > * now uses (modified versions of) the identity mapping functions in idmap.c
> > > >   as they look in 2.6.38-rc1. Some pud-level code has been added there in
> > > >   linux-next.
> > > 
> > > Thanks.  As this been tested with ARMv4/v5 CPUs as well?
> > 
> > I have doubts about the effectiveness of setup_mm_for_reboot() on any 
> > machine where physical RAM starts at 0xc0000000 or above, such as on 
> > SA1100.
> 
> It's known to work on Assabet.  It works on SA1100 because the kernel
> mapping is already a 1:1 mapping.
D'oh.

> What setup_mm_for_reboot() is doing on Assabet though is making the
> flash available for cpu_reset(0) to be able to call, not making the
> kernel code for cpu_reset() available for calling.

Right.  So if RAM is located at 0xd0000000 instead then this won't work 
as intended.  And overwriting the entire user space is not the best 
thing to do for kexec anyway.


Nicolas



More information about the linux-arm-kernel mailing list