From patchwork Mon May 23 15:09:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9132039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0699F607D5 for ; Mon, 23 May 2016 15:22:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F12B42823D for ; Mon, 23 May 2016 15:22:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E605D28241; Mon, 23 May 2016 15:22:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 69F472823D for ; Mon, 23 May 2016 15:22:57 +0000 (UTC) Received: from localhost ([::1]:48857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4rh1-0004Zp-Sf for patchwork-qemu-devel@patchwork.kernel.org; Mon, 23 May 2016 11:22:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4rUl-0002B2-MH for qemu-devel@nongnu.org; Mon, 23 May 2016 11:10:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4rUh-00043u-DU for qemu-devel@nongnu.org; Mon, 23 May 2016 11:10:15 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4rUh-00043n-7M; Mon, 23 May 2016 11:10:11 -0400 Received: by mail-wm0-x241.google.com with SMTP id 67so16035555wmg.0; Mon, 23 May 2016 08:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=5GU93M8e+fR6ed1fjEa1GfGDfF/UEZWez/4cRM9PPko=; b=TN2ZVoCL+VqJMCfz+dd+o3TCUponquMfCWetjT0O1l/YByQLpmoBgdQZ4DiQ9z9H8R oVgYuUZVqocvHCPC+9u7JWmV8jhxYEDdCSip8+2O8zU9C2BdHuH6w4Wi/MsAluihlTDl rucUvSijV5SV3KhZXHfYWncBywytsffzGDdHsnM+khKq2/LrUWilXBm9vMqwTCseDh0A 1/0wtEytHlQNdSihYWYrBWQjnvF/1TONv1N5uPZtkG1jbL5IXrkjbGh7PO888+sxNDiY 7+0fXGSEHL0Z6wFZAyOgkdTtznYunUhNgsfOQxkfonrT7EIlmOyaOeOnzch6BWzJmQYx 67aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=5GU93M8e+fR6ed1fjEa1GfGDfF/UEZWez/4cRM9PPko=; b=BiSAjKMuVutd9dahacPTMRcsuEyjNWxFjpznBCEF9dv81NmS63FuXzK89R+1sJojIZ x7BXN+ZC+Kq9H4WmFGiSat7Ap4dZOJyXDXeLzXKXdoQng3CVknqEXPikyv9zs+EVxU5R RASOymvaeUhK7QcFmvyUBTvISanHEtrrouRfhQm606xh5LVVns9KzBSOm0SewW3ZTHcz FUDJpU81iz4WwK44Flf1Hh8TufaFjr86ZuvlX4v1hwU8Ai/Bdr04aNORWroDNk53t1zR /HtdEeKKctfNSE1Ke7BfrZAy58CdfiuFBxNTcMNLuHpbQehymB6FYZD9rUmPNvYA2TLr 72mQ== X-Gm-Message-State: ALyK8tKA+QmUrctx6PEuBY+THJ0H2Lt/uEFTlw7Q/ytCA7lHotSSVQCO659NQzgLEsRKAA== X-Received: by 10.28.48.17 with SMTP id w17mr10916777wmw.33.1464016210717; Mon, 23 May 2016 08:10:10 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-252-58.clienti.tiscali.it. [78.12.252.58]) by smtp.gmail.com with ESMTPSA id ac2sm19250359wjc.35.2016.05.23.08.10.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 May 2016 08:10:10 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 23 May 2016 17:09:43 +0200 Message-Id: <1464016199-43768-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1464016199-43768-1-git-send-email-pbonzini@redhat.com> References: <1464016199-43768-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 08/24] vl: change runstate only if new state is different from current state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-stable@nongnu.org, Li Zhijian Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- vl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vl.c b/vl.c index b1562d8..2569dbb 100644 --- a/vl.c +++ b/vl.c @@ -690,6 +690,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],