From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: Steven Sistare <steven.sistare@oracle.com>,
qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>, Fabiano Rosas <farosas@suse.de>,
Leonardo Bras <leobras@redhat.com>
Subject: Re: [PATCH V5 02/12] cpus: stop vm in suspended state
Date: Wed, 22 Nov 2023 09:38:06 +0000 [thread overview]
Message-ID: <ZV3L_ihDoQOAsT44@redhat.com> (raw)
In-Reply-To: <ZVvTUuNYzGgFcg4m@x1n>
On Mon, Nov 20, 2023 at 04:44:50PM -0500, Peter Xu wrote:
> On Mon, Nov 20, 2023 at 03:55:54PM -0500, Steven Sistare wrote:
> > If we drop force, then all calls to vm_stop will completely stop the
> > suspended state, eg an hmp "stop" command. This causes two problems.
> > First, that is a change in user-visible behavior for something that
> > currently works,
>
> IMHO it depends on what should be the correct behavior. IOW, when VM is in
> SUSPENDED state and then the user sends "stop" QMP command, what should we
> expect?
I would say that from a mgmtm app POV "stop" is initiating a state
transition, from RUN_STATE_RUNNING to RUN_STATE_PAUSED and "cont"
is doing the reverse from PAUSED to RUNNING.
It is a little more complicated than that as there are some other
states like INMIGRATE that are conceptually equiv to RUNNING,
and states where the transition simply doesn't make sense.
So my question is if we're in "SUSPENDED" and someone issues "stop",
what state do we go into, and perhaps more importantly what state
do we go to in a subsequent "cont".
If you say SUSPENDED ---(stop)---> PAUSED ---(cont)---> SUSPENDED
then we create a problem, because the decision for the transition
out of PAUSED needs memory of the previous state.
> My understanding is we should expect to fully stop the VM, including the
> ticks, for example. Keeping the ticks running even after QMP "stop"
> doesn't sound right, isn't it?
The "stop" QMP command is documented as
"Stop all guest VCPU execution"
the devil is in the detail though, and we've not documented any detail.
Whether or not timers keep running across stop/cont I think can be
argued to be an impl detail, as long as the headline goal "vcpus
don't execute" is satisfied.
> > vs the migration code where we are fixing brokenness.
>
> This is not a migration-only bug if above holds, IMO.
>
> > Second, it does not quite work, because the state becomes
> > RUN_STATE_PAUSED, so the suspended state is forgotten, and the hmp "cont"
> > will try to set the running state. I could fix that by introducing a new
> > state RUN_STATE_SUSPENDED_STOPPED, but again it is a user-visible change
> > in existing behavior. (I even implemented that while developing, then I
> > realized it was not needed to fix the migration bugs.)
>
> Good point.
We have added new guest states periodically. It is a user visible
change, but you could argue that it is implementing a new feature
ie the ability to "stop" a "suspended" guest, and so is justified.
S3 is so little used in virt, so I'm not surprised we're finding
long standing edge cases that have never been thought about before.
> Now with above comments, what's your thoughts on whether we should change
> the user behavior? My answer is still a yes.
>
> Maybe SUSPENDED should not be a RunState at all? SUSPENDED is guest visible
> behavior, while something like QMP "stop" is not guest visible. Maybe we
> should remember it separately?
Yes, every time I look at this area I come away thinking that
the RunState enum is a mess, overloading too many different
concepts onto the same single field.
Specifically "SUSPENDED" vs "RUNNING" is a reflection of guest
state (ie whether or not the VM is in S3), but pretty much all
the others are a reflection of QEMU host state. I kind of feel
that SUSPENDED (S3) probably shouldn't have been a RunState at
all. I'd probably put guest-panicked into a separate thing too.
But we're stuck with what we have.
> It means qemu_system_suspend() could remember that in a separate field (as
> part of guest state), then when wakeup we should conditionally go back
> with/without vcpus running depending on the new "suspended" state.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2023-11-22 9:38 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 18:33 [PATCH V5 00/12] fix migration of suspended runstate Steve Sistare
2023-11-13 18:33 ` [PATCH V5 01/12] cpus: refactor vm_stop Steve Sistare
2023-11-20 13:22 ` Fabiano Rosas
2023-11-20 19:09 ` Steven Sistare
2023-11-20 19:46 ` Peter Xu
2023-11-20 19:49 ` Steven Sistare
2023-11-20 20:01 ` Fabiano Rosas
2023-11-13 18:33 ` [PATCH V5 02/12] cpus: stop vm in suspended state Steve Sistare
2023-11-20 14:15 ` Fabiano Rosas
2023-11-20 19:10 ` Steven Sistare
2023-11-20 19:59 ` Peter Xu
2023-11-20 20:47 ` Fabiano Rosas
2023-11-20 21:26 ` Steven Sistare
2023-11-20 20:55 ` Steven Sistare
2023-11-20 21:44 ` Peter Xu
2023-11-21 21:21 ` Steven Sistare
2023-11-21 22:47 ` Peter Xu
2023-11-22 9:38 ` Daniel P. Berrangé [this message]
2023-11-22 16:21 ` Peter Xu
2023-11-28 13:26 ` Steven Sistare
2023-11-13 18:33 ` [PATCH V5 03/12] cpus: pass runstate to vm_prepare_start Steve Sistare
2023-11-13 18:33 ` [PATCH V5 04/12] cpus: start vm in suspended state Steve Sistare
2023-11-20 17:20 ` Fabiano Rosas
2023-11-13 18:33 ` [PATCH V5 05/12] migration: preserve suspended runstate Steve Sistare
2023-11-20 17:30 ` Fabiano Rosas
2023-11-13 18:33 ` [PATCH V5 06/12] migration: preserve suspended for snapshot Steve Sistare
2023-11-20 18:13 ` Fabiano Rosas
2023-11-20 19:10 ` Steven Sistare
2023-11-13 18:33 ` [PATCH V5 07/12] migration: preserve suspended for bg_migration Steve Sistare
2023-11-20 18:18 ` Fabiano Rosas
2023-11-13 18:33 ` [PATCH V5 08/12] tests/qtest: migration events Steve Sistare
2023-11-13 18:33 ` [PATCH V5 09/12] tests/qtest: option to suspend during migration Steve Sistare
2023-11-13 18:33 ` [PATCH V5 10/12] tests/qtest: precopy migration with suspend Steve Sistare
2023-11-13 18:33 ` [PATCH V5 11/12] tests/qtest: postcopy " Steve Sistare
2023-11-13 18:34 ` [PATCH V5 12/12] tests/qtest: background " Steve Sistare
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=ZV3L_ihDoQOAsT44@redhat.com \
--to=berrange@redhat.com \
--cc=farosas@suse.de \
--cc=leobras@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=steven.sistare@oracle.com \
--cc=thuth@redhat.com \
/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).