I've a fairly modern laptop that I'm using for developing and testing
the UEFI port. It has a memory map that shows no available memory
within the VM_PAGE_SEG_DMA32 Hurd memory segment (all entries show
reserved). This causes the memory mapping within biosmem.c to conclude
that there is no memory at higher addresses and it fails to then
detect the large chunk of memory in VM_PAGE_SEG_HIGHMEM.

I tried various solutions to this but the simplest and (I think) the
cleanest is to only include entries in the vm_page_segs array that
actually have available memory. I did look at retaining the entry for
(in this case VM_PAGE_SEG_DMA32) but having no valid pages:pages_end
but that meant having to add code for testing the validity of the
entry before making memory allocations etc. Also that entry then shows
in 'show vmstat' but with zero for all the data fields.

I think it is cleaner to simply miss out the element from the
array. This solution adds no performance penalty from additional
pointer checks and having to permanently skip over an empty segment
when a system has this memory mapping.

The only complication to this is that the index into vm_page_segs no
longer matches the segment type and when a specific starting segment
is required for memory allocation one might need to search the
array. That array is only a maximum of 4 but I decided anyway to
simply code a translation for this purpose so that you can find the
element trivially (this is vm_page_segs_type_to_index).

I hope all this makes sense.

I've built this on hurd-amd64 and hurd-i386. I've tested the following 
combinations:

hurd-amd64-up
hurd-amd64-smp
hurd-i386-up
hurd-i386-pae

These all boot successfully and show the correct translation in
vm_page_segs_type_to_index. I also added a temporary local patch to
biosmem to alter the memory map so that it had entirely reserved
ranges for the VM_PAGE_SEG_DMA32 like my test machine. That case also
boots and shows the correct translation in
vm_page_segs_type_to_index. The kernel also boots on my test machine
although not fully (it reaches the end of acpi launch and the 'hang'
is down to missing/broken UEFI functionality).

Cheers,

Mike.

Reply via email to