ia64/xen-unstable

changeset 19555:150662e5adfc

x86: avoid EPT scanning errors when splitting superpages during live migration

Since Xen did not lock the p2m table for p2m table reading, when
splitting the large page during live migration, we should make sure
the path of EPT entries be modified are always there while other CPUs
may access the super entries at the same time.

Signed-off-by: Xin, Xiaohui <xiaohui.xin@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Apr 17 13:07:06 2009 +0100 (2009-04-17)
parents b920a2f799d9
children b44db970f6b7
files xen/arch/x86/mm/hap/p2m-ept.c
line diff
     1.1 --- a/xen/arch/x86/mm/hap/p2m-ept.c	Fri Apr 17 13:04:47 2009 +0100
     1.2 +++ b/xen/arch/x86/mm/hap/p2m-ept.c	Fri Apr 17 13:07:06 2009 +0100
     1.3 @@ -210,17 +210,18 @@ ept_set_entry(struct domain *d, unsigned
     1.4          ept_entry_t *split_ept_entry = NULL;
     1.5          unsigned long split_mfn = ept_entry->mfn;
     1.6          p2m_type_t split_p2mt = ept_entry->avail1;
     1.7 +        ept_entry_t new_ept_entry;
     1.8  
     1.9          /* alloc new page for new ept middle level entry which is
    1.10           * before a leaf super entry
    1.11           */
    1.12  
    1.13 -        if ( !ept_set_middle_entry(d, ept_entry) )
    1.14 +        if ( !ept_set_middle_entry(d, &new_ept_entry) )
    1.15              goto out;
    1.16  
    1.17          /* split the super page before to 4k pages */
    1.18  
    1.19 -        split_table = map_domain_page(ept_entry->mfn);
    1.20 +        split_table = map_domain_page(new_ept_entry.mfn);
    1.21          offset = gfn & ((1 << EPT_TABLE_ORDER) - 1);
    1.22  
    1.23          for ( i = 0; i < 512; i++ )
    1.24 @@ -257,6 +258,7 @@ ept_set_entry(struct domain *d, unsigned
    1.25          ept_p2m_type_to_flags(split_ept_entry, p2mt);
    1.26  
    1.27          unmap_domain_page(split_table);
    1.28 +        *ept_entry = new_ept_entry;
    1.29      }
    1.30  
    1.31      /* Track the highest gfn for which we have ever had a valid mapping */