qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: Lei Li <lilei@linux.vnet.ibm.com>
Cc: anthony@codemonkey.ws, pbonzini@redhat.com,
	qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 3/3 resend v2] arch_init: right return for ram_save_iterate
Date: Wed, 11 Sep 2013 11:17:22 +0200	[thread overview]
Message-ID: <877gen3efx.fsf@elfo.elfo> (raw)
In-Reply-To: <1378285356-5308-4-git-send-email-lilei@linux.vnet.ibm.com> (Lei Li's message of "Wed, 4 Sep 2013 17:02:36 +0800")

Lei Li <lilei@linux.vnet.ibm.com> wrote:
> qemu_file_rate_limit() never return negative value since the refactor
> by Commit 1964a39, this patch gets rid of the negative check for it,
> adjust bytes_transferred and return value correspondingly in 
> ram_save_iterate().
>
> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>
> Change since v1:
>   Return fixes and improvement from Paolo Bonzini.
>   
>  arch_init.c |   15 ++++++++++-----
>  1 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 94d45e1..a26bc89 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -709,15 +709,20 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
>       */
>      ram_control_after_iterate(f, RAM_CONTROL_ROUND);
>  
> +    bytes_transferred += total_sent;

Agreed.

> +
> +    /*
> +     * Do not count these 8 bytes into total_sent, so that we can
> +     * return 0 if no page had been dirtied.
> +     */
> +    qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
> +    bytes_transferred += 8;
> +
> +    ret = qemu_file_get_error(f);
>      if (ret < 0) {

Not sure this is the right solution.

We are sending anyways RAM_SAVE_FLAG_EOS.

And I think that the right solution is make qemu_get_rate_limit() to
return -1 in case of error (or the error, I don't care).  Looking at the
callers:


migration.c::migration_thread()

we check for error when we qemu_file_rate_limit() returns != 0.  Well.

second call:

        if (qemu_file_rate_limit(s->file)) {
            /* usleep expects microseconds */
            g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
        }


if should be:

    if (qemu_file_rate_limit(s->file) == 1)

block_migration: not correct, we don't check for the error.

arch_init.c:

   check is correct, but we need to return -ERROR in case of errors.

hw/ppc/spapr.c:
   will work correctly even if changed to -ERROR.


savevm.c: qemu_savevm_state_iterate()


        if (qemu_file_rate_limit(f)) {
            return 0;
        }


check is incorrect again, we should return an error if there is one
error.


I think that returning qemu_rate_limit() to return 0/1/negative makes sense.

Thoughts?

Thanks, Juan.

  reply	other threads:[~2013-09-11  9:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04  9:02 [Qemu-devel] [PATCH 0/3 resend v2] Migration fix Lei Li
2013-09-04  9:02 ` [Qemu-devel] [PATCH 1/3 resend v2] savevm: add comments for qemu_file_get_error() Lei Li
2013-09-11  8:52   ` Juan Quintela
2013-09-04  9:02 ` [Qemu-devel] [PATCH 2/3 resend v2] savevm: fix wrong initialization by ram_control_load_hook Lei Li
2013-09-04  9:02 ` [Qemu-devel] [PATCH 3/3 resend v2] arch_init: right return for ram_save_iterate Lei Li
2013-09-11  9:17   ` Juan Quintela [this message]
2013-09-11  9:32     ` Paolo Bonzini
2013-09-11 11:06       ` Juan Quintela
2013-09-11 11:27         ` Paolo Bonzini
2013-09-12  7:11           ` Lei Li
2013-09-12  7:47           ` Orit Wasserman
2013-09-04 12:49 ` [Qemu-devel] [PATCH 0/3 resend v2] Migration fix Orit Wasserman

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=877gen3efx.fsf@elfo.elfo \
    --to=quintela@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=lilei@linux.vnet.ibm.com \
    --cc=mrhines@linux.vnet.ibm.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).