debuggers.hg

changeset 20665:7d7e221370ea

memory hotadd 6/7: Allocate L3 table for whole direct maping range if
memory hotplug is supported.

Hot-added memory may need a new L4 entry for 1:1 mapping. This patch
setup all L4 entry for 1:1 mapping if memory hotadd is needed, so that
we don't need sync the guest page table in page fault handler.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Dec 11 08:57:30 2009 +0000 (2009-12-11)
parents 611f49efe955
children a50c1cbf08ec
files xen/arch/x86/x86_64/mm.c
line diff
     1.1 --- a/xen/arch/x86/x86_64/mm.c	Fri Dec 11 08:56:50 2009 +0000
     1.2 +++ b/xen/arch/x86/x86_64/mm.c	Fri Dec 11 08:57:30 2009 +0000
     1.3 @@ -596,6 +596,32 @@ void __init paging_init(void)
     1.4      l2_pgentry_t *l2_ro_mpt = NULL;
     1.5      struct page_info *l1_pg, *l2_pg, *l3_pg;
     1.6  
     1.7 +    /*
     1.8 +     * We setup the L3s for 1:1 mapping if host support memory hotplug
     1.9 +     * to avoid sync the 1:1 mapping on page fault handler
    1.10 +     */
    1.11 +    if ( mem_hotplug )
    1.12 +    {
    1.13 +        unsigned long va;
    1.14 +
    1.15 +        for ( va = DIRECTMAP_VIRT_START;
    1.16 +              va < DIRECTMAP_VIRT_END;
    1.17 +              va += (1UL << L4_PAGETABLE_SHIFT) )
    1.18 +        {
    1.19 +            if ( !(l4e_get_flags(idle_pg_table[l4_table_offset(va)]) &
    1.20 +                  _PAGE_PRESENT) )
    1.21 +            {
    1.22 +                l3_pg = alloc_domheap_page(NULL, 0);
    1.23 +                if ( !l3_pg )
    1.24 +                    goto nomem;
    1.25 +                l3_ro_mpt = page_to_virt(l3_pg);
    1.26 +                clear_page(l3_ro_mpt);
    1.27 +                l4e_write(&idle_pg_table[l4_table_offset(va)],
    1.28 +                  l4e_from_page(l3_pg, __PAGE_HYPERVISOR));
    1.29 +            }
    1.30 +        }
    1.31 +    }
    1.32 +
    1.33      /* Create user-accessible L2 directory to map the MPT for guests. */
    1.34      if ( (l3_pg = alloc_domheap_page(NULL, 0)) == NULL )
    1.35          goto nomem;