Skip to content

MMU disabling code and kexec fixes

Will Deacon linux-arm-kernel 9 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest posting 6/60 of 8 patches 0 repliesNew
  2. v4 posting 5/60 of 8 patches 0 repliesSuperseded
  3. v4 posting 4/60 of 8 patches 0 repliesSuperseded
Earlier versions · 6
VersionPostedPatchesRepliesStatus
v4 posting 3/60 of 8 patches0 repliesSuperseded
v4 posting 2/60 of 8 patches0 repliesSuperseded
v4 posting 1/68 patches0 repliesSuperseded
v39 patches0 repliesSuperseded
v210 patches0 repliesSuperseded
v16 patches0 repliesSuperseded

Patches in v4 posting 6/6 No applies recorded yet

None of the 8 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/8] MMU disabling code and kexec fixes

Hi Nicolas,

Quoted 9 lines · Will Deacon
Quoted 4 lines · Nicolas Pitre

Hmmm... The kexec user space tools know how to manipulate a device tree for the next kernel, right? So it's only a matter for it to ask the current kernel what the physical address for that page is and stuff it into the FDT it is preparing already.

oo-er, it seems a bit odd telling userspace about that address but it does fix the problem. I can't think of a better idea, so I'll start looking for a sane interface for passing this address back.

I had a look at the kexec-tools source for PPC (unfortunately all the fdt stuff is under there, so adding this for ARM is going to be a pain) and here's what they do:

If a .dtb file is passed to kexec, that is passed to the new kernel. It is fixed up by the kexec tool so that things like the command-line can be modified. There is a device tree property called "cpu-release-addr" which specifies the pen address for each CPU and this property is actually read from the device tree and added to the list of reserved regions so that the next kernel doesn't clobber it.

If a .dtb file is not passed, kexec looks at /proc/device-tree/ and constructs a new blob from that.

Note that PPC doesn't make an attempt to allocate the pen dynamically. If we want to do that, I guess we could emit a dummy "cpu-release-addr" property via /proc/, but this has a couple of downsides:

1.) People might try and use this property (and it would allow bootloaders
to specify pens to non-kexec'd kernels, which would likely end in disaster)

2.) We would have to allocate the pen during boot and leave it allocated
for any CONFIG_KEXEC kernels.

Thinking about the concerns you had about bootloaders using the pen if it's at a known physical location, I realised that we don't actually need to populate the pen until a kexec is in progress. Although the pen page will always be reserved, we can just copy the pen code into it on the kexec_prepare path and that way prevent it being abused by anybody else.

So, do you still reckon we should push forward with the dynamic allocation and ATAG/FDT interface or lazily populate at a known address instead?

Thanks,

Will