From 01bd5ac8dd131d953c93db49f6a75023d3ca04aa Mon Sep 17 00:00:00 2001 From: "yuhong.tao@intel.com" Date: Wed, 23 Jan 2019 23:06:28 +0800 Subject: [PATCH] tools: acrnd: fix wait_for_stop() return wrong vm state The wait_for_stop() first check if all VM are stopped or suspended. It first check if VMs are stopped, then check if they are suspend. If the VMs change state from running to stoped, after check VMs stopped fail, before start check suspend state. wait_for_stop() will mistake resopnse 'All vms have entered S3 state successfully' To fix that, wait_for_stop() must only update VMs's state once, and see if they are stopped, or suspended. Tracked-On: #2398 Signed-off-by: Tao Yuhong --- tools/acrn-manager/acrnd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/acrn-manager/acrnd.c b/tools/acrn-manager/acrnd.c index 239b4c3de..2b83b1060 100644 --- a/tools/acrn-manager/acrnd.c +++ b/tools/acrn-manager/acrnd.c @@ -448,10 +448,8 @@ static int check_vms_status(unsigned int status) { struct vmmngr_struct *s; - vmmngr_update(); - LIST_FOREACH(s, &vmmngr_head, list) - if (s->state != status && s->state != VM_CREATED) + if (s->state != status) return -1; return 0; @@ -465,6 +463,8 @@ static int wait_for_stop(unsigned int timeout) /* list and update the vm status */ do { + vmmngr_update(); + printf("Waiting %lu seconds for all vms enter S3/S5 state\n", t); if (check_vms_status(VM_CREATED) == 0) {