ia64/xen-unstable

changeset 13480:05c1db1b8cb9

[XEN] Fix deferred mmu op logic.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@localhost.localdomain
date Wed Jan 17 21:07:43 2007 +0000 (2007-01-17)
parents dd0989523d17
children e5f585514b16
files xen/arch/x86/mm.c
line diff
     1.1 --- a/xen/arch/x86/mm.c	Wed Jan 17 16:42:34 2007 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Wed Jan 17 21:07:43 2007 +0000
     1.3 @@ -154,6 +154,15 @@ l2_pgentry_t *compat_idle_pg_table_l2 = 
     1.4  #define l3_disallow_mask(d) L3_DISALLOW_MASK
     1.5  #endif
     1.6  
     1.7 +static void queue_deferred_ops(struct domain *d, unsigned int ops)
     1.8 +{
     1.9 +    if ( d == current->domain )
    1.10 +        this_cpu(percpu_mm_info).deferred_ops |= ops;
    1.11 +    else
    1.12 +        BUG_ON(!test_bit(_DOMF_paused, &d->domain_flags) ||
    1.13 +               !cpus_empty(d->domain_dirty_cpumask));
    1.14 +}
    1.15 +
    1.16  void __init init_frametable(void)
    1.17  {
    1.18      unsigned long nr_pages, page_step, i, mfn;
    1.19 @@ -416,8 +425,7 @@ void invalidate_shadow_ldt(struct vcpu *
    1.20      }
    1.21  
    1.22      /* Dispose of the (now possibly invalid) mappings from the TLB.  */
    1.23 -    ASSERT(v->processor == smp_processor_id());
    1.24 -    this_cpu(percpu_mm_info).deferred_ops |= DOP_FLUSH_TLB | DOP_RELOAD_LDT;
    1.25 +    queue_deferred_ops(v->domain, DOP_FLUSH_TLB | DOP_RELOAD_LDT);
    1.26  }
    1.27  
    1.28  
    1.29 @@ -945,7 +953,8 @@ static int create_pae_xen_mappings(struc
    1.30      }
    1.31  #else
    1.32      memcpy(&pl2e[COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(d)],
    1.33 -           &compat_idle_pg_table_l2[l2_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
    1.34 +           &compat_idle_pg_table_l2[
    1.35 +               l2_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
    1.36             COMPAT_L2_PAGETABLE_XEN_SLOTS(d) * sizeof(*pl2e));
    1.37  #endif
    1.38      unmap_domain_page(pl2e);
    1.39 @@ -1561,7 +1570,7 @@ void free_page_type(struct page_info *pa
    1.40           * (e.g., update_va_mapping()) or we could end up modifying a page
    1.41           * that is no longer a page table (and hence screw up ref counts).
    1.42           */
    1.43 -        this_cpu(percpu_mm_info).deferred_ops |= DOP_FLUSH_ALL_TLBS;
    1.44 +        queue_deferred_ops(owner, DOP_FLUSH_ALL_TLBS);
    1.45  
    1.46          if ( unlikely(shadow_mode_enabled(owner)) )
    1.47          {
    1.48 @@ -1765,7 +1774,8 @@ int new_guest_cr3(unsigned long mfn)
    1.49  #ifdef CONFIG_COMPAT
    1.50      if ( IS_COMPAT(d) )
    1.51      {
    1.52 -        l4_pgentry_t l4e = l4e_from_pfn(mfn, _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED);
    1.53 +        l4_pgentry_t l4e = l4e_from_pfn(
    1.54 +            mfn, _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED);
    1.55  
    1.56          if ( shadow_mode_refcounts(d) )
    1.57          {
    1.58 @@ -1819,8 +1829,6 @@ int new_guest_cr3(unsigned long mfn)
    1.59                  /* Failure here is unrecoverable: the VCPU has no pagetable! */
    1.60                  MEM_LOG("Fatal error while installing new baseptr %lx", mfn);
    1.61                  domain_crash(d);
    1.62 -                ASSERT(v->processor == smp_processor_id());
    1.63 -                this_cpu(percpu_mm_info).deferred_ops = 0;
    1.64                  return 0;
    1.65              }
    1.66          }