[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 <stefanb@linux.ibm.com> writes:
> From: Daniel Axtens <dja@axtens.net>
>
> 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 <stefanb@linux.ibm.com>
> Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
Be well,
--Robbie
signature.asc
Description: PGP signature
- [PATCH v4 0/6] Dynamic allocation of memory regions and IBM vTPM 2.0, Stefan Berger, 2023/02/06
- [PATCH v4 1/6] ieee1275: request memory with ibm, client-architecture-support, Stefan Berger, 2023/02/06
- [PATCH v4 5/6] Add memtool module with memory allocation stress-test, Stefan Berger, 2023/02/06
- [PATCH v4 3/6] ieee1275: support runtime memory claiming, Stefan Berger, 2023/02/06
- [PATCH v4 4/6] ieee1275: implement vec5 for cas negotiation, Stefan Berger, 2023/02/06
- [PATCH v4 6/6] ibmvtpm: Add support for trusted boot using a vTPM 2.0, Stefan Berger, 2023/02/06
- [PATCH v4 2/6] ieee1275: drop len -= 1 quirk in heap_init, Stefan Berger, 2023/02/06
- Re: [PATCH v4 0/6] Dynamic allocation of memory regions and IBM vTPM 2.0, Nageswara R Sastry, 2023/02/13
- Re: [PATCH v4 0/6] Dynamic allocation of memory regions and IBM vTPM 2.0, Robbie Harwood, 2023/02/28