qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH f0r 2.11] runstate/migrate: Two more transitions


From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH f0r 2.11] runstate/migrate: Two more transitions
Date: Tue, 8 Aug 2017 15:13:55 +0800
User-agent: Mutt/1.5.24 (2015-08-30)

On Tue, Aug 08, 2017 at 09:02:54AM +0200, Juan Quintela wrote:
> "Dr. David Alan Gilbert (git)" <address@hidden> wrote:
> > From: "Dr. David Alan Gilbert" <address@hidden>
> >
> > 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 <address@hidden>
> 
> Reviewed-by: Juan Quintela <address@hidden>
> 
> 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".

Thanks for the details. :)

-- 
Peter Xu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]