From: Jan Kiszka <jan.kiszka@web.de>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: "kwolf@redhat.com" <kwolf@redhat.com>,
"amit.shah@redhat.com" <amit.shah@redhat.com>,
"aliguori@us.ibm.com" <aliguori@us.ibm.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"armbru@redhat.com" <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/8] RunState: Add additional states
Date: Thu, 01 Sep 2011 22:58:51 +0200 [thread overview]
Message-ID: <4E5FF20B.5030504@web.de> (raw)
In-Reply-To: <20110901153917.112c5428@doriath>
[-- Attachment #1: Type: text/plain, Size: 1909 bytes --]
On 2011-09-01 20:39, Luiz Capitulino wrote:
> On Thu, 01 Sep 2011 20:30:57 +0200
> Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
>> On 2011-09-01 20:12, Luiz Capitulino wrote:
>>> Currently, only vm_start() and vm_stop() change the VM state.
>>> That's, the state is only changed when starting or stopping the VM.
>>>
>>> This commit adds the runstate_set() function, which makes it possible
>>> to also do state transitions when the VM is stopped or running.
>>>
>>> Additional states are also added and the current state is stored.
>>>
>>> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
>>> ---
>>> cpus.c | 1 +
>>> migration.c | 8 +++++++-
>>> sysemu.h | 10 +++++++++-
>>> vl.c | 20 ++++++++++++++++++++
>>> 4 files changed, 37 insertions(+), 2 deletions(-)
>>>
>>
>> ...
>>
>>> diff --git a/vl.c b/vl.c
>>> index f0b56a4..59f71fc 100644
>>> --- a/vl.c
>>> +++ b/vl.c
>>> @@ -321,6 +321,22 @@ static int default_driver_check(QemuOpts *opts, void *opaque)
>>> }
>>>
>>> /***********************************************************/
>>> +/* QEMU state */
>>> +
>>> +static RunState current_run_state = RSTATE_NO_STATE;
>>> +
>>> +bool runstate_check(RunState state)
>>> +{
>>> + return current_run_state == state;
>>> +}
>>> +
>>> +void runstate_set(RunState state)
>>> +{
>>> + assert(state < RSTATE_MAX);
>>> + current_run_state = state;
>>
>> I still think this should check for valid state transitions instead of
>> blindly accepting what the caller passes in.
>
> I thought your comment where more like a future enhancement than
> a request for change.
I think we want this now to document at a central place which
transitions are valid and which not. State machines without such checks
break sooner or later, subtly.
>
> What to do if the transition is invalid? abort()?
Yes.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2011-09-01 20:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-01 18:12 [Qemu-devel] [PATCH v3 0/8]: Introduce the RunState type Luiz Capitulino
2011-09-01 18:12 ` [Qemu-devel] [PATCH 1/8] Move vm_state_notify() prototype from cpus.h to sysemu.h Luiz Capitulino
2011-09-01 18:12 ` [Qemu-devel] [PATCH 2/8] Replace the VMSTOP macros with a proper state type Luiz Capitulino
2011-09-01 18:12 ` [Qemu-devel] [PATCH 3/8] RunState: Add additional states Luiz Capitulino
2011-09-01 18:30 ` Jan Kiszka
2011-09-01 18:39 ` Luiz Capitulino
2011-09-01 20:58 ` Jan Kiszka [this message]
2011-09-02 14:28 ` Luiz Capitulino
2011-09-02 14:32 ` Jan Kiszka
2011-09-02 14:34 ` Luiz Capitulino
2011-09-06 13:17 ` Luiz Capitulino
2011-09-01 18:12 ` [Qemu-devel] [PATCH 4/8] Drop the incoming_expected global variable Luiz Capitulino
2011-09-01 18:12 ` [Qemu-devel] [PATCH 5/8] Drop the vm_running " Luiz Capitulino
2011-09-01 18:12 ` [Qemu-devel] [PATCH 6/8] Monitor/QMP: Don't allow cont on bad VM state Luiz Capitulino
2011-09-01 18:12 ` [Qemu-devel] [PATCH 7/8] QMP: query-status: Introduce 'status' key Luiz Capitulino
2011-09-01 18:12 ` [Qemu-devel] [PATCH 8/8] HMP: info status: Print the VM state Luiz Capitulino
-- strict thread matches above, loose matches on Subject: below --
2011-08-10 20:33 [Qemu-devel] [PATCH v2 0/8]: Introduce the RunState type Luiz Capitulino
2011-08-10 20:33 ` [Qemu-devel] [PATCH 3/8] RunState: Add additional states 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=4E5FF20B.5030504@web.de \
--to=jan.kiszka@web.de \
--cc=aliguori@us.ibm.com \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@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).