direct-io.hg

changeset 7393:475e2a8493b8

Flush writable pagetable state whenever a domain is
synchronously paused (by Xen or by domain0), or when
it shuts down.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Oct 15 17:19:43 2005 +0100 (2005-10-15)
parents 9d9b75569d0e
children 6cf6f8783282
files xen/arch/x86/mm.c xen/common/domain.c xen/include/asm-x86/mm.h
line diff
     1.1 --- a/xen/arch/x86/mm.c	Sat Oct 15 16:26:03 2005 +0100
     1.2 +++ b/xen/arch/x86/mm.c	Sat Oct 15 17:19:43 2005 +0100
     1.3 @@ -1755,7 +1755,7 @@ int do_mmuext_op(
     1.4              goto pin_page;
     1.5  
     1.6          case MMUEXT_UNPIN_TABLE:
     1.7 -            if ( unlikely(!(okay = get_page_from_pagenr(mfn, FOREIGNDOM))) )
     1.8 +            if ( unlikely(!(okay = get_page_from_pagenr(mfn, d))) )
     1.9              {
    1.10                  MEM_LOG("Mfn %lx bad domain (dom=%p)",
    1.11                          mfn, page_get_owner(page));
    1.12 @@ -2908,6 +2908,7 @@ int revalidate_l1(
    1.13  {
    1.14      l1_pgentry_t ol1e, nl1e;
    1.15      int modified = 0, i;
    1.16 +    struct vcpu *v;
    1.17  
    1.18      for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
    1.19      {
    1.20 @@ -2940,7 +2941,11 @@ int revalidate_l1(
    1.21               */
    1.22              memcpy(&l1page[i], &snapshot[i],
    1.23                     (L1_PAGETABLE_ENTRIES - i) * sizeof(l1_pgentry_t));
    1.24 -            domain_crash();
    1.25 +
    1.26 +            /* Crash the offending domain. */
    1.27 +            set_bit(_DOMF_ctrl_pause, &d->domain_flags);
    1.28 +            for_each_vcpu ( d, v )
    1.29 +                vcpu_sleep_nosync(v);
    1.30              break;
    1.31          }
    1.32          
    1.33 @@ -3019,8 +3024,8 @@ void ptwr_flush(struct domain *d, const 
    1.34      modified = revalidate_l1(d, pl1e, d->arch.ptwr[which].page);
    1.35      unmap_domain_page(pl1e);
    1.36      perfc_incr_histo(wpt_updates, modified, PT_UPDATES);
    1.37 -    ptwr_eip_stat_update(  d->arch.ptwr[which].eip, d->domain_id, modified);
    1.38 -    d->arch.ptwr[which].prev_nr_updates  = modified;
    1.39 +    ptwr_eip_stat_update(d->arch.ptwr[which].eip, d->domain_id, modified);
    1.40 +    d->arch.ptwr[which].prev_nr_updates = modified;
    1.41  
    1.42      /*
    1.43       * STEP 3. Reattach the L1 p.t. page into the current address space.
    1.44 @@ -3369,7 +3374,9 @@ int ptwr_init(struct domain *d)
    1.45  
    1.46  void ptwr_destroy(struct domain *d)
    1.47  {
    1.48 +    LOCK_BIGLOCK(d);
    1.49      cleanup_writable_pagetable(d);
    1.50 +    UNLOCK_BIGLOCK(d);
    1.51      free_xenheap_page(d->arch.ptwr[PTWR_PT_ACTIVE].page);
    1.52      free_xenheap_page(d->arch.ptwr[PTWR_PT_INACTIVE].page);
    1.53  }
     2.1 --- a/xen/common/domain.c	Sat Oct 15 16:26:03 2005 +0100
     2.2 +++ b/xen/common/domain.c	Sat Oct 15 17:19:43 2005 +0100
     2.3 @@ -290,6 +290,8 @@ void domain_pause(struct domain *d)
     2.4          atomic_inc(&v->pausecnt);
     2.5          vcpu_sleep_sync(v);
     2.6      }
     2.7 +
     2.8 +    sync_pagetable_state(d);
     2.9  }
    2.10  
    2.11  void vcpu_unpause(struct vcpu *v)
    2.12 @@ -318,6 +320,8 @@ void domain_pause_by_systemcontroller(st
    2.13          for_each_vcpu ( d, v )
    2.14              vcpu_sleep_sync(v);
    2.15      }
    2.16 +
    2.17 +    sync_pagetable_state(d);
    2.18  }
    2.19  
    2.20  void domain_unpause_by_systemcontroller(struct domain *d)
     3.1 --- a/xen/include/asm-x86/mm.h	Sat Oct 15 16:26:03 2005 +0100
     3.2 +++ b/xen/include/asm-x86/mm.h	Sat Oct 15 17:19:43 2005 +0100
     3.3 @@ -336,7 +336,12 @@ int  ptwr_do_page_fault(struct domain *,
     3.4  int  revalidate_l1(struct domain *, l1_pgentry_t *, l1_pgentry_t *);
     3.5  
     3.6  void cleanup_writable_pagetable(struct domain *d);
     3.7 -#define sync_pagetable_state(d) cleanup_writable_pagetable(d)
     3.8 +#define sync_pagetable_state(d)                 \
     3.9 +    do {                                        \
    3.10 +        LOCK_BIGLOCK(d);                        \
    3.11 +        cleanup_writable_pagetable(d);          \
    3.12 +        UNLOCK_BIGLOCK(d);                      \
    3.13 +    } while ( 0 )
    3.14  
    3.15  int audit_adjust_pgtables(struct domain *d, int dir, int noisy);
    3.16