ia64/xen-unstable

changeset 10592:2e5f6c68da5c

Fail save if we have an out-of-sync P2M/M2P (since otherwise the restore
will fail later).

A better fix would be to tolerate temporary out-of-sync situations so we
can make a nicer fix to the kunmap_atomic() iossue (c/f -unstable csets
10529 & 10533) but this requires some more thought.

Signed-off-by: Steven Hand <steven@xensource.com>
author shand@kneesaa.uk.xensource.com
date Thu Jun 29 11:31:10 2006 +0100 (2006-06-29)
parents 3d40e2f509fc
children 7d3df6492d70
files tools/libxc/xc_linux_save.c
line diff
     1.1 --- a/tools/libxc/xc_linux_save.c	Thu Jun 29 11:20:46 2006 +0100
     1.2 +++ b/tools/libxc/xc_linux_save.c	Thu Jun 29 11:31:10 2006 +0100
     1.3 @@ -415,11 +415,11 @@ static int suspend_and_state(int (*suspe
     1.4  ** which entries do not require canonicalization (in particular, those
     1.5  ** entries which map the virtual address reserved for the hypervisor).
     1.6  */
     1.7 -void canonicalize_pagetable(unsigned long type, unsigned long pfn,
     1.8 -                             const void *spage, void *dpage)
     1.9 +int canonicalize_pagetable(unsigned long type, unsigned long pfn,
    1.10 +                           const void *spage, void *dpage)
    1.11  {
    1.12  
    1.13 -    int i, pte_last, xen_start, xen_end;
    1.14 +    int i, pte_last, xen_start, xen_end, race = 0; 
    1.15      uint64_t pte;
    1.16  
    1.17      /*
    1.18 @@ -481,7 +481,8 @@ void canonicalize_pagetable(unsigned lon
    1.19                     is quite feasible under live migration */
    1.20                  DPRINTF("PT Race: [%08lx,%d] pte=%llx, mfn=%08lx\n",
    1.21                          type, i, (unsigned long long)pte, mfn);
    1.22 -                pfn = 0; /* zap it - we'll retransmit this page later */
    1.23 +                pfn  = 0;  /* zap it - we'll retransmit this page later */
    1.24 +                race = 1;  /* inform the caller of race; fatal if !live */ 
    1.25              } else
    1.26                  pfn = mfn_to_pfn(mfn);
    1.27  
    1.28 @@ -496,7 +497,7 @@ void canonicalize_pagetable(unsigned lon
    1.29  
    1.30      }
    1.31  
    1.32 -    return;
    1.33 +    return race; 
    1.34  }
    1.35  
    1.36  
    1.37 @@ -567,7 +568,7 @@ int xc_linux_save(int xc_handle, int io_
    1.38      int rc = 1, i, j, last_iter, iter = 0;
    1.39      int live  = (flags & XCFLAGS_LIVE);
    1.40      int debug = (flags & XCFLAGS_DEBUG);
    1.41 -    int sent_last_iter, skip_this_iter;
    1.42 +    int race = 0, sent_last_iter, skip_this_iter;
    1.43  
    1.44      /* The new domain's shared-info frame number. */
    1.45      unsigned long shared_info_frame;
    1.46 @@ -1000,7 +1001,11 @@ int xc_linux_save(int xc_handle, int io_
    1.47                  if (pagetype >= L1TAB && pagetype <= L4TAB) {
    1.48  
    1.49                      /* We have a pagetable page: need to rewrite it. */
    1.50 -                    canonicalize_pagetable(pagetype, pfn, spage, page);
    1.51 +                    race = 
    1.52 +                        canonicalize_pagetable(pagetype, pfn, spage, page); 
    1.53 +
    1.54 +                    if(race && !live) 
    1.55 +                        goto out; 
    1.56  
    1.57                      if (ratewrite(io_fd, page, PAGE_SIZE) != PAGE_SIZE) {
    1.58                          ERR("Error when writing to state file (4)");