Skip to contentSkip to conversation

further shrink the big-lock window

PATCH New Jan Beulich 1 participant 1 message Mar 22, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 further shrink the big-lock window

A few more adjustments to when the 'big' lock is taken/dropped. (The WARN_ON used here depends on the previously sent patch adding common support for this construct).

Also, fix a case where the foreign domain setting may not get properly cleared at the end of a hypercall (in case of an early error).

xen/arch/x86/mm.c +10 -6
Index: 2007-03-19/xen/arch/x86/mm.c
===================================================================
@@ -2431,13 +2431,13 @@ int do_mmu_update(
         guest_handle_add_offset(ureqs, 1);
     }
 
-    domain_mmap_cache_destroy(&mapcache);
-    domain_mmap_cache_destroy(&sh_mapcache);
-
     process_deferred_ops();
 
     UNLOCK_BIGLOCK(d);
 
+    domain_mmap_cache_destroy(&mapcache);
+    domain_mmap_cache_destroy(&sh_mapcache);
+
  out:
     /* Add incremental work we have done to the @done output parameter. */
     if ( unlikely(!guest_handle_is_null(pdone)) )
@@ -2740,6 +2740,10 @@ int do_update_va_mapping(unsigned long v
         guest_unmap_l1e(v, pl1e);
     pl1e = NULL;
 
+    process_deferred_ops();
+
+    UNLOCK_BIGLOCK(d);
+
     switch ( flags & UVMF_FLUSHTYPE_MASK )
     {
     case UVMF_TLB_FLUSH:
@@ -2785,9 +2789,7 @@ int do_update_va_mapping(unsigned long v
         break;
     }
 
-    process_deferred_ops();
-    
-    UNLOCK_BIGLOCK(d);
+    WARN_ON(this_cpu(percpu_mm_info).deferred_ops);
 
     return rc;
 }
@@ -2806,6 +2808,8 @@ int do_update_va_mapping_otherdomain(uns
 
     rc = do_update_va_mapping(va, val64, flags);
 
+    this_cpu(percpu_mm_info).foreign = NULL;
+
     return rc;
 }