ia64/xen-unstable

changeset 14155:9abcc909befc

Merge
author George Dunlap <gdunlap@xensource.com>
date Tue Feb 27 06:02:32 2007 -0500 (2007-02-27)
parents ffe7e8ef2c98 8bd56d9cc6c7
children 0a9da94c904a
files
line diff
     1.1 --- a/xen/arch/x86/mm.c	Tue Feb 27 06:01:35 2007 -0500
     1.2 +++ b/xen/arch/x86/mm.c	Tue Feb 27 06:02:32 2007 -0500
     1.3 @@ -157,11 +157,8 @@ l2_pgentry_t *compat_idle_pg_table_l2 = 
     1.4  
     1.5  static void queue_deferred_ops(struct domain *d, unsigned int ops)
     1.6  {
     1.7 -    if ( d == current->domain )
     1.8 -        this_cpu(percpu_mm_info).deferred_ops |= ops;
     1.9 -    else
    1.10 -        BUG_ON(!test_bit(_DOMF_paused, &d->domain_flags) ||
    1.11 -               !cpus_empty(d->domain_dirty_cpumask));
    1.12 +    ASSERT(d == current->domain);
    1.13 +    this_cpu(percpu_mm_info).deferred_ops |= ops;
    1.14  }
    1.15  
    1.16  void __init init_frametable(void)
    1.17 @@ -1576,7 +1573,10 @@ void free_page_type(struct page_info *pa
    1.18           * (e.g., update_va_mapping()) or we could end up modifying a page
    1.19           * that is no longer a page table (and hence screw up ref counts).
    1.20           */
    1.21 -        queue_deferred_ops(owner, DOP_FLUSH_ALL_TLBS);
    1.22 +        if ( current->domain == owner )
    1.23 +            queue_deferred_ops(owner, DOP_FLUSH_ALL_TLBS);
    1.24 +        else
    1.25 +            flush_tlb_mask(owner->domain_dirty_cpumask);
    1.26  
    1.27          if ( unlikely(paging_mode_enabled(owner)) )
    1.28          {
    1.29 @@ -1950,8 +1950,6 @@ int do_mmuext_op(
    1.30      struct vcpu *v = current;
    1.31      struct domain *d = v->domain;
    1.32  
    1.33 -    LOCK_BIGLOCK(d);
    1.34 -
    1.35      if ( unlikely(count & MMU_UPDATE_PREEMPTED) )
    1.36      {
    1.37          count &= ~MMU_UPDATE_PREEMPTED;
    1.38 @@ -1959,17 +1957,19 @@ int do_mmuext_op(
    1.39              (void)copy_from_guest(&done, pdone, 1);
    1.40      }
    1.41  
    1.42 +    if ( unlikely(!guest_handle_okay(uops, count)) )
    1.43 +    {
    1.44 +        rc = -EFAULT;
    1.45 +        goto out;
    1.46 +    }
    1.47 +
    1.48      if ( !set_foreigndom(foreigndom) )
    1.49      {
    1.50          rc = -ESRCH;
    1.51          goto out;
    1.52      }
    1.53  
    1.54 -    if ( unlikely(!guest_handle_okay(uops, count)) )
    1.55 -    {
    1.56 -        rc = -EFAULT;
    1.57 -        goto out;
    1.58 -    }
    1.59 +    LOCK_BIGLOCK(d);
    1.60  
    1.61      for ( i = 0; i < count; i++ )
    1.62      {
    1.63 @@ -2072,38 +2072,36 @@ int do_mmuext_op(
    1.64              break;
    1.65          
    1.66  #ifdef __x86_64__
    1.67 -        case MMUEXT_NEW_USER_BASEPTR:
    1.68 -            if ( IS_COMPAT(FOREIGNDOM) )
    1.69 -            {
    1.70 -                okay = 0;
    1.71 -                break;
    1.72 -            }
    1.73 -            if (likely(mfn != 0))
    1.74 +        case MMUEXT_NEW_USER_BASEPTR: {
    1.75 +            unsigned long old_mfn;
    1.76 +
    1.77 +            if ( mfn != 0 )
    1.78              {
    1.79                  if ( paging_mode_refcounts(d) )
    1.80                      okay = get_page_from_pagenr(mfn, d);
    1.81                  else
    1.82                      okay = get_page_and_type_from_pagenr(
    1.83                          mfn, PGT_root_page_table, d);
    1.84 -            }
    1.85 -            if ( unlikely(!okay) )
    1.86 -            {
    1.87 -                MEM_LOG("Error while installing new mfn %lx", mfn);
    1.88 -            }
    1.89 -            else
    1.90 -            {
    1.91 -                unsigned long old_mfn =
    1.92 -                    pagetable_get_pfn(v->arch.guest_table_user);
    1.93 -                v->arch.guest_table_user = pagetable_from_pfn(mfn);
    1.94 -                if ( old_mfn != 0 )
    1.95 +                if ( unlikely(!okay) )
    1.96                  {
    1.97 -                    if ( paging_mode_refcounts(d) )
    1.98 -                        put_page(mfn_to_page(old_mfn));
    1.99 -                    else
   1.100 -                        put_page_and_type(mfn_to_page(old_mfn));
   1.101 +                    MEM_LOG("Error while installing new mfn %lx", mfn);
   1.102 +                    break;
   1.103                  }
   1.104              }
   1.105 +
   1.106 +            old_mfn = pagetable_get_pfn(v->arch.guest_table_user);
   1.107 +            v->arch.guest_table_user = pagetable_from_pfn(mfn);
   1.108 +
   1.109 +            if ( old_mfn != 0 )
   1.110 +            {
   1.111 +                if ( paging_mode_refcounts(d) )
   1.112 +                    put_page(mfn_to_page(old_mfn));
   1.113 +                else
   1.114 +                    put_page_and_type(mfn_to_page(old_mfn));
   1.115 +            }
   1.116 +
   1.117              break;
   1.118 +        }
   1.119  #endif
   1.120          
   1.121          case MMUEXT_TLB_FLUSH_LOCAL:
   1.122 @@ -2202,9 +2200,11 @@ int do_mmuext_op(
   1.123          guest_handle_add_offset(uops, 1);
   1.124      }
   1.125  
   1.126 +    process_deferred_ops();
   1.127 +
   1.128 +    UNLOCK_BIGLOCK(d);
   1.129 +
   1.130   out:
   1.131 -    process_deferred_ops();
   1.132 -
   1.133      /* Add incremental work we have done to the @done output parameter. */
   1.134      if ( unlikely(!guest_handle_is_null(pdone)) )
   1.135      {
   1.136 @@ -2212,7 +2212,6 @@ int do_mmuext_op(
   1.137          copy_to_guest(pdone, &done, 1);
   1.138      }
   1.139  
   1.140 -    UNLOCK_BIGLOCK(d);
   1.141      return rc;
   1.142  }
   1.143  
   1.144 @@ -2233,8 +2232,6 @@ int do_mmu_update(
   1.145      unsigned long type_info;
   1.146      struct domain_mmap_cache mapcache, sh_mapcache;
   1.147  
   1.148 -    LOCK_BIGLOCK(d);
   1.149 -
   1.150      if ( unlikely(count & MMU_UPDATE_PREEMPTED) )
   1.151      {
   1.152          count &= ~MMU_UPDATE_PREEMPTED;
   1.153 @@ -2242,8 +2239,11 @@ int do_mmu_update(
   1.154              (void)copy_from_guest(&done, pdone, 1);
   1.155      }
   1.156  
   1.157 -    domain_mmap_cache_init(&mapcache);
   1.158 -    domain_mmap_cache_init(&sh_mapcache);
   1.159 +    if ( unlikely(!guest_handle_okay(ureqs, count)) )
   1.160 +    {
   1.161 +        rc = -EFAULT;
   1.162 +        goto out;
   1.163 +    }
   1.164  
   1.165      if ( !set_foreigndom(foreigndom) )
   1.166      {
   1.167 @@ -2251,14 +2251,13 @@ int do_mmu_update(
   1.168          goto out;
   1.169      }
   1.170  
   1.171 +    domain_mmap_cache_init(&mapcache);
   1.172 +    domain_mmap_cache_init(&sh_mapcache);
   1.173 +
   1.174      perfc_incrc(calls_to_mmu_update);
   1.175      perfc_addc(num_page_updates, count);
   1.176  
   1.177 -    if ( unlikely(!guest_handle_okay(ureqs, count)) )
   1.178 -    {
   1.179 -        rc = -EFAULT;
   1.180 -        goto out;
   1.181 -    }
   1.182 +    LOCK_BIGLOCK(d);
   1.183  
   1.184      for ( i = 0; i < count; i++ )
   1.185      {
   1.186 @@ -2342,12 +2341,11 @@ int do_mmu_update(
   1.187  #endif
   1.188  #if CONFIG_PAGING_LEVELS >= 4
   1.189                  case PGT_l4_page_table:
   1.190 -                    if ( !IS_COMPAT(FOREIGNDOM) )
   1.191 -                    {
   1.192 -                        l4_pgentry_t l4e = l4e_from_intpte(req.val);
   1.193 -                        okay = mod_l4_entry(d, va, l4e, mfn);
   1.194 -                    }
   1.195 -                    break;
   1.196 +                {
   1.197 +                    l4_pgentry_t l4e = l4e_from_intpte(req.val);
   1.198 +                    okay = mod_l4_entry(d, va, l4e, mfn);
   1.199 +                }
   1.200 +                break;
   1.201  #endif
   1.202                  }
   1.203  
   1.204 @@ -2414,12 +2412,14 @@ int do_mmu_update(
   1.205          guest_handle_add_offset(ureqs, 1);
   1.206      }
   1.207  
   1.208 - out:
   1.209      domain_mmap_cache_destroy(&mapcache);
   1.210      domain_mmap_cache_destroy(&sh_mapcache);
   1.211  
   1.212      process_deferred_ops();
   1.213  
   1.214 +    UNLOCK_BIGLOCK(d);
   1.215 +
   1.216 + out:
   1.217      /* Add incremental work we have done to the @done output parameter. */
   1.218      if ( unlikely(!guest_handle_is_null(pdone)) )
   1.219      {
   1.220 @@ -2427,7 +2427,6 @@ int do_mmu_update(
   1.221          copy_to_guest(pdone, &done, 1);
   1.222      }
   1.223  
   1.224 -    UNLOCK_BIGLOCK(d);
   1.225      return rc;
   1.226  }
   1.227  
     2.1 --- a/xen/arch/x86/mm/p2m.c	Tue Feb 27 06:01:35 2007 -0500
     2.2 +++ b/xen/arch/x86/mm/p2m.c	Tue Feb 27 06:02:32 2007 -0500
     2.3 @@ -145,6 +145,10 @@ p2m_next_level(struct domain *d, mfn_t *
     2.4              paging_write_p2m_entry(d, gfn, p2m_entry, new_entry, 4);
     2.5              break;
     2.6          case PGT_l2_page_table:
     2.7 +#if CONFIG_PAGING_LEVELS == 3
     2.8 +            /* for PAE mode, PDPE only has PCD/PWT/P bits available */
     2.9 +            new_entry = l1e_from_pfn(mfn_x(page_to_mfn(pg)), _PAGE_PRESENT);
    2.10 +#endif
    2.11              paging_write_p2m_entry(d, gfn, p2m_entry, new_entry, 3);
    2.12              break;
    2.13          case PGT_l1_page_table: