Re: [PATCH] Fix e820 end address with EFI

From: Yinghai Lu
Date: Tue Mar 03 2009 - 00:38:26 EST


Huang Ying wrote:
> On Tue, 2009-03-03 at 11:57 +0800, Yinghai Lu wrote:
>> Huang Ying wrote:
>>> On Tue, 2009-03-03 at 10:53 +0800, Yinghai Lu wrote:
>>>> Huang Ying wrote:
>>>>> On Tue, 2009-03-03 at 09:28 +0800, Yinghai Lu wrote:
>>>>>> Huang Ying wrote:
>>>>>>> On Tue, 2009-03-03 at 05:38 +0800, Yinghai Lu wrote:
>>>>>>>> Huang Ying wrote:
>>>>>>>>> On Mon, 2009-03-02 at 10:51 +0800, Yinghai Lu wrote:
>>>>>>>>>> On Sun, Mar 1, 2009 at 6:37 PM, Huang Ying <ying.huang@xxxxxxxxx> wrote:
>>>>>>>>>>>> so 64bit could use ioremap_cache() too?
>>>>>>>>>>>> we may keep 32bit and 64bit a bit consistent.
>>>>>>>>>>> If we use ioremap_cache(), kexec runtime service will not work in kexec
>>>>>>>>>>> situation, which needs EFI runtime memory area to be mapped at exact
>>>>>>>>>>> same location across kexec. I think we should support kexec if possible.
>>>>>>>>>> sure.
>>>>>>>>>>
>>>>>>>>>> please don't touch max_low_pfn_mapped, because some range may not
>>>>>>>>>> directly mapped under those efi run-time code
>>>>>>>>> Find an issue to use init_memory_mapping() here.
>>>>>>>>>
>>>>>>>>> If the memory range to be mapped is less than 2M, the last mapped
>>>>>>>>> address may be next 2M aligned position, this may lead mapping
>>>>>>>>> overlapping between memory range. Such as:
>>>>>>>>>
>>>>>>>>> 0x3f388000 - 0x3f488000: real mapped 0x3f388000 - 0x3f600000
>>>>>>>>> 0x3f590000 - 0x3f5bb000: real mapped 0x3f590000 - 0x3f600000
>>>>>>>>>
>>>>>>>>> The problem is that the memory range 0x3f400000 - 0x3f590000 is left not
>>>>>>>>> mapped!
>>>>>>>> what is max_low_pfn_mapped before that?
>>>>>>> I don't know exactly what you mean. Can you elaborate a little?
>>>>>>>
>>>>>>> 0 ~ max_low_pfn_mapped ~ max_pfn_mapped can be mapped with
>>>>>>> init_memory_mapping() properly.
>>>>>>>
>>>>>>> The issue of above example is that 0x3f400000 ~ 0x3f488000 is a
>>>>>>> sub-range of 0x3f388000 ~ 0x3f488000, which should be mapped but is left
>>>>>>> not mapped.
>>>>>> what is max_low_pfn_mapped?
>>>>>>
>>>>>> what is init_memory_mapping() printout?
>>>>> This does not comes from a real test case. To test the changes I made, I
>>>>> make efi_ioremap() being used even if the corresponding memory range is
>>>>> below max_low_pfn_mapped. The dmesg of test is attached with the mail.
>>>>>
>>>>> The printout of init_memory_mapping shows:
>>>>>
>>>>> init_memory_mapping: 000000003f488000-000000003f4bb000
>>>>> last_map_addr: 3f600000 end: 3f4bb000
>>>>> init_memory_mapping: 000000003f590000-000000003f5bb000
>>>>> last_map_addr: 3f600000 end: 3f5bb000
>>>> init_memory_mapping: 0000000000000000-000000003f700000
>>>>
>>>> last_map_addr: 3f700000 end: 3f700000
>>>>
>>>> (6 early reservations) ==> bootmem [0000000000 - 003f700000]
>>>>
>>>> so max_low_pfn_mapped is (3f700000>>12)
>>>> and you try to init_memory_mapping again before it
>>> Yes. Just for testing, I want to use efi_ioremap() on more memory range
>>> to test.
>>>
>>>>> init_memory_mapping: 00000000fffb0000-00000000fffba000
>>>>> last_map_addr: 100000000 end: fffba000
>>>> this one is interesting... got over mapped...
>>>>> So I think it is possible to have the issue I mentioned above.
>>>> looks like.
>>> So, If you have no time, I can try to fix that. Do you think
>>> init_memory_mapping should stop at specified end page?
>> you may boot with debug, so could figure out how init_memory_mapping want to map the range.
>>
>> it should stop at specified end page at least with 64bit.
>
> The dmesg with ignore_loglevel in kernel parameters is attached with the
> mail.
>
> init_memory_mapping: 0000000000000000-000000003f700000
> 0000000000 - 003f600000 page 2M
> 003f600000 - 003f700000 page 4k
> kernel direct mapping tables up to 3f700000 @ 8000-b000
> last_map_addr: 3f700000 end: 3f700000
>
> init_memory_mapping: 00000000fffb0000-00000000fffba000
> 00fffb0000 - 0100000000 page 4k
> last_map_addr: 100000000 end: fffba000
that is funny, the range calculating has some problem...when the range size < 2M...

YH

--
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/