From: Markus Armbruster <armbru@redhat.com>
To: Hu Tao <hutao@cn.fujitsu.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Gleb Natapov <gleb@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
qemu-devel <qemu-devel@nongnu.org>,
Luiz Capitulino <lcapitulino@redhat.com>,
Blue Swirl <blauwirbel@gmail.com>,
Orit Wasserman <owasserm@redhat.com>,
Juan Quintela <quintela@redhat.com>,
Alexander Graf <agraf@suse.de>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Andrew Jones <drjones@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Sasha Levin <levinsasha928@gmail.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Kevin Wolf <kwolf@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v14 1/4] add a new runstate: RUN_STATE_GUEST_PANICKED
Date: Wed, 20 Mar 2013 12:07:53 +0100 [thread overview]
Message-ID: <87obeeib1y.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <87y5dimorn.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Wed, 20 Mar 2013 09:58:04 +0100")
Markus Armbruster <armbru@redhat.com> writes:
> Hu Tao <hutao@cn.fujitsu.com> writes:
>
>> The guest will be in this state when it is panicked.
>>
>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
>> ---
>> include/sysemu/sysemu.h | 1 +
>> qapi-schema.json | 5 ++++-
>> qmp.c | 3 +--
>> vl.c | 13 +++++++++++--
>> 4 files changed, 17 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
>> index b19ec95..0412a8a 100644
>> --- a/include/sysemu/sysemu.h
>> +++ b/include/sysemu/sysemu.h
>> @@ -22,6 +22,7 @@ int qemu_uuid_parse(const char *str, uint8_t *uuid);
>> bool runstate_check(RunState state);
>> void runstate_set(RunState new_state);
>> int runstate_is_running(void);
>> +bool runstate_needs_reset(void);
>> typedef struct vm_change_state_entry VMChangeStateEntry;
>> typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
>>
>> diff --git a/qapi-schema.json b/qapi-schema.json
>> index 28b070f..003cbf2 100644
>> --- a/qapi-schema.json
>> +++ b/qapi-schema.json
>> @@ -174,11 +174,14 @@
>> # @suspended: guest is suspended (ACPI S3)
>> #
>> # @watchdog: the watchdog action is configured to pause and has been triggered
>> +#
>> +# @guest-panicked: guest has been panicked as a result of guest OS panic
>> ##
>> { 'enum': 'RunState',
>> 'data': [ 'debug', 'inmigrate', 'internal-error', 'io-error', 'paused',
>> 'postmigrate', 'prelaunch', 'finish-migrate', 'restore-vm',
>> - 'running', 'save-vm', 'shutdown', 'suspended', 'watchdog' ] }
>> + 'running', 'save-vm', 'shutdown', 'suspended', 'watchdog',
>> + 'guest-panicked' ] }
>>
>> ##
>> # @SnapshotInfo
>
> RUN_STATE_GUEST_PANICKED is similar to RUN_STATE_INTERNAL_ERROR and
> RUN_STATE_SHUTDOWN: the only way for the guest to continue is reset.
> Correct?
>
>> diff --git a/qmp.c b/qmp.c
>> index 55b056b..a1ebb5d 100644
>> --- a/qmp.c
>> +++ b/qmp.c
>> @@ -149,8 +149,7 @@ void qmp_cont(Error **errp)
>> {
>> Error *local_err = NULL;
>>
>> - if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
>> - runstate_check(RUN_STATE_SHUTDOWN)) {
>> + if (runstate_needs_reset()) {
>> error_set(errp, QERR_RESET_REQUIRED);
>> return;
>> } else if (runstate_check(RUN_STATE_SUSPENDED)) {
>> diff --git a/vl.c b/vl.c
>> index c03edf1..926822b 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -566,6 +566,7 @@ static const RunStateTransition runstate_transitions_def[] = {
>> { RUN_STATE_RUNNING, RUN_STATE_SAVE_VM },
>> { RUN_STATE_RUNNING, RUN_STATE_SHUTDOWN },
>> { RUN_STATE_RUNNING, RUN_STATE_WATCHDOG },
>> + { RUN_STATE_RUNNING, RUN_STATE_GUEST_PANICKED },
>>
>> { RUN_STATE_SAVE_VM, RUN_STATE_RUNNING },
>>
>
> This permits runstate_set(RUN_STATE_GUEST_PANICKED) in
> RUN_STATE_RUNNING. Used in PATCH 3/4. Good.
>
>> @@ -580,6 +581,8 @@ static const RunStateTransition runstate_transitions_def[] = {
>> { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING },
>> { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE },
>>
>> + { RUN_STATE_GUEST_PANICKED, RUN_STATE_PAUSED },
>> +
>> { RUN_STATE_MAX, RUN_STATE_MAX },
>> };
>
> This permits runstate_set(RUN_STATE_PAUSED) in RUN_STATE_GUEST_PANICKED.
> An example for such a transition is in the last patch hunk: main loop
> resetting the guest.
>
> Let's examine the other transitions to RUN_STATE_PAUSED, and whether
> they can now come from RUN_STATE_GUEST_PANICKED:
>
> * gdb_read_byte()
>
> No, because vm_stop() is protected by runstate_is_running() here.
>
> * gdb_chr_event() case CHR_EVENT_OPENED
>
> Can this happen in RUN_STATE_GUEST_PANICKED? Jan?
>
> What about RUN_STATE_INTERNAL_ERROR and RUN_STATE_SHUTDOWN?
Nevermind this one. Like for qmp_stop() below, the actual state
transition is protected by runstate_is_running().
> * gdb_sigterm_handler()
>
> No, because vm_stop() is protected by runstate_is_running() here.
>
> Aside: despite its name, this function handles SIGINT. Ugh.
>
> * process_incoming_migration_co()
>
> No, because we're in RUN_STATE_INMIGRATE here, aren't we? Juan?
>
> * qmp_stop()
>
> No, because vm_stop() calls do_vm_stop() to do the actual state
> transition, which protects it by runstate_is_running().
>
> We can ignore the conditional, it merely punts the vm_stop() to the
> main loop.
[...]
next prev parent reply other threads:[~2013-03-20 11:08 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-14 8:15 [Qemu-devel] [PATCH v14 0/4] pvevent device to deal with guest panic event Hu Tao
2013-03-14 8:15 ` [Qemu-devel] [PATCH v14 1/4] add a new runstate: RUN_STATE_GUEST_PANICKED Hu Tao
2013-03-20 8:58 ` Markus Armbruster
2013-03-20 10:54 ` Paolo Bonzini
2013-03-20 11:07 ` Markus Armbruster [this message]
2013-03-14 8:15 ` [Qemu-devel] [PATCH v14 2/4] add a new qevent: QEVENT_GUEST_PANICKED Hu Tao
2013-03-20 9:04 ` Markus Armbruster
2013-03-14 8:15 ` [Qemu-devel] [PATCH v14 3/4] introduce pvevent device to deal with panicked event Hu Tao
2013-03-14 9:14 ` Paolo Bonzini
2013-03-14 9:19 ` Gleb Natapov
2013-03-14 9:43 ` Paolo Bonzini
2013-03-14 11:00 ` Alexander Graf
2013-03-14 11:03 ` Paolo Bonzini
2013-03-14 11:23 ` Alexander Graf
2013-03-14 11:28 ` Gleb Natapov
2013-03-20 9:24 ` Markus Armbruster
2013-03-14 12:34 ` Gleb Natapov
2013-03-14 13:49 ` Paolo Bonzini
2013-03-14 13:56 ` Gleb Natapov
2013-03-14 14:05 ` Paolo Bonzini
2013-03-14 14:23 ` Gleb Natapov
2013-03-14 15:50 ` Paolo Bonzini
2013-03-14 15:59 ` Gleb Natapov
2013-03-14 16:13 ` Paolo Bonzini
2013-03-15 11:34 ` Gleb Natapov
2013-03-20 9:16 ` Markus Armbruster
2013-03-14 9:46 ` Hu Tao
2013-03-20 9:15 ` Markus Armbruster
2013-03-14 8:15 ` [Qemu-devel] [PATCH v14 4/4] pvevent: add document to describe the usage Hu Tao
2013-03-14 8:45 ` Paolo Bonzini
2013-03-14 9:35 ` Hu Tao
2013-03-14 20:35 ` Eric Blake
2013-03-14 8:58 ` [Qemu-devel] [PATCH v14 0/4] pvevent device to deal with guest panic event Gleb Natapov
2013-03-14 9:36 ` Hu Tao
2013-03-20 9:29 ` Markus Armbruster
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=87obeeib1y.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=agraf@suse.de \
--cc=alex.williamson@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=borntraeger@de.ibm.com \
--cc=drjones@redhat.com \
--cc=gleb@redhat.com \
--cc=hutao@cn.fujitsu.com \
--cc=jan.kiszka@siemens.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=levinsasha928@gmail.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=owasserm@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@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 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.