From nobody Sat May 4 20:30:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510729299930861.5522969818734; Tue, 14 Nov 2017 23:01:39 -0800 (PST) Received: from localhost ([::1]:34916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eErhQ-00073k-9j for importer@patchew.org; Wed, 15 Nov 2017 02:01:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eErg0-0006MA-Ou for qemu-devel@nongnu.org; Wed, 15 Nov 2017 02:00:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eErfx-0005rK-O0 for qemu-devel@nongnu.org; Wed, 15 Nov 2017 02:00:00 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:2292) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1eErfx-0005nG-50 for qemu-devel@nongnu.org; Wed, 15 Nov 2017 01:59:57 -0500 Received: from 172.30.72.59 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKZ30362; Wed, 15 Nov 2017 14:59:46 +0800 (CST) Received: from localhost (10.177.223.127) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Wed, 15 Nov 2017 14:59:39 +0800 From: fangying To: , , Date: Wed, 15 Nov 2017 14:57:35 +0800 Message-ID: <20171115065735.9444-1-fangying1@huawei.com> X-Mailer: git-send-email 2.10.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.223.127] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.5A0BE5E4.0014, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3f1b020e84fbfa39654a89ee7a81a448 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 45.249.212.191 Subject: [Qemu-devel] [PATCH] vhost: Cancel migration when vhost-user process restarted during migration 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: Ying Fang , quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ying Fang QEMU will abort when vhost-user process is restarted during migration when vhost_log_global_start/stop is called. The reason is clear that vhost_dev_set_log returns -1 because network connection is temporarily lost. To handle this situation, let's cancel migration and report it to user. Signed-off-by: Ying Fang --- hw/virtio/vhost.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index ddc42f0..f409b06 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -27,6 +27,7 @@ #include "hw/virtio/virtio-access.h" #include "migration/blocker.h" #include "sysemu/dma.h" +#include "qmp-commands.h" =20 /* enabled until disconnected backend stabilizes */ #define _VHOST_DEBUG 1 @@ -882,20 +883,24 @@ static int vhost_migration_log(MemoryListener *listen= er, int enable) static void vhost_log_global_start(MemoryListener *listener) { int r; + Error *errp =3D NULL; =20 r =3D vhost_migration_log(listener, true); if (r < 0) { - abort(); + error_setg(errp, "Failed to start vhost migration log"); + qmp_migrate_cancel(&errp); } } =20 static void vhost_log_global_stop(MemoryListener *listener) { int r; + Error *errp =3D NULL; =20 r =3D vhost_migration_log(listener, false); if (r < 0) { - abort(); + error_setg(errp, "Failed to stop vhost migration log"); + qmp_migrate_cancel(&errp); } } =20 --=20 2.10.0.windows.1