Skip to contentSkip to conversation

Don't unshadow current used shadow L2 table.

PATCH New Ling, Xiaofeng 1 participant 1 message Dec 8, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't unshadow current used shadow L2 table.

# HG changeset patch
# User Xiaofeng Ling <[email protected]>
# Node ID cc6e19224d0b755d24358cd15d1a40f894d320b4
# Parent b215584242c43415eccd008b90c812f3d04b398d
Don't unshadow when the shadow l2 is the current used shadow table. Otherwise, when destorying the domain, if the current sl2 is unpinned, the shadow page will be freed without accquire the shadow_lock. This may also improve the performance due to avoiding uncessary unshadow.

# HG changeset patch
# User Xiaofeng Ling <[email protected]>
# Node ID cc6e19224d0b755d24358cd15d1a40f894d320b4
# Parent b215584242c43415eccd008b90c812f3d04b398d
Don't unshadow when the shadow l2 is the current used shadow table. Otherwise, when destory the domain, if the current sl2 is unpinned, the shadow page will be freed without accquire the shadow_lock. This may also improve the performance due to avoiding uncessary unshadow.

xen/arch/x86/shadow.c +4 -0
diff -r b215584242c4 xen/arch/x86/shadow.c
@@ -1450,6 +1450,7 @@
     int changed;
     u32 min_max_shadow, min_max_snapshot;
     int min_shadow, max_shadow, min_snapshot, max_snapshot;
+    struct vcpu *v;
 
     ASSERT(shadow_lock_is_acquired(d));
 
@@ -1739,6 +1740,9 @@
 
         if ( unlikely(unshadow) )
         {
+            for_each_vcpu(d, v)
+                if(smfn == pagetable_get_pfn(v->arch.shadow_table))
+                    return need_flush;
             perfc_incrc(unshadow_l2_count);
             shadow_unpin(smfn);
 #if CONFIG_PAGING_LEVELS == 2
xen/arch/x86/shadow32.c +4 -0
diff -r b215584242c4 xen/arch/x86/shadow32.c
@@ -2326,6 +2326,7 @@
     int changed;
     u32 min_max_shadow, min_max_snapshot;
     int min_shadow, max_shadow, min_snapshot, max_snapshot;
+    struct vcpu *v;
 
     ASSERT(shadow_lock_is_acquired(d));
 
@@ -2527,6 +2528,9 @@
 
         if ( unlikely(unshadow) )
         {
+            for_each_vcpu(d, v)
+                if(smfn == pagetable_get_pfn(v->arch.shadow_table))
+                    return need_flush;
             perfc_incrc(unshadow_l2_count);
             shadow_unpin(smfn);
             if ( unlikely(shadow_mode_external(d)) )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel