Re: [PATCH] x86: only load initrd above 4g on second try

From: Mantas MikulÄnas
Date: Tue Aug 26 2014 - 18:17:03 EST


On Wed, Aug 27, 2014 at 1:05 AM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote:
> On Tue, Aug 26, 2014 at 2:53 PM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>> On 08/26/2014 02:45 PM, Yinghai Lu wrote:
>>> Mantas found that after commit 4bf7111f5016 ("x86/efi: Support initrd
>>> loaded above 4G"), the kernel freezes at the earliest possible moment
>>> when trying to boot via UEFI on Asus laptop.
>>>
>>> There are buggy EFI implementations: with EFI run time, kernel need
>>> to load file with 512bytes alignment when buffer is above 4G.
>>>
>>
>> This makes absolutely zero sense. Please explain what the actual
>> problem is here.
>
> The firmware has bug and can use buffer above 4G to read files.
> and if the file size is 512 bytes alignment, then reading could go through.
>
> From Mantas:
> --
> On Wed, Aug 20, 2014 at 12:05 PM, Mantas MikulÄnas <grawity@xxxxxxxxx> wrote:
>>
>> I experimented with some things (like setting chunk size to a few kB
>> to see if it hangs earlier or only at the very end; etc.), and finally
>> found out that it stops freezing if I pad the initrd file to a
>> multiple of 512 bytes :/ That is, 5684268 bytes will freeze, 5684736
>> bytes will not.
>>
>> ...In other words, seems like it cannot read chunks that aren't
>> multiples of 512 into a location above 4 GB. Or something like that..

Note that I'm mostly clueless about how EFI works (my "debugging" is
mostly just 'efi_printk()'s to see where it hangs), so take my
description with a grain of salt...

In particular, I just realized yesterday that I don't know whether
it's referring to physical or virtual addresses in the initrd load
code -- and the laptop only has 4 GB of memory, so the kernel
shouldn't be using larger physical addresses in the first place.
(Virtual ones, on the other hand, /would/ mean a weird bug like
described above.)

--
Mantas MikulÄnas <grawity@xxxxxxxxx>
--
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/