qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Thomas Treutner <thomas@scripty.at>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] A small patch to introduce stop conditions to the live migration.
Date: Wed, 14 Sep 2011 10:45:19 -0500	[thread overview]
Message-ID: <4E70CC0F.3070905@codemonkey.ws> (raw)
In-Reply-To: <20110914131819.GA29426@puenktchen.ani.univie.ac.at>

On 09/14/2011 08:18 AM, Thomas Treutner wrote:
> Currently, it is possible that a live migration never finishes, when the dirty page rate is high compared to the scan/transfer rate. The exact values for MAX_MEMORY_ITERATIONS and MAX_TOTAL_MEMORY_TRANSFER_FACTOR are arguable, but there should be *some* limit to force the final iteration of a live migration that does not converge.

No, there shouldn't be.

A management app can always stop a guest to force convergence.  If you 
make migration have unbounded downtime by default then you're making 
migration unsafe for smarter consumers.

You can already set things like maximum downtime to force convergence. 
If you wanted to have some logic like an exponentially increasing 
maximum downtime given a fixed timeout, that would be okay provided it 
was an optional feature.

So for instance, you could do something like:

downtime: defaults to 30ms

(qemu) migrate_set_convergence_timeout 60   # begin to enforce 
convergence after 1 minute

At 1 minutes, downtime goes to 60ms, at 2 minutes it goes to 120ms, at 3 
minutes it goes to 240ms, 4 minutes it goes to 480ms, 5 minutes it goes 
to 1.06s, 6 minutes it goes to 2s, etc.

Regards,

Anthony Liguori

> ---
>   arch_init.c |   10 +++++++++-
>   1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 4486925..57fcb1e 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -89,6 +89,9 @@ const uint32_t arch_type = QEMU_ARCH;
>   #define RAM_SAVE_FLAG_EOS      0x10
>   #define RAM_SAVE_FLAG_CONTINUE 0x20
>
> +#define MAX_MEMORY_ITERATIONS 10
> +#define MAX_TOTAL_MEMORY_TRANSFER_FACTOR 3
> +
>   static int is_dup_page(uint8_t *page, uint8_t ch)
>   {
>       uint32_t val = ch<<  24 | ch<<  16 | ch<<  8 | ch;
> @@ -107,6 +110,8 @@ static int is_dup_page(uint8_t *page, uint8_t ch)
>   static RAMBlock *last_block;
>   static ram_addr_t last_offset;
>
> +static int numberFullMemoryIterations = 0;
> +
>   static int ram_save_block(QEMUFile *f)
>   {
>       RAMBlock *block = last_block;
> @@ -158,7 +163,10 @@ static int ram_save_block(QEMUFile *f)
>               offset = 0;
>               block = QLIST_NEXT(block, next);
>               if (!block)
> +            {
> +                numberFullMemoryIterations++;
>                   block = QLIST_FIRST(&ram_list.blocks);
> +            }
>           }
>
>           current_addr = block->offset + offset;
> @@ -295,7 +303,7 @@ int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
>
>       expected_time = ram_save_remaining() * TARGET_PAGE_SIZE / bwidth;
>
> -    return (stage == 2)&&  (expected_time<= migrate_max_downtime());
> +    return (stage == 2)&&  ((expected_time<= migrate_max_downtime() || (numberFullMemoryIterations == MAX_MEMORY_ITERATIONS) || (bytes_transferred>  (MAX_TOTAL_MEMORY_TRANSFER_FACTOR*ram_bytes_total()))));
>   }
>
>   static inline void *host_from_stream_offset(QEMUFile *f,

  parent reply	other threads:[~2011-09-14 15:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-14 13:18 [Qemu-devel] [PATCH] A small patch to introduce stop conditions to the live migration Thomas Treutner
2011-09-14 15:22 ` Michael Roth
2011-09-14 15:36   ` Michael Roth
2011-09-14 15:45 ` Anthony Liguori [this message]
2011-09-15  8:27   ` Thomas Treutner
2011-09-15  9:35     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E70CC0F.3070905@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    --cc=thomas@scripty.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).