From nobody Thu Apr 25 20:01:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570546649; cv=none; d=zoho.com; s=zohoarc; b=I/djL8Zag5iZyFxqxoMuTrXDj/vQOfgK7OcQWWeyl24IU1ZUC8hXZgOgtBEjSddEqZz4lzVZ9n0WmnT/8VCSfyN/g8w7YnHIa/s5LtrZbfBcLN5Jcx8WKnio/BsH9hdes5EX1Q+85onUGxrfCU6DiSSpQhMoK/hz4ZtD1CoYMKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570546649; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0j1Dm0hUMJK8fzgaHV7ZR0/rcZuT40EoUE/I6kzaBp0=; b=ScjXPvWuasRT4pKlAXulRAQRPO6LZ7m2UUO52V93TjmHw1ZR/zLB5VXK4HfsB2pBWTAvQ5+82+WkuSGsfvlv2mAZ9cjBwMk305B+bQKwkRzwed0XAPM1toFkQP+BFlqjwuQGjVbgrMxGjtOH47rN/ic6jo3GOoQU7gZVK8hu0ps= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1570546649967204.18592482066856; Tue, 8 Oct 2019 07:57:29 -0700 (PDT) Received: from localhost ([::1]:57090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHqvY-0002Qr-7o for importer@patchew.org; Tue, 08 Oct 2019 10:57:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54532) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHqtY-0000d2-40 for qemu-devel@nongnu.org; Tue, 08 Oct 2019 10:55:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHqtV-0003nn-Uq for qemu-devel@nongnu.org; Tue, 08 Oct 2019 10:55:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64406) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iHqtO-0003ev-Uf; Tue, 08 Oct 2019 10:55:15 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9879E69066; Tue, 8 Oct 2019 14:55:13 +0000 (UTC) Received: from localhost (ovpn-116-36.ams2.redhat.com [10.36.116.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B25910016EB; Tue, 8 Oct 2019 14:55:12 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 1/4] util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended Date: Tue, 8 Oct 2019 15:55:02 +0100 Message-Id: <20191008145505.3641-2-stefanha@redhat.com> In-Reply-To: <20191008145505.3641-1-stefanha@redhat.com> References: <20191008145505.3641-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 08 Oct 2019 14:55:13 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, Peter Maydell , "Michael S. Tsirkin" , Max Reitz , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Make it more obvious, that filling qiov corresponds to qiov allocation, which in turn corresponds to total_niov calculation, based on mid_niov (not mid_len). Still add an assertion to show that there should be no difference. [Added mingw "error: 'mid_iov' may be used uninitialized in this function" compiler error fix suggested by Vladimir. --Stefan] Reported-by: Coverity (CID 1405302) Signed-off-by: Vladimir Sementsov-Ogievskiy Message-id: 20190910090310.14032-1-vsementsov@virtuozzo.com Suggested-by: Peter Maydell Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20190910090310.14032-1-vsementsov@virtuozzo.com> Signed-off-by: Stefan Hajnoczi fixup! util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended --- util/iov.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/iov.c b/util/iov.c index 5059e10431..45ef3043ee 100644 --- a/util/iov.c +++ b/util/iov.c @@ -423,7 +423,7 @@ void qemu_iovec_init_extended( { size_t mid_head, mid_tail; int total_niov, mid_niov =3D 0; - struct iovec *p, *mid_iov; + struct iovec *p, *mid_iov =3D NULL; =20 if (mid_len) { mid_iov =3D qiov_slice(mid_qiov, mid_offset, mid_len, @@ -446,7 +446,8 @@ void qemu_iovec_init_extended( p++; } =20 - if (mid_len) { + assert(!mid_niov =3D=3D !mid_len); + if (mid_niov) { memcpy(p, mid_iov, mid_niov * sizeof(*p)); p[0].iov_base =3D (uint8_t *)p[0].iov_base + mid_head; p[0].iov_len -=3D mid_head; --=20 2.21.0 From nobody Thu Apr 25 20:01:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570546817; cv=none; d=zoho.com; s=zohoarc; b=RoFeDAhhp+OxkyAqYXGesfFRPedWfMtqZHhwRsYWxqf9vmJIjdrcAnOJ2txuHOLLirQRpeuSuW3ka/i1EndY4ohcSqvAJUAOsllmUMsWfqQsmNS/w5AWhQ8lXZM5SbpGta+oW25Hq0a/07w3Hiujwy5p2v0G8Et8sLdr2qI+hBQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570546817; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NgrubDeC1x5zMxlExcKYP9AlkSpHY8UdgNEeSW2gzok=; b=i9u4PaoVpedP/ASYbwdHahhz0YZJ6Sj2DAraLtQjot7SfSyVm6mwKYimHBZyoRvFxfw9DKOThCY/HUT9AnvLI5uNqqM4WRSZNsGNd/7jZw6XB0hbE7wlp1YBmsXVkVDQpvzqJjDHLrbAHnUe23RWB4BtTHYZ76OcXe1CY1EInUU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1570546817644490.89339037287687; Tue, 8 Oct 2019 08:00:17 -0700 (PDT) Received: from localhost ([::1]:57134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHqyB-0005Sj-6k for importer@patchew.org; Tue, 08 Oct 2019 11:00:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54579) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHqtf-0000rZ-Ob for qemu-devel@nongnu.org; Tue, 08 Oct 2019 10:55:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHqte-00040k-Ct for qemu-devel@nongnu.org; Tue, 08 Oct 2019 10:55:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47186) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iHqtb-0003so-9h; Tue, 08 Oct 2019 10:55:27 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CA1D2CE905; Tue, 8 Oct 2019 14:55:26 +0000 (UTC) Received: from localhost (ovpn-116-36.ams2.redhat.com [10.36.116.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 050E65C22F; Tue, 8 Oct 2019 14:55:14 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 2/4] virtio-blk: schedule virtio_notify_config to run on main context Date: Tue, 8 Oct 2019 15:55:03 +0100 Message-Id: <20191008145505.3641-3-stefanha@redhat.com> In-Reply-To: <20191008145505.3641-1-stefanha@redhat.com> References: <20191008145505.3641-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 08 Oct 2019 14:55:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , Sergio Lopez , qemu-block@nongnu.org, Peter Maydell , "Michael S. Tsirkin" , Max Reitz , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Sergio Lopez virtio_notify_config() needs to acquire the global mutex, which isn't allowed from an iothread, and may lead to a deadlock like this: - main thead * Has acquired: qemu_global_mutex. * Is trying the acquire: iothread AioContext lock via AIO_WAIT_WHILE (after aio_poll). - iothread * Has acquired: AioContext lock. * Is trying to acquire: qemu_global_mutex (via virtio_notify_config->prepare_mmio_access). If virtio_blk_resize() is called from an iothread, schedule virtio_notify_config() to be run in the main context BH. [Removed unnecessary newline as suggested by Kevin Wolf . --Stefan] Signed-off-by: Sergio Lopez Reviewed-by: Kevin Wolf Message-id: 20190916112411.21636-1-slp@redhat.com Message-Id: <20190916112411.21636-1-slp@redhat.com> Signed-off-by: Stefan Hajnoczi --- hw/block/virtio-blk.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 18851601cb..ed2ddebd2b 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -16,6 +16,7 @@ #include "qemu/iov.h" #include "qemu/module.h" #include "qemu/error-report.h" +#include "qemu/main-loop.h" #include "trace.h" #include "hw/block/block.h" #include "hw/qdev-properties.h" @@ -1086,11 +1087,24 @@ static int virtio_blk_load_device(VirtIODevice *vde= v, QEMUFile *f, return 0; } =20 +static void virtio_resize_cb(void *opaque) +{ + VirtIODevice *vdev =3D opaque; + + assert(qemu_get_current_aio_context() =3D=3D qemu_get_aio_context()); + virtio_notify_config(vdev); +} + static void virtio_blk_resize(void *opaque) { VirtIODevice *vdev =3D VIRTIO_DEVICE(opaque); =20 - virtio_notify_config(vdev); + /* + * virtio_notify_config() needs to acquire the global mutex, + * so it can't be called from an iothread. Instead, schedule + * it to be run in the main context BH. + */ + aio_bh_schedule_oneshot(qemu_get_aio_context(), virtio_resize_cb, vdev= ); } =20 static const BlockDevOps virtio_block_ops =3D { --=20 2.21.0 From nobody Thu Apr 25 20:01:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570546661; cv=none; d=zoho.com; s=zohoarc; b=EJyd2/6PpUsnwpaJFxaHpyOxcbezXC7M04yJCeAgrzc4ng9nj6UtYFxr+DOGjcA+TaR99aWmhnY5Sgj6z0ulVOtPhJsZ+8w+znYv7oT6/qLbzGAfDElFo7IMFfri7tVMcWGPvmZQXXOpqrpqPxAGfZTks/W9CDfBmkOjFf17bY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570546661; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vNTsd3Wn86WMLW/EyhzK2pE5efBrUNGRs8qpa5UlEmw=; b=SWbCg66ojkIQKPsjS5PG9+9PSfLzzEAeVcGmdokQAivmMNgv8DkBm4XdHewDprnUvENDdheS7hYknyXKkTgjQ6g/Xddfv7Y3oebbGxPBOE+cIp/Dq9EEwjKKhbsLhKQsmD2PVCeXqTJ2+fVMn3F3VM2N2SoMpMs4DAmqP7ytOxs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1570546661507942.7580058405049; Tue, 8 Oct 2019 07:57:41 -0700 (PDT) Received: from localhost ([::1]:57094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHqvj-0002f0-Ga for importer@patchew.org; Tue, 08 Oct 2019 10:57:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54596) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHqth-0000tu-GS for qemu-devel@nongnu.org; Tue, 08 Oct 2019 10:55:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHqtg-00043c-5m for qemu-devel@nongnu.org; Tue, 08 Oct 2019 10:55:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35414) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iHqtd-0003wI-3D; Tue, 08 Oct 2019 10:55:29 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4021EC0546FF; Tue, 8 Oct 2019 14:55:28 +0000 (UTC) Received: from localhost (ovpn-116-36.ams2.redhat.com [10.36.116.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB6185C1D4; Tue, 8 Oct 2019 14:55:27 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 3/4] block: Skip COR for inactive nodes Date: Tue, 8 Oct 2019 15:55:04 +0100 Message-Id: <20191008145505.3641-4-stefanha@redhat.com> In-Reply-To: <20191008145505.3641-1-stefanha@redhat.com> References: <20191008145505.3641-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 08 Oct 2019 14:55:28 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Peter Maydell , "Michael S. Tsirkin" , Max Reitz , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Max Reitz We must not write data to inactive nodes, and a COR is certainly something we can simply not do without upsetting anyone. So skip COR operations on inactive nodes. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Message-id: 20191001174827.11081-2-mreitz@redhat.com Message-Id: <20191001174827.11081-2-mreitz@redhat.com> Signed-off-by: Stefan Hajnoczi --- block/io.c | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/block/io.c b/block/io.c index f8c3596131..4f9ee97c2b 100644 --- a/block/io.c +++ b/block/io.c @@ -1246,11 +1246,18 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(Bd= rvChild *child, int max_transfer =3D MIN_NON_ZERO(bs->bl.max_transfer, BDRV_REQUEST_MAX_BYTES); unsigned int progress =3D 0; + bool skip_write; =20 if (!drv) { return -ENOMEDIUM; } =20 + /* + * Do not write anything when the BDS is inactive. That is not + * allowed, and it would not help. + */ + skip_write =3D (bs->open_flags & BDRV_O_INACTIVE); + /* FIXME We cannot require callers to have write permissions when all = they * are doing is a read request. If we did things right, write permissi= ons * would be obtained anyway, but internally by the copy-on-read code. = As @@ -1274,23 +1281,29 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(Bd= rvChild *child, while (cluster_bytes) { int64_t pnum; =20 - ret =3D bdrv_is_allocated(bs, cluster_offset, - MIN(cluster_bytes, max_transfer), &pnum); - if (ret < 0) { - /* Safe to treat errors in querying allocation as if - * unallocated; we'll probably fail again soon on the - * read, but at least that will set a decent errno. - */ + if (skip_write) { + ret =3D 1; /* "already allocated", so nothing will be copied */ pnum =3D MIN(cluster_bytes, max_transfer); - } + } else { + ret =3D bdrv_is_allocated(bs, cluster_offset, + MIN(cluster_bytes, max_transfer), &pnu= m); + if (ret < 0) { + /* + * Safe to treat errors in querying allocation as if + * unallocated; we'll probably fail again soon on the + * read, but at least that will set a decent errno. + */ + pnum =3D MIN(cluster_bytes, max_transfer); + } =20 - /* Stop at EOF if the image ends in the middle of the cluster */ - if (ret =3D=3D 0 && pnum =3D=3D 0) { - assert(progress >=3D bytes); - break; - } + /* Stop at EOF if the image ends in the middle of the cluster = */ + if (ret =3D=3D 0 && pnum =3D=3D 0) { + assert(progress >=3D bytes); + break; + } =20 - assert(skip_bytes < pnum); + assert(skip_bytes < pnum); + } =20 if (ret <=3D 0) { QEMUIOVector local_qiov; --=20 2.21.0 From nobody Thu Apr 25 20:01:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570547026; cv=none; d=zoho.com; s=zohoarc; b=g6SGiHnsanB1tIcbubUOsGuLTnwMDZRkokDSBN3zMXSa5MUukqU4vFYCQVCa4zrv8lQbMSUMuw3xDUbGMKE4A6LR47BrLaeNe/PqbCk9H8ASWRic4Ih4Gqu50gOryaubi92uhX1aIGtYh1BycuTQbKAZZF84ha5yv/oSfLms2Ag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570547026; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eWRLSrkhqfXF+B0sa/mg3vXlr25HyyOQBc7k2Y+K7tY=; b=MwawD8wzBKIaRhvHcGWmLpqhGdoE3YXm7mTbfydKClO4ipPkXWBzbceUS4an+2stOmQuCcyHqnz8rT/Bchv/Q6BZWHAVVRDgV2BD7qfhuOYiT5CWFghTJpFtZvLpLwIScHQyYmOhG8mcI2R1t+SQwdEKLl1WU0DmXwF2rqndO0g= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157054702659250.499481201795106; Tue, 8 Oct 2019 08:03:46 -0700 (PDT) Received: from localhost ([::1]:57180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHr1b-0008Bp-8P for importer@patchew.org; Tue, 08 Oct 2019 11:03:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54623) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHqtn-00010W-SS for qemu-devel@nongnu.org; Tue, 08 Oct 2019 10:55:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHqtm-0004AL-Lp for qemu-devel@nongnu.org; Tue, 08 Oct 2019 10:55:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47266) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iHqtf-00040o-0u; Tue, 08 Oct 2019 10:55:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 32AA3550CF; Tue, 8 Oct 2019 14:55:30 +0000 (UTC) Received: from localhost (ovpn-116-36.ams2.redhat.com [10.36.116.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id B87FA5C21F; Tue, 8 Oct 2019 14:55:29 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 4/4] iotests/262: Switch source/dest VM launch order Date: Tue, 8 Oct 2019 15:55:05 +0100 Message-Id: <20191008145505.3641-5-stefanha@redhat.com> In-Reply-To: <20191008145505.3641-1-stefanha@redhat.com> References: <20191008145505.3641-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 08 Oct 2019 14:55:30 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Peter Maydell , "Michael S. Tsirkin" , Max Reitz , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Max Reitz Launching the destination VM before the source VM gives us a regression test for HEAD^: The guest device causes a read from the disk image through guess_disk_lchs(). This will not work if the first sector (containing the partition table) is yet unallocated, we use COR, and the node is inactive. By launching the source VM before the destination, however, the COR filter on the source will allocate that area in the image shared between both VMs, thus the problem will not become apparent. Switching the launch order causes the sector to still be unallocated when guess_disk_lchs() runs on the inactive node in the destination VM, and thus we get our test case. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Message-id: 20191001174827.11081-3-mreitz@redhat.com Message-Id: <20191001174827.11081-3-mreitz@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/qemu-iotests/262 | 12 ++++++------ tests/qemu-iotests/262.out | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/qemu-iotests/262 b/tests/qemu-iotests/262 index 398f63587e..0963daa806 100755 --- a/tests/qemu-iotests/262 +++ b/tests/qemu-iotests/262 @@ -54,12 +54,6 @@ with iotests.FilePath('img') as img_path, \ =20 os.mkfifo(fifo) =20 - iotests.log('Launching source VM...') - add_opts(vm_a) - vm_a.launch() - - vm_a.enable_migration_events('A') - iotests.log('Launching destination VM...') add_opts(vm_b) vm_b.add_incoming("exec: cat '%s'" % (fifo)) @@ -67,6 +61,12 @@ with iotests.FilePath('img') as img_path, \ =20 vm_b.enable_migration_events('B') =20 + iotests.log('Launching source VM...') + add_opts(vm_a) + vm_a.launch() + + vm_a.enable_migration_events('A') + iotests.log('Starting migration to B...') iotests.log(vm_a.qmp('migrate', uri=3D'exec:cat >%s' % (fifo))) with iotests.Timeout(3, 'Migration does not complete'): diff --git a/tests/qemu-iotests/262.out b/tests/qemu-iotests/262.out index 5a58e5e9f8..8e04c496c4 100644 --- a/tests/qemu-iotests/262.out +++ b/tests/qemu-iotests/262.out @@ -1,9 +1,9 @@ -Launching source VM... -Enabling migration QMP events on A... -{"return": {}} Launching destination VM... Enabling migration QMP events on B... {"return": {}} +Launching source VM... +Enabling migration QMP events on A... +{"return": {}} Starting migration to B... {"return": {}} {"data": {"status": "setup"}, "event": "MIGRATION", "timestamp": {"microse= conds": "USECS", "seconds": "SECS"}} --=20 2.21.0