From patchwork Tue Aug 14 10:48:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhoujian (jay)" X-Patchwork-Id: 10565333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 108B71057 for ; Tue, 14 Aug 2018 10:49:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1C0929912 for ; Tue, 14 Aug 2018 10:49:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4E132991B; Tue, 14 Aug 2018 10:49:34 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 6C2B029912 for ; Tue, 14 Aug 2018 10:49:34 +0000 (UTC) Received: from localhost ([::1]:43459 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpWtH-0007Nk-TY for patchwork-qemu-devel@patchwork.kernel.org; Tue, 14 Aug 2018 06:49:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpWsV-00073p-Ay for qemu-devel@nongnu.org; Tue, 14 Aug 2018 06:48:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpWsS-00046d-7a for qemu-devel@nongnu.org; Tue, 14 Aug 2018 06:48:43 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:59341 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fpWsR-00042T-MU for qemu-devel@nongnu.org; Tue, 14 Aug 2018 06:48:40 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id E74C21206AA14; Tue, 14 Aug 2018 18:48:25 +0800 (CST) Received: from localhost (10.177.19.14) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.399.0; Tue, 14 Aug 2018 18:48:20 +0800 From: Jay Zhou To: Date: Tue, 14 Aug 2018 18:48:13 +0800 Message-ID: <1534243693-9560-1-git-send-email-jianjay.zhou@huawei.com> X-Mailer: git-send-email 2.6.1.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.19.14] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 45.249.212.35 Subject: [Qemu-devel] [RFC PATCH] vl: fix migration when watchdog expires 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: wangxinxin.wang@huawei.com, quintela@redhat.com, jianjay.zhou@huawei.com, qemu-devel@nongnu.org, dgilbert@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP I got the following error when migrating a VM with watchdog device: {"timestamp": {"seconds": 1533884471, "microseconds": 668099}, "event": "WATCHDOG", "data": {"action": "reset"}} {"timestamp": {"seconds": 1533884471, "microseconds": 677658}, "event": "RESET", "data": {"guest": true}} {"timestamp": {"seconds": 1533884471, "microseconds": 677874}, "event": "STOP"} qemu-system-x86_64: invalid runstate transition: 'prelaunch' -> 'postmigrate' Aborted The run state transition is RUN_STATE_FINISH_MIGRATE to RUN_STATE_PRELAUNCH, then the migration thread aborted when it tries to set RUN_STATE_POSTMIGRATE. There is a race between the main loop thread and the migration thread I think. Signed-off-by: Jay Zhou --- vl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/vl.c b/vl.c index 16b913f..298ce91 100644 --- a/vl.c +++ b/vl.c @@ -637,6 +637,7 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_PRELAUNCH, RUN_STATE_RUNNING }, { RUN_STATE_PRELAUNCH, RUN_STATE_FINISH_MIGRATE }, { RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE }, + { RUN_STATE_PRELAUNCH, RUN_STATE_POSTMIGRATE }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_RUNNING }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_PAUSED },