On 02/08/2022 11:46, Andrew Jones wrote:
On Tue, Aug 02, 2022 at 11:19:00AM +0100, Alexandru Elisei wrote:
Hi,
Doubling the number of memory regions worked, thanks. Like you've said,
that's just a band-aid, as there could be platforms out there for which
UEFI reports more regions than the static value that kvm-unit-tests
assumes.
If you don't mind a suggestion, you could run two passes on the UEFI memory
map: the first pass finds the largest available memory region and uses that
for initializing the memory allocators (could also count the number of
memory regions that it finds, for example), the second pass creates the
mem_regions array by allocating it dynamically (the allocators have been
initialized in the previous pass). The same approach could be used when
booting without UEFI.
Or you can just set NR_EXTRA_MEM_REGIONS to something very large and call
it a day :)
Yeah, let's just bump it to something large. We should also ensure it's
easy to debug when we hit the limit though. We have an assert() in
mem_region_add() already, but maybe we don't have an assert() in the
EFI code paths?
Thanks,
drew
Thank you both. I'll make these two changes in the next revision of the
series. By the way, I'm tracking changes on top of v3 here:
https://github.com/relokin/kvm-unit-tests/tree/target-efi-upstream-v3-fixups
Thanks,
Nikos