ia64/xen-unstable

changeset 7872:0adacfa2e33f

Fix pinning logic on restore.

Signed-off-by: Steven Hand <steven@xensource.com>
author smh22@firebug.cl.cam.ac.uk
date Thu Nov 17 10:10:52 2005 +0100 (2005-11-17)
parents 3f39f030fa89
children 4c0606fb701b
files tools/libxc/xc_linux_restore.c
line diff
     1.1 --- a/tools/libxc/xc_linux_restore.c	Wed Nov 16 20:33:23 2005 +0100
     1.2 +++ b/tools/libxc/xc_linux_restore.c	Thu Nov 17 10:10:52 2005 +0100
     1.3 @@ -146,7 +146,7 @@ int xc_linux_restore(int xc_handle, int 
     1.4      unsigned long buf[PAGE_SIZE/sizeof(unsigned long)];
     1.5  
     1.6      struct mmuext_op pin[MAX_PIN_BATCH];
     1.7 -    unsigned int nr_pins = 0;
     1.8 +    unsigned int nr_pins; 
     1.9  
    1.10  
    1.11      max_pfn = nr_pfns; 
    1.12 @@ -501,8 +501,17 @@ int xc_linux_restore(int xc_handle, int 
    1.13       * Pin page tables. Do this after writing to them as otherwise Xen
    1.14       * will barf when doing the type-checking.
    1.15       */
    1.16 +    nr_pins = 0; 
    1.17      for (i = 0; i < max_pfn; i++) {
    1.18  
    1.19 +        if (i == (max_pfn-1) || nr_pins == MAX_PIN_BATCH) {
    1.20 +            if (xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) { 
    1.21 +                ERR("Failed to pin batch of %d page tables", nr_pins); 
    1.22 +                goto out;
    1.23 +            } 
    1.24 +            nr_pins = 0;
    1.25 +        }
    1.26 +
    1.27          if ( (pfn_type[i] & LPINTAB) == 0 )
    1.28              continue;
    1.29  
    1.30 @@ -529,16 +538,8 @@ int xc_linux_restore(int xc_handle, int 
    1.31          }
    1.32  
    1.33          pin[nr_pins].arg1.mfn = p2m[i];
    1.34 +        nr_pins++; 
    1.35  
    1.36 -        nr_pins ++; 
    1.37 -        
    1.38 -        if (i == (max_pfn-1) || nr_pins == MAX_PIN_BATCH) {
    1.39 -            if (xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) { 
    1.40 -                ERR("Failed to pin batch of %d page tables", nr_pins); 
    1.41 -                goto out;
    1.42 -            } 
    1.43 -            nr_pins = 0;
    1.44 -        }
    1.45      }
    1.46  
    1.47      DPRINTF("\b\b\b\b100%%\n");