From patchwork Wed Mar 20 11:26:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 1059085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="omYO66n/"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44PSQP4GZZz9sP3 for ; Wed, 20 Mar 2019 22:30:21 +1100 (AEDT) Received: from localhost ([127.0.0.1]:46408 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZQJ-00011M-GN for incoming@patchwork.ozlabs.org; Wed, 20 Mar 2019 07:30:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZNc-0007l5-8c for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6ZNb-0003qJ-G8 for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:32 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:35743) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6ZNb-0003pw-45 for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:31 -0400 Received: by mail-pf1-x441.google.com with SMTP id t21so975923pfe.2 for ; Wed, 20 Mar 2019 04:27:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=W4cUgpfE75IMflSgjXyGbJgkhVbCyuywlDtwxjb+vZo=; b=omYO66n/nb2qU3pFeCqncOg4fuXQ20V2UM2ey3bgeOeFPQNJR9EHvCiDkCBBlVmYTy FJLEIK97xA8JmR4I/EpnlAJBhTCyT3Hp0omW2Qr589T79JvGALcw1U6g+rb8K0wjaxY3 uOtiGU2q86/Rd03IOD1vtdByehSMxmZIVXno51om6tjrEyUPpftPN7KANbpDYJ8T+7mn b0z+sperfibg2oi29ZznPgqjfJoyShFrh+ukW9IyAwRn6ut93IB6TOqdKtd4KxQcnOhU aDeGIb56bZs47nGigSTG/34MK8gAG4dKgpRX0wjvMWqwkQi5qyXTE60m2ZvLOjnM/tEM 0vzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=W4cUgpfE75IMflSgjXyGbJgkhVbCyuywlDtwxjb+vZo=; b=qJwzupHc4FTJREcBk0Rsc1g0Ug0eobCKIrx294i2eZ6DRr8xgtlY6wJ4+RTBXelHsm MO3PeyOi0qiPB5KQIPTtvjefBViYpybdAqCBjFscAbJXm3Fqjmj62gruyEjBxSnaYznT EGFZjrHV+eu7UujCq94ZbNTy6Q94l53i/M+DERPj361Mzfbzo+kAdmOClrH/Q/q+T1b4 MDGNSoICH0mv3M+87X0n384EOjLLFU79oI89E077b7G3O2NrRyLtWec3vsIG6In0hZEU Q8/EVsireVFT9LAjKVoC3CBGSBQa8UCxqhd1s3HQ75GwTa31kioOyfbnRd21Ip2ED1l8 XTlw== X-Gm-Message-State: APjAAAUIScb1z8jC+QQQ7NN0hfonHfMybvTeREPw1odit6BnvvbN6bQp UNEax9cvoNI3PhjuzxMzw/M= X-Google-Smtp-Source: APXvYqwRB+uO48vDRImwsnzMAUzD5hLCoLzCvQgNOELZLT4KrX1gACsnUhl7hxu93MCV//xBCi9K6w== X-Received: by 2002:a63:bd51:: with SMTP id d17mr6847471pgp.117.1553081250233; Wed, 20 Mar 2019 04:27:30 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id k8sm2014797pgq.37.2019.03.20.04.27.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 04:27:29 -0700 (PDT) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, kwolf@redhat.com, mreitz@redhat.com, stefanha@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru, changpeng.liu@intel.com Date: Wed, 20 Mar 2019 19:26:41 +0800 Message-Id: <20190320112646.3712-3-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190320112646.3712-1-xieyongji@baidu.com> References: <20190320112646.3712-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH v8 2/7] virtio: Use started flag in virtio_vmstate_change() 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: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Xie Yongji Currently, we use DRIVER_OK status bit to check whether guest driver has started the device in virtio_vmstate_change(). But it's not the case for virtio 1.0 transitional devices. If migration completes between kicking virtqueue and setting VIRTIO_CONFIG_S_DRIVER_OK, guest may be hung. So here we use started flag to check guest state instead. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index af7b59b4ae..b8d36cd4b7 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2291,7 +2291,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state) VirtIODevice *vdev = opaque; BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); - bool backend_run = running && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK); + bool backend_run = running && vdev->started; vdev->vm_running = running; if (backend_run) {