public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: Alexander Graf <graf@amazon.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>,
	"Woodhouse, David" <dwmw@amazon.co.uk>,
	Hendrik Borghorst <hborghor@amazon.de>
Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/Core/Dxe: Allow to force runtime allocations at separate range
Date: Fri, 19 Feb 2021 17:47:40 +0100	[thread overview]
Message-ID: <51844c5a-aedf-9a0a-10e5-7a06b2073a8c@redhat.com> (raw)
In-Reply-To: <5efeedb0-d0de-8428-3a88-190ccf02707e@amazon.com>

Hello Alex,

On 02/19/21 15:10, Alexander Graf wrote:
> Hi Mike,
> 
> Thanks a lot for the pointer! In my case, the defaults for the
> preallocated memory regions was just not big enough to prevent
> hibernation breakage. I increased them now as intended and everything
> works like a charm.

The most recent related OVMF commits are, for reference (merged on 2020-May-08):

     1  2c06e76bba06 OvmfPkg/PlatformPei: don't track BS Code/Data in default MemTypeInfo HOB
     2  356b96b3a2dc OvmfPkg/PlatformPei: rewrite MemTypeInfo HOB production logic
     3  8db87f98357b OvmfPkg/PlatformPei: extract memory type info defaults to PCDs
     4  7b6327ff03bb OvmfPkg/PlatformPei: increase memory type info defaults

The commit messages hopefully explain how OVMF utilizes the pattern described by Mike, and what PCDs to tweak if you need larger bins.

If you think your PCD updates are upstreamable, please feel free to submit those as a patch!

Thanks!
Laszlo

> 
> Please ignore this patch set, the existing mechanism is definitely
> superior :)
> 
> 
> Thanks!
> 
> Alex
> 
> 
> On 18.02.21 23:28, Kinney, Michael D wrote:
>>
>> Hi Alex,
>>
>> This feature is already available from the DXE Core using the
>> MemoryTypeInformation and was
>> specifically added to support hibernation use case.
>>
>> There is an optional HOB that is passed into DXE Core that can provide
>> bin sizes for any supported memory types.  Not just Runtime and ACPI.
>>
>> This feature can use a fixed HOB or use a dynamic HOB from a UEFI
>> Variable, so that changes in the memory usage of
>> the critical memory types for hibernation can be tracked and stored in
>> the UEFI Variables and be used to populate
>> the HOB.  It is a platform choice to use fixed or dynamic HOB.
>>
>> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Include/Guid/MemoryTypeInformation.h
>>
>>
>> https://github.com/tianocore/edk2/blob/978b9d511f5b9cb7bc5b09749f86c39bec51525d/MdeModulePkg/Core/Dxe/Gcd/Gcd.c#L2233
>>
>>
>> https://github.com/tianocore/edk2/blob/978b9d511f5b9cb7bc5b09749f86c39bec51525d/MdeModulePkg/Core/Dxe/Mem/Page.c#L45
>>
>>
>> The DXE Core use the HOB to pre-allocate bins for the memory types and
>> do allocations from those bins.
>>
>> The UEFI Memory Map provides an entry for the entire bin (no just the
>> allocated space), so small
>> differences in allocations from boot to boot do not change the UEFI
>> memory map.  This also
>> reduces the total number of memory map entries in the UEFI memory map.
>>
>> If dynamic HOB is used, then the Boot Manager compares the actual
>> memory usage to the HOB.
>> If the usage is larger or smaller by more than a threshold, then the
>> UEFI Variable is
>> updated.  The platform has the choice to reboot or continue booting
>> after this UEIF Variable
>> update based on a PCD.  The reboot can help make sure the first boot
>> to the OS has the right
>> bin sizes to support future hibernate boot flows.



  reply	other threads:[~2021-02-19 16:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 20:09 [PATCH 0/2] Improve hibernation safety Alexander Graf
2021-02-18 20:09 ` [PATCH 1/2] MdeModulePkg/Core/Dxe: Allow to force runtime allocations at separate range Alexander Graf
2021-02-18 22:28   ` [edk2-devel] " Michael D Kinney
2021-02-19 14:10     ` Alexander Graf
2021-02-19 16:47       ` Laszlo Ersek [this message]
2021-02-19 17:31         ` Alexander Graf
2021-02-18 20:09 ` [PATCH 2/2] OvmfPkg: Make hibernation critical allocations at own ranges Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51844c5a-aedf-9a0a-10e5-7a06b2073a8c@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox