All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Lukáš Doktor" <ldoktor@redhat.com>,
	qemu-devel@nongnu.org, "Igor Mammedov" <imammedo@redhat.com>
Subject: Re: [PATCH] runstate: ignore exit request in finish migrate state
Date: Tue, 22 Oct 2019 12:55:07 +0200	[thread overview]
Message-ID: <87zhhthwxg.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20191022101015.GD2815@work-vm> (David Alan Gilbert's message of "Tue, 22 Oct 2019 11:10:15 +0100")

"Dr. David Alan Gilbert" <dgilbert@redhat.com> writes:

> * Paolo Bonzini (pbonzini@redhat.com) wrote:
>> On 17/10/19 12:18, Laurent Vivier wrote:
>> > Trying to reboot a VM while a migration is running can
>> > move to the prelaunch state (because of the reset) while
>> > the runstate is in finish migrate state.
>> > As the logical step after the finish migrate is postmigrate,
>> > this can create an invalid state transition from prelaunch state
>> > to postmigrate state and this raises an error and aborts:
>> > 
>> >     invalid runstate transition: 'prelaunch' -> 'postmigrate'
>> > 
>> > As we are not able to manage reset in finish migrate state the
>> > best we can do is to ignore any changes and delay them until
>> > the next state which should be postmigrate and which should allow
>> > this kind of transition.
>> > 
>> > Reported-by: Lukáš Doktor <ldoktor@redhat.com>
>> > Suggested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> > ---
>> >  vl.c | 3 +++
>> >  1 file changed, 3 insertions(+)
>> > 
>> > diff --git a/vl.c b/vl.c
>> > index 0a295e5d77d6..dc71c822ba24 100644
>> > --- a/vl.c
>> > +++ b/vl.c
>> > @@ -1744,6 +1744,9 @@ static bool main_loop_should_exit(void)
>> >      RunState r;
>> >      ShutdownCause request;
>> >  
>> > +    if (runstate_check(RUN_STATE_FINISH_MIGRATE)) {
>> > +        return false;
>> > +    }
>> >      if (preconfig_exit_requested) {
>> >          if (runstate_check(RUN_STATE_PRECONFIG)) {
>> >              runstate_set(RUN_STATE_PRELAUNCH);
>> > 
>> 
>> Your patch makes sense, but I don't understand this function very much.
>>  In particular I don't understand why it returns true when
>> preconfig_exit_requested is true.  Wouldn't that cause main_loop() and
>> thus QEMU to exit?  Igor, can you help?
>
> It's because we now run main_loop() twice; once in the preconfig state
> and once the main main loop.
>
>
> 4323     /* do monitor/qmp handling at preconfig state if requested */
> 4324     main_loop();
>
> ....
>
> 4452     os_setup_post();
> 4453 
> 4454     main_loop();
> 4455 
> 4456     gdbserver_cleanup();

Commit 047f7038f5 "cli: add --preconfig option"

The whole thing is (in my opinion) a cheap hack we accepted for want of
better ideas we could get done in time.  Sometimes you have to hold you
nose and deliver.

https://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg05584.html



  reply	other threads:[~2019-10-22 10:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 10:18 [PATCH] runstate: ignore exit request in finish migrate state Laurent Vivier
2019-10-22  8:01 ` Paolo Bonzini
2019-10-22 10:10   ` Dr. David Alan Gilbert
2019-10-22 10:55     ` Markus Armbruster [this message]
2019-10-22 11:06 ` 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=87zhhthwxg.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=ldoktor@redhat.com \
    --cc=lvivier@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 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.