From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pSfF1-00049a-Nt for mharc-grub-devel@gnu.org; Thu, 16 Feb 2023 09:28:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSfF0-00046s-DV for grub-devel@gnu.org; Thu, 16 Feb 2023 09:28:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSfEy-0000sM-OS for grub-devel@gnu.org; Thu, 16 Feb 2023 09:28:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676557683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ycmFNuUB2CWF1Q4rQR66J15Rdam7lQmEkew596H6Rlo=; b=N7fpT1LH1U1S8IhtsXuUkPdWBzVrGSx/SFRT5dTs7J/LR3SNqDbso6fYJI4QNDT/0kkGu9 Z6l9dH2CBCEbDJIc4QxvcLDjaftGhiXWqYO+pS8KuuQ0hMh8h1RQOPjb93CzK+gW6x6cT4 E5pAwvpm8NO6DCSZUcV+Dw+h7ztK50o= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-377-frxxwUKRPyCUistg4Ll-0w-1; Thu, 16 Feb 2023 09:28:01 -0500 X-MC-Unique: frxxwUKRPyCUistg4Ll-0w-1 Received: by mail-qt1-f198.google.com with SMTP id v3-20020a05622a188300b003ba183e8272so1319730qtc.0 for ; Thu, 16 Feb 2023 06:28:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ycmFNuUB2CWF1Q4rQR66J15Rdam7lQmEkew596H6Rlo=; b=HAHbgwCuPAdSWAT5s8MAKz3a6UdULQ8/4rpcLb6iXmEWtc5jt7fRg+Z5j4ch1ju03B /xD1ZLiCF9wJCNOfjhkhynJ51IoJKaCxUI0vHLUxetagRT/gOQOHNi2o7bJ5ehf7E5SN A9MRZD3WjGC86UjCOX02rbcEMqKUn97nSj0iEp8gtrRJ2TrDt00l0PFfQtZuXyrAQywo SjWRTL6mXFCaRrrMC+rCocJudJDxVDBSSiJIK30Dg4CthtxqHGccF49MKtiNyi4nM4zj LEZ+h2cV5D61rJgCn7xfOixlWyynHStj151RMswYYORUgD/Q5sKmt18dmz7sKbqGySzr wIlA== X-Gm-Message-State: AO0yUKUntADzs5UqzogqLs+5XXuFqEdS5ySBwos59hPrUEBVwuFxzjPc r+XaWwFxpFk2eyyrJ1UOV+5CDH/VJGrGEUHQg42xXTyGtTMm4f5v48+4+xDeBBft5iu6C52lYvd yVPm1YLlScsY= X-Received: by 2002:ac8:5a8e:0:b0:3b6:2f31:efc4 with SMTP id c14-20020ac85a8e000000b003b62f31efc4mr8228759qtc.66.1676557681002; Thu, 16 Feb 2023 06:28:01 -0800 (PST) X-Google-Smtp-Source: AK7set9X8x0eWxw8ZF0fCifHwljIpPSm1JZy4197wDIG8UV5GzNS2LQqYfY4e+FxMN+WXw3FWKPm3A== X-Received: by 2002:ac8:5a8e:0:b0:3b6:2f31:efc4 with SMTP id c14-20020ac85a8e000000b003b62f31efc4mr8228714qtc.66.1676557680522; Thu, 16 Feb 2023 06:28:00 -0800 (PST) Received: from localhost ([2600:4040:520a:8800:7d1c:f0a7:5c44:ed0e]) by smtp.gmail.com with ESMTPSA id b1-20020a378001000000b0073b597ce5f8sm1239088qkd.120.2023.02.16.06.27.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 06:27:59 -0800 (PST) From: Robbie Harwood To: Stefan Berger , grub-devel@gnu.org, dkiper@net-space.pl Cc: development@efficientek.com, dja@axtens.net, sudhakar@linux.ibm.com, nasastry@in.ibm.com, avnish@imap.linux.ibm.com, Stefan Berger Subject: Re: [PATCH v4 3/6] ieee1275: support runtime memory claiming In-Reply-To: <20230206150325.3756840-4-stefanb@linux.ibm.com> References: <20230206150325.3756840-1-stefanb@linux.ibm.com> <20230206150325.3756840-4-stefanb@linux.ibm.com> Date: Thu, 16 Feb 2023 09:27:59 -0500 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=170.10.129.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2023 14:28:06 -0000 --=-=-= Content-Type: text/plain 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, --Robbie --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEA5qc6hnelQjDaHWqJTL5F2qVpEIFAmPuPW8UHHJoYXJ3b29k QHJlZGhhdC5jb20ACgkQJTL5F2qVpELWzw/+KNczHgl0Q6ckRncfG6NSn+VPYm51 VOg2iH+RnIUNUXk8DkxfrWa06qNF0uo+l9C9G8qaqzPZhSTdanoaTvZwAbA7+z1D MaAxLoFhHMrd/jsNEVleAWCUFcyiktCztGUaBqamC8tJggcU7jPzr2MeSgPWsc3x Ap0oXTV6R4do7jM5H8oN1e9UyEfMu/dj3+HnQ4smu1yXLPpUCb81+rnjhRtoiMnn QsZnSkEHjCVVbOf0uu8j4iBqGNtOXpqaUvew6/+8Pycub3WhE+9HYi4qHmohL39R vGAWFAiYZDo4vwrp3575Q+ccNuSGW2DwX4pIOxRrBO3OuxomI8ncE0/P5HoYVH5t 0J/TkhdU1FfFLTc1MuZqEysPkinPRaBNsyzFYT8wpbqCW+K2D8qptqh/cjx1arFQ W8qjbqjr1XecIr/0uUnjF0fSX7/JxPdq4iJVYNBbZ6b/fatDKI83DCMetIrH3HxD CnVLkdRu2AIhrzXyZEQWK/Cqi7jp9NKmv2HXQ6Uts2eYl1bpKlEaXOkdnCnYfN5e atO/3+C0W0DgCdio1YlmJubmj19xmWVs/inJBgcBmuav8dxw5erT4t6yWWe4hVFy 0k6wY/LcghNcl02YpWFwyLyIWJxvWygum2qN6auPWXGVdkZ7dKxUG3VVuRatfZE6 Mnqh+i3X8dnqi3w= =Vlew -----END PGP SIGNATURE----- --=-=-=--