[edk2-devel] [PATCH 1/2] MdeModulePkg/Core/Dxe: Allow to force runtime allocations at separate range

Laszlo Ersek lersek at redhat.com
Fri Feb 19 16:47:40 UTC 2021


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.




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#71845): https://edk2.groups.io/g/devel/message/71845
Mute This Topic: https://groups.io/mt/80739508/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list