qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, peterx@redhat.com, lvivier@redhat.com,
	pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH f0r 2.11] runstate/migrate: Two more transitions
Date: Tue, 08 Aug 2017 09:02:54 +0200	[thread overview]
Message-ID: <874ltiee3l.fsf@secure.mitica> (raw)
In-Reply-To: <20170804175011.21944-1-dgilbert@redhat.com> (David Alan Gilbert's message of "Fri, 4 Aug 2017 18:50:11 +0100")

"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> There's a race if someone does a 'stop' near the end of migrate;
> the migration process goes through two runstates:
>     'finish migrate'
>     'postmigrate'
>
> If the user issues a 'stop' between the two we end up with invalid
> state transitions.
> Add the transitions as valid.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

To answer Peter question:

int vm_stop(RunState state)
{
    .... we don't care about this case ....

    return do_vm_stop(state);
}

static int do_vm_stop(RunState state)
{
    int ret = 0;

    if (runstate_is_running()) {
        cpu_disable_ticks();
        pause_all_vcpus();
        runstate_set(state);
        vm_state_notify(0, state);
        qapi_event_send_stop(&error_abort);
    }

    bdrv_drain_all();
    replay_disable_events();
    ret = bdrv_flush_all();

    return ret;
}


int runstate_is_running(void)
{
    return runstate_check(RUN_STATE_RUNNING);
}


So, "stop" only changes states when we are in RUNNING state.
The idea was that after migration, the only valid command (as in the
film "it should do something")is "run".

Later, Juan.

  parent reply	other threads:[~2017-08-08  7:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 17:50 [Qemu-devel] [PATCH f0r 2.11] runstate/migrate: Two more transitions Dr. David Alan Gilbert (git)
2017-08-07  7:21 ` Peter Xu
2017-08-07 12:25   ` Dr. David Alan Gilbert
2017-08-08  1:59     ` Peter Xu
2017-08-08  7:02 ` Juan Quintela [this message]
2017-08-08  7:13   ` Peter Xu
2017-09-06 13:40 ` Dr. David Alan Gilbert
2017-09-09 13:57   ` 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=874ltiee3l.fsf@secure.mitica \
    --to=quintela@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@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).