From: Luiz Capitulino <lcapitulino@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jan Kiszka <jan.kiszka@web.de>,
qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] runstate: do not discard runstate changes when paused
Date: Wed, 5 Oct 2011 11:37:07 -0300 [thread overview]
Message-ID: <20111005113707.5312f98b@doriath> (raw)
In-Reply-To: <1317729885-17534-1-git-send-email-pbonzini@redhat.com>
On Tue, 4 Oct 2011 14:04:45 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:
> Trying to migrate a paused machine fails. The reason is that
> the RSTATE_PRE_MIGRATE is reached with vm_stop, and this
> transition is eaten when the vm is already paused. This patch
> fixes the problem by always going through runstate_set and
> always notifying the new state.
Let's start over, this time CC'ing Jan, Anthony and Avi.
Basically, what Paolo is describing above is this:
1. The user issues the stop command. vm_stop() will set the state to
RSTATE_PAUSED
2. The user starts a migration. migrate_fd_put_ready() will call
vm_stop(RSTATE_PRE_MIGRATE). However, the VM is already stopped
so vm_stop() just returns (IOW, the state is still RSTATE_PAUSED)
3. The migration process completes. migrate_fd_put_ready() will now
call runstate_set(RSTATE_POST_MIGRATE), which in turn causes the
transition RSTATE_PAUSED -> RSTATE_POST_MIGRATE, which is invalid
and the world of qemu ends
Now, we have three options to fix this but I don't know which one to choose:
1. We could just add the transition RSTATE_PAUSED -> RSTATE_POST_MIGRATE
as valid. Not sure this is a good thing to do though, as it seems a silly
workaround for the fact that the transition to RSTATE_PRE_MIGRATE has
never occurred
2. This patch makes vm_stop() do the state transition even if the VM
is already stopped. Seems good enough, except that I fear two things.
First, today we know that vm_stop() is a no-op if the VM is already
stopped, so there's a semantic change that could turn out to be trap.
Second, I also fear people using vm_stop() as a way to change the
VM status, just like runstate_set() (which can also become an horrible
trap)
3. Avi suggested we should keep a reference count, so that states are
not discarded:
http://lists.gnu.org/archive/html/qemu-devel/2011-08/msg00595.html
That solution seemed to be the perfect one, except for one important
detail: how should we implement vm_start() (and thus 'cont')?
In order to maintain how we behave with the external world, the only
option is that vm_start() will set the stop count to 0. Ie, doesn't
matter if we have stopped the VM 500 times at some point, a vm_start()
call will discard all stored states.
Not sure if that's what you expected, but the first time I read Avi's
idea I had the impression that it would be a good idea that vm_start()
decremented the ref count only once, ie. vm_stop() and vm_start() calls
have to match.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> cpus.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/cpus.c b/cpus.c
> index 8978779..eab8ff6 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -128,6 +128,8 @@ static void do_vm_stop(RunState state)
> qemu_aio_flush();
> bdrv_flush_all();
> monitor_protocol_event(QEVENT_STOP, NULL);
> + } else {
> + runstate_set(state);
> }
> }
>
next prev parent reply other threads:[~2011-10-05 14:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-04 12:04 [Qemu-devel] [PATCH] runstate: do not discard runstate changes when paused Paolo Bonzini
2011-10-04 13:49 ` Luiz Capitulino
2011-10-04 14:09 ` Paolo Bonzini
2011-10-04 14:30 ` Luiz Capitulino
2011-10-05 14:37 ` Luiz Capitulino [this message]
2011-10-05 15:43 ` Avi Kivity
2011-10-05 15:44 ` Avi Kivity
2011-10-05 16:31 ` Jan Kiszka
2011-10-05 16:37 ` Avi Kivity
2011-10-05 16:49 ` Jan Kiszka
2011-10-05 17:12 ` Avi Kivity
2011-10-05 18:02 ` Jan Kiszka
2011-10-06 14:27 ` Avi Kivity
2011-10-06 15:08 ` Jan Kiszka
2011-10-05 17:02 ` Luiz Capitulino
2011-10-05 17:23 ` Avi Kivity
2011-10-05 17:39 ` Luiz Capitulino
2011-10-05 18:02 ` Avi Kivity
2011-10-05 18:49 ` Luiz Capitulino
2011-10-05 18:50 ` Luiz Capitulino
2011-10-06 11:14 ` Paolo Bonzini
2011-10-10 18:49 ` Luiz Capitulino
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=20111005113707.5312f98b@doriath \
--to=lcapitulino@redhat.com \
--cc=avi@redhat.com \
--cc=jan.kiszka@web.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.