On 01.06.22 16:35, Kirill A. Shutemov wrote: > On Wed, Jun 01, 2022 at 11:00:23AM +0200, David Hildenbrand wrote: >> On 17.05.22 17:34, Kirill A. Shutemov wrote: >>> Currently allocate_e820() only interested in the size of map and size of >>> memory descriptor to determine how many e820 entries the kernel needs. >>> >>> UEFI Specification version 2.9 introduces a new memory type -- >>> unaccepted memory. To track unaccepted memory kernel needs to allocate >>> a bitmap. The size of the bitmap is dependent on the maximum physical >>> address present in the system. A full memory map is required to find >>> the maximum address. >>> >>> Modify allocate_e820() to get a full memory map. >> >> Usually we use max_pfn, if we want to know the maximum pfn that's >> present in the system (well, IIRC, excluding hotunplug). >> >> How exactly will this (different?) maximum from UEFI for the bitmap >> interact with >> >> max_pfn = e820__end_of_ram_pfn(); >> >> from e820 in existing code >> >> ? > > I'm not sure I understand the question. Essentially, if the PFN you calculate here for the bitmap size will essentially match later max_pfn. > > On EFI system, E820 is constructed based on EFI memory map and size of > bitmap calculated based of EFI memmap will always be enough to address all > memory. e820__end_of_ram_pfn() can be smaller than what what we calculate > as size of memory here, if kernel reserve very top of the memory, but it > will never be larger. > > Later during the boot we use e820__end_of_ram_pfn() to infer size of > bitmap and it is safe. > -- Thanks, David / dhildenb