Received: from eggs.gnu.org ([2001:4830:134:3::10]:42173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWrkR-0004J0-Rv for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:06:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWrkN-00065L-Kk for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:06:10 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49203 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWrkN-000658-F8 for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:06:07 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u78KxlGi058619 for ; Mon, 8 Aug 2016 17:06:07 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 24nbvwr4a9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 08 Aug 2016 17:06:07 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Aug 2016 15:06:06 -0600 From: Michael Roth Date: Mon, 8 Aug 2016 16:03:34 -0500 In-Reply-To: <1470690267-31454-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1470690267-31454-1-git-send-email-mdroth@linux.vnet.ibm.com> Message-Id: <1470690267-31454-4-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 03/56] vl: change runstate only if new state is different from current state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Li Zhijian , Paolo Bonzini From: Li Zhijian Previously, qemu will abort at following scenario: (qemu) stop (qemu) system_reset (qemu) system_reset (qemu) 2016-04-13T20:54:38.979158Z qemu-system-x86_64: invalid runstate transition: 'prelaunch' -> 'prelaunch' Signed-off-by: Li Zhijian Acked-by: Paolo Bonzini Message-Id: <1460604352-18630-1-git-send-email-lizhijian@cn.fujitsu.com> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini (cherry picked from commit e92a2d9cb3d8f589c9fe5d2eacc83d8dddea0e16) Signed-off-by: Michael Roth --- vl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vl.c b/vl.c index 5fd22cb..5db5dc2 100644 --- a/vl.c +++ b/vl.c @@ -692,6 +692,10 @@ void runstate_set(RunState new_state) { assert(new_state < RUN_STATE__MAX); + if (current_run_state == new_state) { + return; + } + if (!runstate_valid_transitions[current_run_state][new_state]) { error_report("invalid runstate transition: '%s' -> '%s'", RunState_lookup[current_run_state], -- 1.9.1