From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b03vT-0000qy-I1 for qemu-devel@nongnu.org; Tue, 10 May 2016 05:26:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b03vP-0006DQ-7y for qemu-devel@nongnu.org; Tue, 10 May 2016 05:25:58 -0400 References: <1460604352-18630-1-git-send-email-lizhijian@cn.fujitsu.com> From: Paolo Bonzini Message-ID: <5731A91E.9040304@redhat.com> Date: Tue, 10 May 2016 11:25:50 +0200 MIME-Version: 1.0 In-Reply-To: <1460604352-18630-1-git-send-email-lizhijian@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] 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: Li Zhijian , qemu-devel@nongnu.org, kraxel@redhat.com, quintela@redhat.com, peter.maydell@linaro.org, qemu-stable On 14/04/2016 05:25, Li Zhijian wrote: > 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 > --- > from v1 > - fix patch title typo 'chanage' -> 'change' > - coding sytle: 'return ;' -> 'return;' > - add Acked tag > vl.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/vl.c b/vl.c > index 9df534f..039a353 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], > Queued for 2.7, and added Cc: qemu-stable@nongnu.org. Thanks, Paolo