ia64/xen-unstable

changeset 4171:e40b961673f2

bitkeeper revision 1.1236.32.8 (4237887fr1Mo71Tp0RoJHmt875tSBg)

Added extra shadow_sync_mfn() in do_update_va_mapping to deal
with a shortcoming of the checking code in _check_pagetable.
Better to have a few more flushes and checking code that can
still be used. It would be even better to have smarter checking
code, but that will take more time.

Signed-off-by: michael.fetterman@cl.cam.ac.uk
author mafetter@fleming.research
date Wed Mar 16 01:14:39 2005 +0000 (2005-03-16)
parents f04c449d7f82
children d617bb4a2907
files xen/arch/x86/mm.c xen/include/xen/perfc_defn.h
line diff
     1.1 --- a/xen/arch/x86/mm.c	Wed Mar 16 01:12:53 2005 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Wed Mar 16 01:14:39 2005 +0000
     1.3 @@ -2001,6 +2001,8 @@ int do_update_va_mapping(unsigned long v
     1.4      }
     1.5      else
     1.6      {
     1.7 +        unsigned long l1mfn;
     1.8 +
     1.9          if ( unlikely(percpu_info[cpu].foreign &&
    1.10                        (shadow_mode_translate(d) ||
    1.11                         shadow_mode_translate(percpu_info[cpu].foreign))) )
    1.12 @@ -2021,6 +2023,29 @@ int do_update_va_mapping(unsigned long v
    1.13          //
    1.14          __shadow_sync_va(ed, va);
    1.15  
    1.16 +#if 1 /* keep check_pagetables() happy */
    1.17 +        /*
    1.18 +         * However, the above doesn't guarantee that there's no snapshot of
    1.19 +         * the L1 table in question; it just says that the relevant L2 and L1
    1.20 +         * entries for VA are in-sync.  There might still be a snapshot.
    1.21 +         *
    1.22 +         * The checking code in _check_pagetables() assumes that no one will
    1.23 +         * mutate the shadow of a page that has a snapshot.  It's actually
    1.24 +         * OK to not sync this page, but it seems simpler to:
    1.25 +         * 1) keep all code paths the same, and
    1.26 +         * 2) maintain the invariant for _check_pagetables(), rather than try
    1.27 +         *    to teach it about this boundary case.
    1.28 +         * So we flush this L1 page, if it's out of sync.
    1.29 +         */
    1.30 +        l1mfn = (l2_pgentry_val(linear_l2_table(ed)[l2_table_offset(va)]) >>
    1.31 +                 PAGE_SHIFT);
    1.32 +        if ( mfn_out_of_sync(l1mfn) )
    1.33 +        {
    1.34 +            perfc_incrc(extra_va_update_sync);
    1.35 +            __shadow_sync_mfn(d, l1mfn);
    1.36 +        }
    1.37 +#endif /* keep check_pagetables() happy */
    1.38 +
    1.39          if ( unlikely(__put_user(val, &l1_pgentry_val(
    1.40                                       linear_pg_table[l1_linear_offset(va)]))) )
    1.41              err = -EINVAL;
     2.1 --- a/xen/include/xen/perfc_defn.h	Wed Mar 16 01:12:53 2005 +0000
     2.2 +++ b/xen/include/xen/perfc_defn.h	Wed Mar 16 01:14:39 2005 +0000
     2.3 @@ -50,6 +50,7 @@ PERFCOUNTER_CPU(shadow_sync_all,        
     2.4  PERFCOUNTER_CPU(shadow_make_snapshot,              "snapshots created")
     2.5  PERFCOUNTER_CPU(shadow_mark_mfn_out_of_sync_calls, "calls to shadow_mk_out_of_sync")
     2.6  PERFCOUNTER_CPU(shadow_out_of_sync_calls,          "calls to shadow_out_of_sync")
     2.7 +PERFCOUNTER_CPU(extra_va_update_sync,              "extra syncs for bug in chk_pgtb")
     2.8  PERFCOUNTER_CPU(snapshot_entry_matches_calls,      "calls to ss_entry_matches")
     2.9  PERFCOUNTER_CPU(snapshot_entry_matches_true,       "ss_entry_matches returns true")
    2.10