[PATCH] arm64: mm: set ZONE_DMA size based on early IORT scan

Catalin Marinas catalin.marinas at arm.com
Mon Oct 12 12:59:33 EDT 2020


On Mon, Oct 12, 2020 at 06:35:37PM +0200, Ard Biesheuvel wrote:
> On Mon, 12 Oct 2020 at 18:22, Catalin Marinas <catalin.marinas at arm.com> wrote:
> > On Mon, Oct 12, 2020 at 05:55:45PM +0200, Ard Biesheuvel wrote:
> > > On Mon, 12 Oct 2020 at 17:50, Catalin Marinas <catalin.marinas at arm.com> wrote:
> > > > > > On Mon, Oct 12, 2020 at 12:43:05PM +0200, Ard Biesheuvel wrote:
> > > > > > > Also, could someone give an executive summary of why it matters where
> > > > > > > the crashkernel is loaded? As far as I can tell, reserve_crashkernel()
> > > > > > > only allocates memory for the kernel's executable image itself, which
> > > > > > > can usually be loaded anywhere in memory. I could see how a
> > > > > > > crashkernel might need some DMA'able memory if it needs to use the
> > > > > > > hardware, but I don't think that is what is going on here.
> > [...]
> > > > However, the crashkernel=... range is meant for sufficiently large
> > > > reservation to be able to run the kdump kernel, not just load the image.
> > >
> > > Sure. But I was referring to the requirement that it is loaded low in
> > > memory. Unless I am misunderstanding something, all we need for the
> > > crashkernel to be able to operate is some ZONE_DMA memory in case it
> > > is needed by the hardware, and beyond that, it could happily live
> > > anywhere in memory.
> >
> > Yes, the crash kernel doesn't need to be loaded in the low memory. But
> > some low memory needs to end up in its perceived System RAM. That's what
> > Chen is trying to do with this series:
> >
> > https://lore.kernel.org/linux-arm-kernel/20200907134745.25732-1-chenzhou10@huawei.com/
> >
> > It reserves the normal crashkernel memory at some high address range
> > with a small block (currently proposed as 256MB similar to x86) in the
> > "low" range.
> >
> > This "low" range for arm64 currently means below 1GB but it's only RPi4
> > that needs it this low, all other platforms are fine with the full low
> > 32-bit range.
> >
> > If it's not doable in a nice way, we'll just leave with this permanent
> > 1GB ZONE_DMA and hope we won't get platforms requiring an even smaller
> > one. There's also the option of ignoring kdump on RPi4, make ZONE_DMA
> > depend on !CRASH_DUMP and the "low" reservations can use the full 32-bit
> > range since the kdump kernel won't need <30-bit addresses.
> 
> Are you aware of any reason why we cannot defer the call to
> reserve_crashkernel() to the start of bootmem_init()? That way, we
> have access to the unflattened DT as well as the IORT, and so we can
> tweak the zone limits based on the h/w description, but before
> allocating the crashkernel.

Not really, as long as memblock_reserve/alloc() still works.

-- 
Catalin



More information about the linux-arm-kernel mailing list