[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 3/6] ieee1275: support runtime memory claiming

From: Robbie Harwood
Subject: Re: [PATCH v4 3/6] ieee1275: support runtime memory claiming
Date: Thu, 16 Feb 2023 09:27:59 -0500

Stefan Berger <> writes:

> From: Daniel Axtens <>
> On powerpc-ieee1275, we are running out of memory trying to verify
> anything. This is because:
>  - we have to load an entire file into memory to verify it. This is
>    difficult to change with appended signatures.
>  - We only have 32MB of heap.
>  - Distro kernels are now often around 30MB.
> So we want to be able to claim more memory from OpenFirmware for our heap
> at runtime.
> There are some complications:
>  - The grub mm code isn't the only thing that will make claims on
>    memory from OpenFirmware:
>     * PFW/SLOF will have claimed some for their own use.
>     * The ieee1275 loader will try to find other bits of memory that we
>       haven't claimed to place the kernel and initrd when we go to boot.
>     * Once we load Linux, it will also try to claim memory. It claims
>       memory without any reference to /memory/available, it just starts
>       at min(top of RMO, 768MB) and works down. So we need to avoid this
>       area. See arch/powerpc/kernel/prom_init.c as of v5.11.
>  - The smallest amount of memory a ppc64 KVM guest can have is 256MB.
>    It doesn't work with distro kernels but can work with custom kernels.
>    We should maintain support for that. (ppc32 can boot with even less,
>    and we shouldn't break that either.)
>  - Even if a VM has more memory, the memory OpenFirmware makes available
>    as Real Memory Area can be restricted. Even with our CAS work, an LPAR
>    on a PowerVM box is likely to have only 512MB available to OpenFirmware
>    even if it has many gigabytes of memory allocated.
> What should we do?
> We don't know in advance how big the kernel and initrd are going to be,
> which makes figuring out how much memory we can take a bit tricky.
> To figure out how much memory we should leave unused, I looked at:
>  - an Ubuntu 20.04.1 ppc64le pseries KVM guest:
>     vmlinux: ~30MB
>     initrd:  ~50MB
>  - a RHEL8.2 ppc64le pseries KVM guest:
>     vmlinux: ~30MB
>     initrd:  ~30MB
> So to give us a little wriggle room, I think we want to leave at least
> 128MB for the loader to put vmlinux and initrd in memory and leave Linux
> with space to satisfy its early allocations.
> Allow other space to be allocated at runtime.
> Tested-by: Stefan Berger <>
> Signed-off-by: Daniel Axtens <>

Reviewed-by: Robbie Harwood <>

Be well,

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]