ia64/xen-unstable

changeset 8283:5f7398785e02

Don't unshadow when the shadow l2 is the current used shadow table.
Otherwise, when destroying the domain, if the current sl2 is unpinned
then the shadow page will be freed without accquire the shadow_lock.
This may also improve the performance due to avoiding uncessary
unshadow.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Dec 08 15:21:36 2005 +0100 (2005-12-08)
parents 29055c5ad51d
children 7557f0b4098c
files xen/arch/x86/shadow.c xen/arch/x86/shadow32.c
line diff
     1.1 --- a/xen/arch/x86/shadow.c	Thu Dec 08 15:18:13 2005 +0100
     1.2 +++ b/xen/arch/x86/shadow.c	Thu Dec 08 15:21:36 2005 +0100
     1.3 @@ -1450,6 +1450,7 @@ static int resync_all(struct domain *d, 
     1.4      int changed;
     1.5      u32 min_max_shadow, min_max_snapshot;
     1.6      int min_shadow, max_shadow, min_snapshot, max_snapshot;
     1.7 +    struct vcpu *v;
     1.8  
     1.9      ASSERT(shadow_lock_is_acquired(d));
    1.10  
    1.11 @@ -1739,6 +1740,9 @@ static int resync_all(struct domain *d, 
    1.12  
    1.13          if ( unlikely(unshadow) )
    1.14          {
    1.15 +            for_each_vcpu(d, v)
    1.16 +                if(smfn == pagetable_get_pfn(v->arch.shadow_table))
    1.17 +                    return need_flush;
    1.18              perfc_incrc(unshadow_l2_count);
    1.19              shadow_unpin(smfn);
    1.20  #if CONFIG_PAGING_LEVELS == 2
     2.1 --- a/xen/arch/x86/shadow32.c	Thu Dec 08 15:18:13 2005 +0100
     2.2 +++ b/xen/arch/x86/shadow32.c	Thu Dec 08 15:21:36 2005 +0100
     2.3 @@ -2326,6 +2326,7 @@ static int resync_all(struct domain *d, 
     2.4      int changed;
     2.5      u32 min_max_shadow, min_max_snapshot;
     2.6      int min_shadow, max_shadow, min_snapshot, max_snapshot;
     2.7 +    struct vcpu *v;
     2.8  
     2.9      ASSERT(shadow_lock_is_acquired(d));
    2.10  
    2.11 @@ -2527,6 +2528,9 @@ static int resync_all(struct domain *d, 
    2.12  
    2.13          if ( unlikely(unshadow) )
    2.14          {
    2.15 +            for_each_vcpu(d, v)
    2.16 +                if(smfn == pagetable_get_pfn(v->arch.shadow_table))
    2.17 +                    return need_flush;
    2.18              perfc_incrc(unshadow_l2_count);
    2.19              shadow_unpin(smfn);
    2.20              if ( unlikely(shadow_mode_external(d)) )