qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: arei.gonglei@huawei.com
Cc: ChenLiang <chenliang88@huawei.com>,
	qemu-devel@nongnu.org, dgilbert@redhat.com, owasserm@redhat.com,
	pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH] migration: static variables will not be reset at second migration
Date: Fri, 21 Mar 2014 14:25:46 +0100	[thread overview]
Message-ID: <87vbv7heed.fsf@elfo.mitica> (raw)
In-Reply-To: <1395317703-10412-1-git-send-email-arei.gonglei@huawei.com> (arei gonglei's message of "Thu, 20 Mar 2014 20:15:03 +0800")

<arei.gonglei@huawei.com> wrote:
> From: ChenLiang <chenliang88@huawei.com>
>
> The static variables in migration_bitmap_sync will not be reset in
> the case of a second attempted migration.
>
> Signed-off-by: ChenLiang <chenliang88@huawei.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>

Good catch.  Applied..

> ---
>  arch_init.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 60c975d..10516cb 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -468,15 +468,23 @@ static void migration_bitmap_sync_range(ram_addr_t start, ram_addr_t length)
>  
>  
>  /* Needs iothread lock! */
> +/* Fix me: there are too many global variables used in migration process. */
> +static int64_t start_time;
> +static int64_t bytes_xfer_prev;
> +static int64_t num_dirty_pages_period;
> +
> +static void migration_bitmap_sync_init(void)
> +{
> +    start_time = 0;
> +    bytes_xfer_prev = 0;
> +    num_dirty_pages_period = 0;
> +}
>  
>  static void migration_bitmap_sync(void)
>  {
>      RAMBlock *block;
>      uint64_t num_dirty_pages_init = migration_dirty_pages;
>      MigrationState *s = migrate_get_current();
> -    static int64_t start_time;
> -    static int64_t bytes_xfer_prev;
> -    static int64_t num_dirty_pages_period;
>      int64_t end_time;
>      int64_t bytes_xfer_now;
>  
> @@ -733,6 +741,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
>      migration_dirty_pages = ram_pages;
>      mig_throttle_on = false;
>      dirty_rate_high_cnt = 0;
> +    migration_bitmap_sync_init();
>  
>      if (migrate_use_xbzrle()) {
>          qemu_mutex_lock_iothread();

  parent reply	other threads:[~2014-03-21 13:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 12:15 [Qemu-devel] [PATCH] migration: static variables will not be reset at second migration arei.gonglei
2014-03-21 13:25 ` Juan Quintela
2014-03-21 13:25 ` Juan Quintela [this message]
2014-05-15 11:33   ` Gonglei (Arei)
2014-06-24  6:23   ` Gonglei (Arei)
2014-11-20 11:30     ` Paolo Bonzini
2014-11-20 11:39       ` Gonglei
2014-11-20 12:30         ` Amit Shah
2014-11-20 12:35           ` Dr. David Alan Gilbert
2014-11-20 13:00             ` Amit Shah
2014-11-20 13:05               ` Gonglei
2014-11-20 12:31       ` Dr. David Alan Gilbert

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=87vbv7heed.fsf@elfo.mitica \
    --to=quintela@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=chenliang88@huawei.com \
    --cc=dgilbert@redhat.com \
    --cc=owasserm@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).