ia64/xen-unstable

changeset 3812:fb3675bdcce5

bitkeeper revision 1.1159.260.1 (420e07e16YlSevQI9RYNGLwarPr2gQ)

Bug fix for shadow code.

When update_va_mapping() updates a entry, the corresponding shadow
entry may not be reachable via the shadow_linear_pg_table, even though
it is currently shadowed, as the corresponding spde has not necessarily
been faulted into place yet.
author mafetter@fleming.research
date Sat Feb 12 13:42:57 2005 +0000 (2005-02-12)
parents ce135fa88699
children 4b4a77f35103
files xen/arch/x86/memory.c xen/include/xen/perfc_defn.h
line diff
     1.1 --- a/xen/arch/x86/memory.c	Thu Feb 10 17:13:35 2005 +0000
     1.2 +++ b/xen/arch/x86/memory.c	Sat Feb 12 13:42:57 2005 +0000
     1.3 @@ -1573,10 +1573,26 @@ int do_update_va_mapping(unsigned long p
     1.4              &shadow_linear_pg_table[page_nr])))) )
     1.5          {
     1.6              /*
     1.7 -             * Since L2's are guranteed RW, failure indicates the page was not 
     1.8 -             * shadowed, so ignore.
     1.9 +             * Since L2's are guranteed RW, failure indicates either that the
    1.10 +             * page was not shadowed, or that the L2 entry has not yet been
    1.11 +             * updated to reflect the shadow.
    1.12               */
    1.13 -            perfc_incrc(shadow_update_va_fail);
    1.14 +            unsigned l2_idx = page_nr >> (L2_PAGETABLE_SHIFT - L1_PAGETABLE_SHIFT);
    1.15 +            l2_pgentry_t gpde = linear_l2_table[l2_idx];
    1.16 +            unsigned long gpfn = l2_pgentry_val(gpde) >> PAGE_SHIFT;
    1.17 +
    1.18 +            if (get_shadow_status(&d->mm, gpfn))
    1.19 +            {
    1.20 +                unsigned long *gl1e = map_domain_mem(gpfn << PAGE_SHIFT);
    1.21 +                unsigned l1_idx = page_nr & (ENTRIES_PER_L1_PAGETABLE - 1);
    1.22 +                gl1e[l1_idx] = sval;
    1.23 +                unmap_domain_mem(gl1e);
    1.24 +                put_shadow_status(&d->mm);
    1.25 +
    1.26 +                perfc_incrc(shadow_update_va_fail1);
    1.27 +            }
    1.28 +            else
    1.29 +                perfc_incrc(shadow_update_va_fail2);
    1.30          }
    1.31  
    1.32          /*
     2.1 --- a/xen/include/xen/perfc_defn.h	Thu Feb 10 17:13:35 2005 +0000
     2.2 +++ b/xen/include/xen/perfc_defn.h	Sat Feb 12 13:42:57 2005 +0000
     2.3 @@ -25,7 +25,8 @@ PERFCOUNTER_CPU( shadow_l2_table_count, 
     2.4  PERFCOUNTER_CPU( shadow_l1_table_count, "shadow_l1_table count" )
     2.5  PERFCOUNTER_CPU( unshadow_table_count, "unshadow_table count" )
     2.6  PERFCOUNTER_CPU( shadow_fixup_count, "shadow_fixup count" )
     2.7 -PERFCOUNTER_CPU( shadow_update_va_fail, "shadow_update_va_fail" )
     2.8 +PERFCOUNTER_CPU( shadow_update_va_fail1, "shadow_update_va_fail1" )
     2.9 +PERFCOUNTER_CPU( shadow_update_va_fail2, "shadow_update_va_fail2" )
    2.10  
    2.11  /* STATUS counters do not reset when 'P' is hit */
    2.12  PERFSTATUS( shadow_l2_pages, "current # shadow L2 pages" )