qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hu Tao <hutao@cn.fujitsu.com>
To: kvm list <kvm@vger.kernel.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Avi Kivity <avi@redhat.com>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Gleb Natapov <gleb@redhat.com>, Blue Swirl <blauwirbel@gmail.com>,
	Eric Blake <eblake@redhat.com>, Andrew Jones <drjones@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Sasha Levin <levinsasha928@gmail.com>,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH v12 4/8] add a new runstate: RUN_STATE_GUEST_PANICKED
Date: Wed, 12 Dec 2012 14:13:47 +0800	[thread overview]
Message-ID: <771dbb5849089a8e81c78a14004d143dbaa2a1eb.1355290850.git.hutao@cn.fujitsu.com> (raw)
In-Reply-To: <cover.1355290850.git.hutao@cn.fujitsu.com>

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>
---
 migration.c      |  1 +
 qapi-schema.json |  6 +++++-
 qmp.c            |  3 ++-
 vl.c             | 11 ++++++++++-
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/migration.c b/migration.c
index 31fa300..9122dca 100644
--- a/migration.c
+++ b/migration.c
@@ -345,6 +345,7 @@ void migrate_fd_put_ready(MigrationState *s)
         int64_t start_time, end_time;
 
         DPRINTF("done iterating\n");
+        save_run_state();
         start_time = qemu_get_clock_ms(rt_clock);
         qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
         vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
diff --git a/qapi-schema.json b/qapi-schema.json
index 542e3ac..5fd4ae8 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -174,11 +174,15 @@
 # @suspended: guest is suspended (ACPI S3)
 #
 # @watchdog: the watchdog action is configured to pause and has been triggered
+#
+# @guest-panicked: the panicked action is configured to pause and has been
+# triggered.
 ##
 { '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
diff --git a/qmp.c b/qmp.c
index bcd7229..2c590e4 100644
--- a/qmp.c
+++ b/qmp.c
@@ -149,7 +149,8 @@ void qmp_cont(Error **errp)
     Error *local_err = NULL;
 
     if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
-               runstate_check(RUN_STATE_SHUTDOWN)) {
+            runstate_check(RUN_STATE_SHUTDOWN) ||
+            runstate_check(RUN_STATE_GUEST_PANICKED)) {
         error_set(errp, QERR_RESET_REQUIRED);
         return;
     } else if (runstate_check(RUN_STATE_SUSPENDED)) {
diff --git a/vl.c b/vl.c
index 69fca16..30d6e58 100644
--- a/vl.c
+++ b/vl.c
@@ -344,6 +344,7 @@ static const RunStateTransition runstate_transitions_def[] = {
 
     { RUN_STATE_INMIGRATE, RUN_STATE_RUNNING },
     { RUN_STATE_INMIGRATE, RUN_STATE_PAUSED },
+    { RUN_STATE_INMIGRATE, RUN_STATE_GUEST_PANICKED },
 
     { RUN_STATE_INTERNAL_ERROR, RUN_STATE_RUNNING },
     { RUN_STATE_INTERNAL_ERROR, RUN_STATE_FINISH_MIGRATE },
@@ -357,6 +358,7 @@ static const RunStateTransition runstate_transitions_def[] = {
     { RUN_STATE_POSTMIGRATE, RUN_STATE_RUNNING },
     { RUN_STATE_POSTMIGRATE, RUN_STATE_PAUSED },
     { RUN_STATE_POSTMIGRATE, RUN_STATE_FINISH_MIGRATE },
+    { RUN_STATE_POSTMIGRATE, RUN_STATE_GUEST_PANICKED },
 
     { RUN_STATE_PRELAUNCH, RUN_STATE_RUNNING },
     { RUN_STATE_PRELAUNCH, RUN_STATE_FINISH_MIGRATE },
@@ -367,6 +369,7 @@ static const RunStateTransition runstate_transitions_def[] = {
 
     { RUN_STATE_RESTORE_VM, RUN_STATE_RUNNING },
     { RUN_STATE_RESTORE_VM, RUN_STATE_PAUSED },
+    { RUN_STATE_RESTORE_VM, RUN_STATE_GUEST_PANICKED },
 
     { RUN_STATE_RUNNING, RUN_STATE_DEBUG },
     { RUN_STATE_RUNNING, RUN_STATE_INTERNAL_ERROR },
@@ -377,6 +380,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 },
 
@@ -391,6 +395,10 @@ 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_RUNNING },
+    { RUN_STATE_GUEST_PANICKED, RUN_STATE_PAUSED },
+    { RUN_STATE_GUEST_PANICKED, RUN_STATE_FINISH_MIGRATE },
+
     { RUN_STATE_MAX, RUN_STATE_MAX },
 };
 
@@ -1769,7 +1777,8 @@ static bool main_loop_should_exit(void)
         qemu_system_reset(VMRESET_REPORT);
         resume_all_vcpus();
         if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
-            runstate_check(RUN_STATE_SHUTDOWN)) {
+            runstate_check(RUN_STATE_SHUTDOWN) ||
+            runstate_check(RUN_STATE_GUEST_PANICKED)) {
             bdrv_iterate(iostatus_bdrv_it, NULL);
             vm_start();
         }
-- 
1.8.0.1.240.ge8a1f5a

  parent reply	other threads:[~2012-12-12  6:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12  6:13 [Qemu-devel] [PATCH v12 0/8] pv event to notify host when the guest is panicked Hu Tao
2012-12-12  6:13 ` [Qemu-devel] [PATCH v12 1/8] save/load cpu runstate Hu Tao
2012-12-12  6:13 ` [Qemu-devel] [PATCH v12 2/8] start vm after resetting it Hu Tao
2012-12-12  6:13 ` [Qemu-devel] [PATCH v12 3/8] update kernel headers Hu Tao
2012-12-12  6:13 ` Hu Tao [this message]
2012-12-12  6:13 ` [Qemu-devel] [PATCH v12 5/8] add a new qevent: QEVENT_GUEST_PANICKED Hu Tao
2012-12-12  6:13 ` [Qemu-devel] [PATCH v12 6/8] introduce a new qom device to deal with panicked event Hu Tao
2012-12-12  6:13 ` [Qemu-devel] [PATCH v12 7/8] allower the user to disable pv event support Hu Tao
2012-12-12  6:13 ` [Qemu-devel] [PATCH v12 8/8] pv event: add document to describe the usage Hu Tao
2012-12-12  6:15 ` [Qemu-devel] [PATCH] kvm: notify host when the guest is panicked Hu Tao
2012-12-20  7:53 ` [Qemu-devel] [PATCH v12 0/8] pv event to " Hu Tao
2012-12-25 21:52   ` Marcelo Tosatti
2013-01-14  7:38     ` Hu Tao
2012-12-25 21:54   ` Marcelo Tosatti
2013-01-14  7:46     ` Hu Tao

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=771dbb5849089a8e81c78a14004d143dbaa2a1eb.1355290850.git.hutao@cn.fujitsu.com \
    --to=hutao@cn.fujitsu.com \
    --cc=avi@redhat.com \
    --cc=berrange@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=drjones@redhat.com \
    --cc=eblake@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kvm@vger.kernel.org \
    --cc=lcapitulino@redhat.com \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@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).