From nobody Sat May 4 11:18:06 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.zoho.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488855269682187.393976440144; Mon, 6 Mar 2017 18:54:29 -0800 (PST) Received: from localhost ([::1]:47038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cl5Ge-0006Xs-8Y for importer@patchew.org; Mon, 06 Mar 2017 21:54:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cl5Ft-0006WL-Fx for qemu-devel@nongnu.org; Mon, 06 Mar 2017 21:53:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cl5Fo-0005TR-GW for qemu-devel@nongnu.org; Mon, 06 Mar 2017 21:53:41 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40604) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cl5Fo-0005Sy-6k for qemu-devel@nongnu.org; Mon, 06 Mar 2017 21:53:36 -0500 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v272mjLs020471 for ; Mon, 6 Mar 2017 21:53:34 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2917qnkft8-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 06 Mar 2017 21:53:34 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Mar 2017 02:53:32 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Mar 2017 02:53:29 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 78F7C17D8056; Tue, 7 Mar 2017 02:56:45 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v272rT8d58654860; Tue, 7 Mar 2017 02:53:29 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2E2AA4C0AD; Tue, 7 Mar 2017 02:53:23 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 18B954C0AC; Tue, 7 Mar 2017 02:53:23 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 7 Mar 2017 02:53:23 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 5569) id D8AE520F1C7; Tue, 7 Mar 2017 03:53:28 +0100 (CET) From: QingFeng Hao To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Tue, 7 Mar 2017 03:53:28 +0100 X-Mailer: git-send-email 2.8.4 In-Reply-To: <20170307025328.53409-1-haoqf@linux.vnet.ibm.com> References: <20170307025328.53409-1-haoqf@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17030702-0040-0000-0000-00000339E214 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17030702-0041-0000-0000-000024683B16 Message-Id: <20170307025328.53409-2-haoqf@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-07_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703070021 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH RFC 1/1] vmstate: draft fix for failed iotests case 68 and 91 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: kwolf@redhat.com, pasic@linux.vnet.ibm.com, famz@redhat.com, liujbjl@linux.vnet.ibm.com, mreitz@redhat.com, borntraeger@de.ibm.com, cornelia.huck@de.ibm.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 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" I am not very clear about the logic in vmstate.c, but from its context in vmstate_save_state, it seems size should not be 0, otherwise the followed for loop will keep working on the same element. So I just add a simple check to pass that case, not sure if it's right but it can pass iotest case 68 and 91 now. The iotest's failed output is: 068 1s ... - output mismatch (see 068.out.bad) --- /home/haoqf/KVMonz/gitcheck/work/qemu-master/tree/qemu/tests/qemu-iotes= ts/068.out 2017-03-06 05:52:24.817328899 +0100 +++ 068.out.bad 2017-03-07 03:28:44.426714519 +0100 @@ -3,9 +3,13 @@ =3D=3D=3D Saving and reloading a VM state to/from a qcow2 image =3D=3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D131072 +qemu-system-s390x: migration/vmstate.c:336: vmstate_save_state: Assertion = `first_elem || !n_elems' failed. +./common.config: line 109: 52497 Aborted ( if [ -n "${QEMU= _NEED_PID}" ]; then + echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid"; +fi; exec "$QEMU_PROG" $QEMU_OPTIONS "$@" ) QEMU X.Y.Z monitor - type 'help' for more information (qemu) savevm 0 -(qemu) quit +qemu-system-s390x: Device 'virtio0' does not have the requested snapshot '= 0' QEMU X.Y.Z monitor - type 'help' for more information (qemu) quit *** done 091 1s ... [failed, exit status 1] - output mismatch (see 091.out.bad) --- tests/qemu-iotests/091.out 2016-08-30 12:35:04.207683276 +0200 +++ 091.out.bad 2017-03-06 13:08:03.717135426 +0100 @@ -11,18 +11,23 @@ =20 vm1: qemu-io disk write complete vm1: live migration started -vm1: live migration completed - -=3D=3D=3D VM 2: Post-migration, write to disk, verify running =3D=3D= =3D - -vm2: qemu-io disk write complete -vm2: qemu process running successfully -vm2: flush io, and quit -Check image pattern -read 4194304/4194304 bytes at offset 0 -4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Running 'qemu-img check -r all $TEST_IMG' -No errors were found on the image. -80/16384 =3D 0.49% allocated, 0.00% fragmented, 0.00% compressed clust= ers -Image end offset: 5570560 -*** done +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +./common.qemu: line 110: write error: Broken pipe +Timeout waiting for completed on handle 0 Signed-off-by: QingFeng Hao --- migration/vmstate.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/migration/vmstate.c b/migration/vmstate.c index 78b3cd4..ff28dde 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -106,6 +106,10 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescr= iption *vmsd, int i, n_elems =3D vmstate_n_elems(opaque, field); int size =3D vmstate_size(opaque, field); =20 + if (size =3D=3D 0) { + field++; + continue; + } vmstate_handle_alloc(first_elem, field, opaque); if (field->flags & VMS_POINTER) { first_elem =3D *(void **)first_elem; @@ -322,6 +326,10 @@ void vmstate_save_state(QEMUFile *f, const VMStateDesc= ription *vmsd, int64_t old_offset, written_bytes; QJSON *vmdesc_loop =3D vmdesc; =20 + if (size =3D=3D 0) { + field++; + continue; + } trace_vmstate_save_state_loop(vmsd->name, field->name, n_elems= ); if (field->flags & VMS_POINTER) { first_elem =3D *(void **)first_elem; --=20 2.8.4