[edk2-devel] [PATCH V2 14/14] MdeModulePkg: Pool and page functions accept memory when OOM occurs

Lendacky, Thomas via groups.io thomas.lendacky=amd.com at groups.io
Tue Aug 30 14:24:13 UTC 2022


On 8/29/22 22:20, Xu, Min M wrote:
> On August 30, 2022 4:47 AM, Lendacky, Thomas wrote:
>> On 8/27/22 01:21, Min Xu wrote:
>>> From: Jiaqi Gao <jiaqi.gao at intel.com>
>>>
>>> RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3937
>>>
>>> When CoreAllocatePages() / CoreAllocatePool() meets error of
>>> EFI_OUT_OF_RESOURCES, locate the EdkiiMemoryAcceptProtocol and
>> accept
>>> extra memory dynamically.
>>>
>>> Firstly, find the unaccpeted memory region with enough size in GCD
>>
>> s/unaccpeted/unaccepted/
> Thanks for reminder. It will be fixed in the next version.
>>
>>> entries. Then locate the EdkiiMemoryAcceptProtocol and accept the memory.
>>> Finally, update the GCD memory and gMemoryMap entries.
>>>
>>> After updating the memory infomation, CoreInternalAllocatePages() /
>>> CoreInternalAllocatePool() will be recalled to allocate pages / pool.
>>
>> What path does allocation take when called through boot services? If I set a
>> 256MB accepted memory size, I can get to the bootloader and select my kernel.
>> But then the kernel dies in efi_relocate_kernel() with:
>>
>> EFI stub: ERROR: Failed to allocate usable memory for kernel.
>> EFI stub: ERROR: efi_relocate_kernel() failed!
>> EFI stub: ERROR: efi_main() failed!
>>
>> because both efi_bs_call(allocate_pages, ...) and efi_low_alloc_above() fail.
>>
>> Similar to DXE, should OVMF accept more memory through this path to let the
>> kernel boot?
>>
> Tom is using the grub boot, right? In this case, 256MB accepted memory size is too small.
> Because in grub boot, AllocatePages is called to allocate memory in grub boot. The allocation type is AllocateMaxAddress and the memory address is 100000. It means the memory should be allocated below 0x100000.
> If only 256MB is accepted, then probably this memory region (which is under 0x100000) has been used. And there is no unaccepted memory region which is available for this memory region (which is under 0x100000).
> I tried 256MB and it works for direct boot, but not for grub boot.
> I tried 384MB and it works for both grub boot and direct boot.
> So my suggestion is that the minimal accept memory size is 384MB or more.

Right, I've been able to boot with 512MB without issues. The address is 
0x1000000 (16MB) and so that makes sense, nothing that can be done for 
that situation.

Thanks,
Tom

> 
> Thanks
> Min


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92980): https://edk2.groups.io/g/devel/message/92980
Mute This Topic: https://groups.io/mt/93285612/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