Skip to contentSkip to conversation

fix Remus failover regression

PATCH Applied Yang Hongyang 4 participants 10 messages Jul 28, 2014 – Aug 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fix Remus failover regression

commit: c2ba706c
tools/libxc: goto correct label on error paths by Andrew Cooper broke Remus in Xen 4.4 or earlier versions that has this commit backported.

With Remus, this jump essentially discards the current incomplete checkpoint received by the backup and restore backup from the last complete checkpoint.
This is required for Remus to work and this does not break live migration.
It has been around since Xen 4.0.

CC Ian Jackson <[email protected]>
CC Ian Campbell <[email protected]>
CC Andrew Cooper <[email protected]>
CC Shriram Rajagopalan <[email protected]>
---
 tools/libxc/xc_domain_restore.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
tools/libxc/xc_domain_restore.c +11 -2
index e73e0a2..b9a56d5 100644
@@ -1783,20 +1783,29 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
 
     if ( pagebuf_get(xch, ctx, &pagebuf, io_fd, dom) ) {
         PERROR("error when buffering batch, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
     }
     memset(&tmptail, 0, sizeof(tmptail));
     tmptail.ishvm = hvm;
     if ( buffer_tail(xch, ctx, &tmptail, io_fd, max_vcpu_id, vcpumap,
                      ext_vcpucontext, vcpuextstate_size) < 0 ) {
         ERROR ("error buffering image tail, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
     }
     tailbuf_free(&tailbuf);
     memcpy(&tailbuf, &tmptail, sizeof(tailbuf));
 
     goto loadpages;
 
+  /* With Remus: restore from last complete checkpoint */
   finish:
     if ( hvm )
         goto finish_hvm;
Signature · 1 line
1.9.1
Acked-by on v2 1/1
#1 lore raw
Quoted 18 lines · Yang Hongyang

commit: c2ba706c
tools/libxc: goto correct label on error paths by Andrew Cooper broke Remus in Xen 4.4 or earlier versions that has this commit backported.

With Remus, this jump essentially discards the current incomplete checkpoint received by the backup and restore backup from the last complete checkpoint.
This is required for Remus to work and this does not break live migration.
It has been around since Xen 4.0.

CC Ian Jackson <[email protected]>
CC Ian Campbell <[email protected]>
CC Andrew Cooper <[email protected]>
CC Shriram Rajagopalan <[email protected]>

Review

Quoted 5 lines
---
 tools/libxc/xc_domain_restore.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/tools/libxc/xc_domain_restore.c

tools/libxc/xc_domain_restore.c int xc_domain_restore(xc_interface *xch, int

Quoted 4 lines

index e73e0a2..b9a56d5 100644

tools/libxc/xc_domain_restore.c +0 -0
@@ -1783,20 +1783,29 @@ int xc_domain_restore(xc_interface *xch, int

io_fd, uint32_t dom,

Quoted 32 lines
tools/libxc/xc_domain_restore.c +11 -3
     if ( pagebuf_get(xch, ctx, &pagebuf, io_fd, dom) ) {
         PERROR("error when buffering batch, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
     }
     memset(&tmptail, 0, sizeof(tmptail));
     tmptail.ishvm = hvm;
     if ( buffer_tail(xch, ctx, &tmptail, io_fd, max_vcpu_id, vcpumap,
                      ext_vcpucontext, vcpuextstate_size) < 0 ) {
         ERROR ("error buffering image tail, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
     }
     tailbuf_free(&tailbuf);
     memcpy(&tailbuf, &tmptail, sizeof(tailbuf));
 
     goto loadpages;
 
+  /* With Remus: restore from last complete checkpoint */
   finish:
     if ( hvm )
         goto finish_hvm;
--
Quoted 2 lines

1.9.1

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

#2 lore raw
In reply to Yang Hongyang
Quoted 4 lines · Yang Hongyang

commit: c2ba706c
tools/libxc: goto correct label on error paths by Andrew Cooper broke Remus in Xen 4.4 or earlier versions that has this commit backported.

My appologies for breaking Remus. (it just goes to show how fragile this code is).

Quoted 7 lines

With Remus, this jump essentially discards the current incomplete checkpoint received by the backup and restore backup from the last complete checkpoint.
This is required for Remus to work and this does not break live migration.
It has been around since Xen 4.0.

However, it is a genuine bugfix for regular migration, so simply reverting it as this patch does is not appropriate.

For regular migration, you absolutely have to goto out; on a failure otherwise the finish code will run and declare the migration a success despite only having half a domain restored.

You need something like:

if ( !checkpointed_stream )

    goto err;

/* Remus comment */
goto finish;

to deal with the different error handing requirements of remus and regular streams.

~Andrew

Quoted 46 lines
CC Ian Jackson <[email protected]>
CC Ian Campbell <[email protected]>
CC Andrew Cooper <[email protected]>
CC Shriram Rajagopalan <[email protected]>
---
 tools/libxc/xc_domain_restore.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
tools/libxc/xc_domain_restore.c +11 -2
index e73e0a2..b9a56d5 100644
@@ -1783,20 +1783,29 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
 
     if ( pagebuf_get(xch, ctx, &pagebuf, io_fd, dom) ) {
         PERROR("error when buffering batch, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
     }
     memset(&tmptail, 0, sizeof(tmptail));
     tmptail.ishvm = hvm;
     if ( buffer_tail(xch, ctx, &tmptail, io_fd, max_vcpu_id, vcpumap,
                      ext_vcpucontext, vcpuextstate_size) < 0 ) {
         ERROR ("error buffering image tail, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
     }
     tailbuf_free(&tailbuf);
     memcpy(&tailbuf, &tmptail, sizeof(tailbuf));
 
     goto loadpages;
 
+  /* With Remus: restore from last complete checkpoint */
   finish:
     if ( hvm )
         goto finish_hvm;
#3 lore raw

Hi Andrew,

Quoted 17 lines · Andrew Cooper
Quoted 4 lines · Yang Hongyang

commit: c2ba706c
tools/libxc: goto correct label on error paths by Andrew Cooper broke Remus in Xen 4.4 or earlier versions that has this commit backported.

My appologies for breaking Remus. (it just goes to show how fragile this code is).

Quoted 7 lines

With Remus, this jump essentially discards the current incomplete checkpoint received by the backup and restore backup from the last complete checkpoint.
This is required for Remus to work and this does not break live migration.
It has been around since Xen 4.0.

Quoted 6 lines

However, it is a genuine bugfix for regular migration, so simply reverting it as this patch does is not appropriate.

For regular migration, you absolutely have to goto out; on a failure otherwise the finish code will run and declare the migration a success despite only having half a domain restored.

I think regular migration shouldn't run into this path (see what I commented in v1), but I agree that add a check will be better.

Quoted 63 lines

You need something like:

if ( !checkpointed_stream )

     goto err;

/* Remus comment */
goto finish;

to deal with the different error handing requirements of remus and regular streams.

~Andrew

Quoted 36 lines
CC Ian Jackson <[email protected]>
CC Ian Campbell <[email protected]>
CC Andrew Cooper <[email protected]>
CC Shriram Rajagopalan <[email protected]>
---
  tools/libxc/xc_domain_restore.c | 13 +++++++++++--
  1 file changed, 11 insertions(+), 2 deletions(-)
tools/libxc/xc_domain_restore.c +10 -2
index e73e0a2..b9a56d5 100644
@@ -1783,20 +1783,29 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
 
      if ( pagebuf_get(xch, ctx, &pagebuf, io_fd, dom) ) {
          PERROR("error when buffering batch, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
      }
      memset(&tmptail, 0, sizeof(tmptail));
      tmptail.ishvm = hvm;
      if ( buffer_tail(xch, ctx, &tmptail, io_fd, max_vcpu_id, vcpumap,
                       ext_vcpucontext, vcpuextstate_size) < 0 ) {
          ERROR ("error buffering image tail, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;

tools/libxc/xc_domain_restore.c int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, · line 1811

Quoted 10 lines
tools/libxc/xc_domain_restore.c +1 -0
      }
      tailbuf_free(&tailbuf);
      memcpy(&tailbuf, &tmptail, sizeof(tailbuf));
 
      goto loadpages;
 
+  /* With Remus: restore from last complete checkpoint */
    finish:
      if ( hvm )
          goto finish_hvm;

.

Signature · 2 lines
Thanks,
Yang.
Reviewed-by
#4 lore raw
Quoted 23 lines · Hongyang Yang

Hi Andrew,

Quoted 20 lines · Andrew Cooper
Quoted 4 lines · Yang Hongyang

commit: c2ba706c
tools/libxc: goto correct label on error paths by Andrew Cooper broke Remus in Xen 4.4 or earlier versions that has this commit backported.

My appologies for breaking Remus. (it just goes to show how fragile this code is).

Quoted 7 lines

With Remus, this jump essentially discards the current incomplete checkpoint received by the backup and restore backup from the last complete checkpoint.
This is required for Remus to work and this does not break live migration.
It has been around since Xen 4.0.

However, it is a genuine bugfix for regular migration, so simply reverting it as this patch does is not appropriate.

Quoted 7 lines
Quoted 3 lines

For regular migration, you absolutely have to goto out; on a failure otherwise the finish code will run and declare the migration a success despite only having half a domain restored.

I think regular migration shouldn't run into this path (see what I commented
in v1), but I agree that add a check will be better.

Hmm - I see what you mean. I can't spot how a regular migration would end up at that point.

When I debugged the issue, I was encountering the pagebuf error message on a regular migrate, although I was debugging a single isolated failure from logs alone. With a bit of hindsight now, this probably means that ctx->last_checkpoint was wrong.

We regularly test migration from before the point that ctx->last_checkpoint was introduced and broke the migration backwards-compatibility, but the purpose of checkpointed_stream was to re-fix this without regressing backwards compatibility.

I have to admit that I somewhat confused as to what actually went on, but it is also clear that my changes were based on incorrect reasoning and further rereasoning at this point suggests the changes were wrong.

Therefore, this patch with comments is probably best.

IanJ: This fix needs backporting to 4.4 (4.3 and older are fine)

~Andrew

#5 lore raw
In reply to Yang Hongyang

Ping!

Quoted 58 lines · Yang Hongyang

commit: c2ba706c
tools/libxc: goto correct label on error paths by Andrew Cooper broke Remus in Xen 4.4 or earlier versions that has this commit backported.

With Remus, this jump essentially discards the current incomplete checkpoint received by the backup and restore backup from the last complete checkpoint.
This is required for Remus to work and this does not break live migration.
It has been around since Xen 4.0.

CC Ian Jackson <[email protected]>
CC Ian Campbell <[email protected]>
CC Andrew Cooper <[email protected]>
CC Shriram Rajagopalan <[email protected]>
---
  tools/libxc/xc_domain_restore.c | 13 +++++++++++--
  1 file changed, 11 insertions(+), 2 deletions(-)
tools/libxc/xc_domain_restore.c +11 -2
index e73e0a2..b9a56d5 100644
@@ -1783,20 +1783,29 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
 
      if ( pagebuf_get(xch, ctx, &pagebuf, io_fd, dom) ) {
          PERROR("error when buffering batch, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
      }
      memset(&tmptail, 0, sizeof(tmptail));
      tmptail.ishvm = hvm;
      if ( buffer_tail(xch, ctx, &tmptail, io_fd, max_vcpu_id, vcpumap,
                       ext_vcpucontext, vcpuextstate_size) < 0 ) {
          ERROR ("error buffering image tail, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
      }
      tailbuf_free(&tailbuf);
      memcpy(&tailbuf, &tmptail, sizeof(tailbuf));
 
      goto loadpages;
 
+  /* With Remus: restore from last complete checkpoint */
    finish:
      if ( hvm )
          goto finish_hvm;
Signature · 7 lines
Thanks,
Yang.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#6 lore raw
Quoted 18 lines · Hongyang Yang

Ping!

Quoted 15 lines · Yang Hongyang

commit: c2ba706c
tools/libxc: goto correct label on error paths by Andrew Cooper broke Remus in Xen 4.4 or earlier versions that has this commit backported.

With Remus, this jump essentially discards the current incomplete checkpoint received by the backup and restore backup from the last complete checkpoint.
This is required for Remus to work and this does not break live migration.
It has been around since Xen 4.0.

CC Ian Jackson <[email protected]>
CC Ian Campbell <[email protected]>

It is elsewhere in this thread, but Reviewed-by: Andrew Cooper <[email protected]>

Quoted 38 lines
Quoted 38 lines
CC Shriram Rajagopalan <[email protected]>
---
  tools/libxc/xc_domain_restore.c | 13 +++++++++++--
  1 file changed, 11 insertions(+), 2 deletions(-)
tools/libxc/xc_domain_restore.c +10 -2
index e73e0a2..b9a56d5 100644
@@ -1783,20 +1783,29 @@ int xc_domain_restore(xc_interface *xch, int
 io_fd, uint32_t dom,
 
      if ( pagebuf_get(xch, ctx, &pagebuf, io_fd, dom) ) {
          PERROR("error when buffering batch, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
      }
      memset(&tmptail, 0, sizeof(tmptail));
      tmptail.ishvm = hvm;
      if ( buffer_tail(xch, ctx, &tmptail, io_fd, max_vcpu_id, vcpumap,
                       ext_vcpucontext, vcpuextstate_size) < 0 ) {
          ERROR ("error buffering image tail, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
      }
      tailbuf_free(&tailbuf);
      memcpy(&tailbuf, &tmptail, sizeof(tailbuf));
 
Quoted 8 lines
Quoted 7 lines
tools/libxc/xc_domain_restore.c +1 -0
      goto loadpages;
 
+  /* With Remus: restore from last complete checkpoint */
    finish:
      if ( hvm )
          goto finish_hvm;

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

#7 lore raw

Hi

Quoted 16 lines · Andrew Cooper
Quoted 15 lines · Hongyang Yang

Ping!

Quoted 12 lines · Yang Hongyang

commit: c2ba706c
tools/libxc: goto correct label on error paths by Andrew Cooper broke Remus in Xen 4.4 or earlier versions that has this commit backported.

With Remus, this jump essentially discards the current incomplete checkpoint received by the backup and restore backup from the last complete checkpoint.
This is required for Remus to work and this does not break live migration.
It has been around since Xen 4.0.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
CC Ian Jackson <[email protected]>
CC Ian Campbell <[email protected]>

It is elsewhere in this thread, but Reviewed-by: Andrew Cooper <[email protected]>

Sorry for the late replay (Just back from a vacation). Thank you for the review! Seems this patch still not applied. I will add this to the remus patchset anyway because remus failover won't work without this fix :(

Quoted 50 lines
Quoted 39 lines
Quoted 39 lines
CC Shriram Rajagopalan <[email protected]>
---
   tools/libxc/xc_domain_restore.c | 13 +++++++++++--
   1 file changed, 11 insertions(+), 2 deletions(-)
tools/libxc/xc_domain_restore.c +10 -2
index e73e0a2..b9a56d5 100644
@@ -1783,20 +1783,29 @@ int xc_domain_restore(xc_interface *xch, int
 io_fd, uint32_t dom,
 
       if ( pagebuf_get(xch, ctx, &pagebuf, io_fd, dom) ) {
           PERROR("error when buffering batch, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
       }
       memset(&tmptail, 0, sizeof(tmptail));
       tmptail.ishvm = hvm;
       if ( buffer_tail(xch, ctx, &tmptail, io_fd, max_vcpu_id, vcpumap,
                        ext_vcpucontext, vcpuextstate_size) < 0 ) {
           ERROR ("error buffering image tail, finishing");
-        goto out;
+        /*
+         * Remus: discard the current incomplete checkpoint and restore
+         * backup from the last complete checkpoint.
+         */
+        goto finish;
       }
       tailbuf_free(&tailbuf);
       memcpy(&tailbuf, &tmptail, sizeof(tailbuf));
 
Quoted 8 lines
Quoted 7 lines
tools/libxc/xc_domain_restore.c +1 -0
       goto loadpages;
 
+  /* With Remus: restore from last complete checkpoint */
     finish:
       if ( hvm )
           goto finish_hvm;

.

Signature · 7 lines
Thanks,
Yang.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Applied
#8 lore raw
In reply to Andrew Cooper
Quoted 5 lines · Andrew Cooper
Quoted 1 line · Hongyang Yang

Ping!

It is elsewhere in this thread, but Reviewed-by: Andrew Cooper <[email protected]>

Applied. I added "tools: libxc" to the $SUBJECT and rewrapped since the first para at least seemed to have gotten mangled.

Applied
#9 lore raw
In reply to Andrew Cooper
Quoted 5 lines · Andrew Cooper
Quoted 1 line · Hongyang Yang

Ping!

It is elsewhere in this thread, but Reviewed-by: Andrew Cooper <[email protected]>

Applied. I added "tools: libxc" to the $SUBJECT and rewrapped since the first para at least seemed to have gotten mangled.