ia64/xen-unstable

changeset 4279:3fe0f99cb576

bitkeeper revision 1.1259 (4241a247utqWSkcNHjYx45_xeNZjqg)

Unshadow any L2 that, when updated, has no valid entries left...

Signed-off-by: michael.fetterman@cl.cam.ac.uk
author mafetter@fleming.research
date Wed Mar 23 17:07:19 2005 +0000 (2005-03-23)
parents 0c149b605692
children b40fc0992e25
files xen/arch/x86/shadow.c
line diff
     1.1 --- a/xen/arch/x86/shadow.c	Wed Mar 23 16:55:23 2005 +0000
     1.2 +++ b/xen/arch/x86/shadow.c	Wed Mar 23 17:07:19 2005 +0000
     1.3 @@ -2050,6 +2050,7 @@ static int resync_all(struct domain *d, 
     1.4              }
     1.5              break;
     1.6          case PGT_l2_shadow:
     1.7 +            max = -1;
     1.8              for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
     1.9              {
    1.10                  if ( !is_guest_l2_slot(i) && !external )
    1.11 @@ -2065,17 +2066,18 @@ static int resync_all(struct domain *d, 
    1.12                      //
    1.13                      // snapshot[i] = new_pde;
    1.14                  }
    1.15 +                if ( new_pde != 0 )
    1.16 +                    max = i;
    1.17  
    1.18                  // XXX - This hack works for linux guests.
    1.19                  //       Need a better solution long term.
    1.20                  if ( !(new_pde & _PAGE_PRESENT) && unlikely(new_pde != 0) &&
    1.21                       !unshadow &&
    1.22                       (frame_table[smfn].u.inuse.type_info & PGT_pinned) )
    1.23 -                {
    1.24 -                    perfc_incrc(unshadow_l2_count);
    1.25                      unshadow = 1;
    1.26 -                }
    1.27              }
    1.28 +            if ( max == -1 )
    1.29 +                unshadow = 1;
    1.30              break;
    1.31          default:
    1.32              for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
    1.33 @@ -2102,7 +2104,10 @@ static int resync_all(struct domain *d, 
    1.34          unmap_domain_mem(guest);
    1.35  
    1.36          if ( unlikely(unshadow) )
    1.37 +        {
    1.38 +            perfc_incrc(unshadow_l2_count);
    1.39              shadow_unpin(smfn);
    1.40 +        }
    1.41      }
    1.42  
    1.43      return need_flush;