Re: "x86-64, mm: Put early page table high" causes crash on Xen

From: Yinghai Lu
Date: Tue Mar 08 2011 - 13:54:58 EST


On Tue, Mar 8, 2011 at 9:40 AM, Stefano Stabellini
<stefano.stabellini@xxxxxxxxxxxxx> wrote:
> On Tue, 8 Mar 2011, Yinghai Lu wrote:
>> On Tue, Mar 8, 2011 at 4:14 AM, Stefano Stabellini
>> <stefano.stabellini@xxxxxxxxxxxxx> wrote:
>> >> > [    0.000000] DEBUG alloc low page(cf965000, 00001000)
>> >>
>> >> these are not mapped yet, and need to use early_ioremap.
>> >
>> > In fact we are mapping them inside alloc_low_page. No need for
>> > map_low_page, right?
>>
>> alloc_low_page return virtual address, but it can not be used to
>> access that position right away.
>> so in that case map_low_page is used to convert that virtual address
>> to phy address and then to early map address.
>
> Are you sure?
> I am looking at this piece of code under kernel_physical_mapping_init:
>
>
> ---
>        pud = alloc_low_page(&pud_phys);
>                last_map_addr = phys_pud_init(pud, __pa(start), __pa(next),
>                                                 page_size_mask);
>                unmap_low_page(pud);
> ---
>
> and the implementaion of alloc_low_page is:
>
> ---
> static __ref void *alloc_low_page(unsigned long *phys)
> {
>        unsigned long pfn = pgt_buf_end++;
>        void *adr;
>
>        if (after_bootmem) {
>                adr = (void *)get_zeroed_page(GFP_ATOMIC | __GFP_NOTRACK);
>                *phys = __pa(adr);
>
>                return adr;
>        }
>
>        if (pfn >= pgt_buf_top)
>                panic("alloc_low_page: ran out of memory");
>
>        adr = early_memremap(pfn * PAGE_SIZE, PAGE_SIZE);
>        clear_page(adr);
>        *phys  = pfn * PAGE_SIZE;
>        return adr;
> }
> ---
>
> It looks to me that map_low_page is never called in this code path.
> If I read the code correctly map_low_page is only used to map pagetable
> pages that are already mapped (see the debug logging I posted in the
> previous email) so it is not useful.


[ 0.000000] kernel direct mapping tables up to 7f750000 @
[0x7f74c000-0x7f74ffff] pre-allocated
[ 0.000000] DEBUG map_low_page phys 243a000
[ 0.000000] DEBUG map_low_page phys 243e000
[ 0.000000] DEBUG alloc_low_page phys 7f74c000
[ 0.000000] DEBUG map_low_page phys 243a000
[ 0.000000] DEBUG map_low_page phys 7f74c000
[ 0.000000] DEBUG alloc_low_page phys 7f74d000
--
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/