[PATCH v2 3/3] Fix the qemu crash when guest shutdown in COLO mode

leirao posted 3 patches 5 years, 1 month ago
Maintainers: Jason Wang <jasowang@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Zhang Chen <chen.zhang@intel.com>, Juan Quintela <quintela@redhat.com>, Li Zhijian <lizhijian@cn.fujitsu.com>, Paolo Bonzini <pbonzini@redhat.com>
[PATCH v2 3/3] Fix the qemu crash when guest shutdown in COLO mode
Posted by leirao 5 years, 1 month ago
In COLO mode, if the startup parameters of QEMU include "no-shutdown",
QEMU will crash when the guest shutdown. The root cause is when the
guest shutdown, the state of VM will switch COLO to SHUTDOWN. When do
checkpoint again, the state will be changed to COLO. But the state
switch is undefined in runstate_transitions_def, we should add it.
This patch fixes the following:
qemu-system-x86_64: invalid runstate transition: 'shutdown' -> 'colo'
Aborted

Signed-off-by: leirao <lei.rao@intel.com>
---
 softmmu/vl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index f7b1034..c21606c 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -631,6 +631,7 @@ static const RunStateTransition runstate_transitions_def[] = {
     { RUN_STATE_SHUTDOWN, RUN_STATE_PAUSED },
     { RUN_STATE_SHUTDOWN, RUN_STATE_FINISH_MIGRATE },
     { RUN_STATE_SHUTDOWN, RUN_STATE_PRELAUNCH },
+    { RUN_STATE_SHUTDOWN, RUN_STATE_COLO },
 
     { RUN_STATE_DEBUG, RUN_STATE_SUSPENDED },
     { RUN_STATE_RUNNING, RUN_STATE_SUSPENDED },
-- 
1.8.3.1


RE: [PATCH v2 3/3] Fix the qemu crash when guest shutdown in COLO mode
Posted by Zhang, Chen 5 years, 1 month ago

> -----Original Message-----
> From: Rao, Lei <lei.rao@intel.com>
> Sent: Tuesday, September 22, 2020 5:25 PM
> To: Zhang, Chen <chen.zhang@intel.com>; lizhijian@cn.fujitsu.com;
> jasowang@redhat.com; quintela@redhat.com; dgilbert@redhat.com;
> pbonzini@redhat.com
> Cc: qemu-devel@nongnu.org; Rao, Lei <lei.rao@intel.com>
> Subject: [PATCH v2 3/3] Fix the qemu crash when guest shutdown in COLO
> mode
> 
> In COLO mode, if the startup parameters of QEMU include "no-shutdown",
> QEMU will crash when the guest shutdown. The root cause is when the guest
> shutdown, the state of VM will switch COLO to SHUTDOWN. When do
> checkpoint again, the state will be changed to COLO. But the state switch is
> undefined in runstate_transitions_def, we should add it.
> This patch fixes the following:
> qemu-system-x86_64: invalid runstate transition: 'shutdown' -> 'colo'
> Aborted
> 
> Signed-off-by: leirao <lei.rao@intel.com>

Reviewed-by: Zhang Chen <chen.zhang@intel.com>

Thanks
Zhang Chen

> ---
>  softmmu/vl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/softmmu/vl.c b/softmmu/vl.c index f7b1034..c21606c 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -631,6 +631,7 @@ static const RunStateTransition
> runstate_transitions_def[] = {
>      { RUN_STATE_SHUTDOWN, RUN_STATE_PAUSED },
>      { RUN_STATE_SHUTDOWN, RUN_STATE_FINISH_MIGRATE },
>      { RUN_STATE_SHUTDOWN, RUN_STATE_PRELAUNCH },
> +    { RUN_STATE_SHUTDOWN, RUN_STATE_COLO },
> 
>      { RUN_STATE_DEBUG, RUN_STATE_SUSPENDED },
>      { RUN_STATE_RUNNING, RUN_STATE_SUSPENDED },
> --
> 1.8.3.1