All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix the vm state after vm migration when vm panic
@ 2017-03-06 14:05 hangaohuai
  2017-03-06 18:11 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: hangaohuai @ 2017-03-06 14:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, arei.gonglei, hangaohuai

Bug steps:
1. windows VM with pvpanic device:<panic model='isa'/>in xml
2. inject the panic in windows, the vm state is paused (guest-panicked)
3. migrate the vm to other host, vm state is running

Check the vmstate before runstate_set(RUN_STATE_RUNNING)

Signed-off-by: hangaohuai <hangaohuai@huawei.com>
---
 cpus.c                  | 3 +++
 include/sysemu/sysemu.h | 1 +
 vl.c                    | 5 +++++
 3 files changed, 9 insertions(+)

diff --git a/cpus.c b/cpus.c
index c857ad2..37b93aa 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1734,6 +1734,9 @@ int vm_prepare_start(void)
     if (runstate_is_running()) {
         qapi_event_send_stop(&error_abort);
         res = -1;
+    } else if (runstate_is_paniced()) {
+        qemu_system_guest_panicked(NULL);
+        res = -1;
     } else {
         replay_enable_events();
         cpu_enable_ticks();
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 576c7ce..08015c7 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -23,6 +23,7 @@ extern bool qemu_uuid_set;
 bool runstate_check(RunState state);
 void runstate_set(RunState new_state);
 int runstate_is_running(void);
+int runstate_is_paniced(void);
 bool runstate_needs_reset(void);
 bool runstate_store(char *str, size_t size);
 typedef struct vm_change_state_entry VMChangeStateEntry;
diff --git a/vl.c b/vl.c
index 16a3b5e..ea7e3f8 100644
--- a/vl.c
+++ b/vl.c
@@ -729,6 +729,11 @@ int runstate_is_running(void)
     return runstate_check(RUN_STATE_RUNNING);
 }
 
+int runstate_is_paniced(void)
+{
+    return runstate_check(RUN_STATE_GUEST_PANICKED);
+}
+
 bool runstate_needs_reset(void)
 {
     return runstate_check(RUN_STATE_INTERNAL_ERROR) ||
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-07  6:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-06 14:05 [Qemu-devel] [PATCH] Fix the vm state after vm migration when vm panic hangaohuai
2017-03-06 18:11 ` Paolo Bonzini
2017-03-07  6:54   ` hangaohuai

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.