Re: [PATCH 3/3] efi: Make efi virtual runtime map passing more robust

From: Dave Young
Date: Wed Dec 18 2013 - 04:08:35 EST


On 12/17/13 at 12:36am, Borislav Petkov wrote:
> From: Borislav Petkov <bp@xxxxxxx>
>
> Currently, running SetVirtualAddressMap() and passing the physical
> address of the virtual map array was working only by a lucky coincidence
> because the memory was present in the EFI page table too. Until Toshi
> went and booted this on a big HP box - the krealloc() manner of resizing
> the memmap we're doing did allocate from such physical addresses which
> were not mapped anymore and boom:
>
> http://lkml.kernel.org/r/1386806463.1791.295.camel@xxxxxxxxxxxxxxxx
>
> One way to take care of that issue is to reimplement the krealloc thing
> but with pages. We start with contiguous pages of order 1, i.e. 2 pages,
> and when we deplete that memory (shouldn't happen all that often but you
> know firmware) we realloc the next power-of-two pages.

How about firstly count the md numbers in the 1st loop, then get/roundup
the total size, alloc the pages, map the mds one by one in another loop.

Thanks
Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/