From nobody Tue Apr 8 23:33:36 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1644602605; cv=none; d=zohomail.com; s=zohoarc; b=dn+JyCrq3mr52P9g2pih5PaXkwHIhUsTAPuX2bkEBkC9YbS4mlx8uhl5J4xk5jMauZZTw0gatO8yuq6u51i44SFBbuLlJVN41b6WG7krdhqozQtnd5LUUdHKIQPI+QnbVvUgwa8UbBqUeaoBjLF0WSBwZYgpmUwfeH63GzzqqzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644602605; h=Content-Type: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=9LWXpA22M8SUlq+VOsvNNqWuUt8VRTi/D2NGo2pc2tw=; b=NX5yUBnii/xHSjhUpsqfKniyWmlBM7xK6BQgWtubp7Kv+VSz6xBLyfnMIomOhWjyZVHPV3BZnJXLRdcg6Sa2Kpoz8kYJUD0gHFuC9JHYfd9e8mu23PKxAEDsuwpI6j6SSmg9bvwQQkAXJiEyjsiv8KS9Rwllbbqhmv7ZTaV2RUA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644602605728846.0881216510054; Fri, 11 Feb 2022 10:03:25 -0800 (PST) Received: from localhost ([::1]:58262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nIaGS-00061z-AW for importer@patchew.org; Fri, 11 Feb 2022 13:03:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nIaCO-0003Ft-Qm for qemu-devel@nongnu.org; Fri, 11 Feb 2022 12:59:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nIaCN-0006iT-2J for qemu-devel@nongnu.org; Fri, 11 Feb 2022 12:59:12 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-Q7jyWIzqOhKF-eRe0Dbqvg-1; Fri, 11 Feb 2022 12:59:08 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90C5B1006AA3; Fri, 11 Feb 2022 17:59:07 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.194.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9317D78AB8; Fri, 11 Feb 2022 17:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644602350; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9LWXpA22M8SUlq+VOsvNNqWuUt8VRTi/D2NGo2pc2tw=; b=I/5Y+1CMDNV9v2V5M87UTPn/T98FQF/nyfGC4xNtSHjWt0nPBmZbzirQQTFEwHzGaHNFYA +6AQazV29t73/MmCQS/Zarj72lbXd76Ep6uzEGJoZTdqyIOmaRxvZJqlxPGpEQeo7jja0k 73M3h7NIdMpyi38DtB080yw/D3I2iSA= X-MC-Unique: Q7jyWIzqOhKF-eRe0Dbqvg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 2/3] iotests: Test blockdev-reopen with iothreads and throttling Date: Fri, 11 Feb 2022 18:58:53 +0100 Message-Id: <20220211175854.153798-3-kwolf@redhat.com> In-Reply-To: <20220211175854.153798-1-kwolf@redhat.com> References: <20220211175854.153798-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644602606626100003 Content-Type: text/plain; charset="utf-8" The 'throttle' block driver implements .bdrv_co_drain_end, so blockdev-reopen will have to wait for it to complete in the polling loop at the end of qmp_blockdev_reopen(). This makes AIO_WAIT_WHILE() release the AioContext lock, which causes a crash if the lock hasn't correctly been taken. Signed-off-by: Kevin Wolf Message-Id: <20220203140534.36522-3-kwolf@redhat.com> Reviewed-by: Hanna Reitz Signed-off-by: Kevin Wolf --- tests/qemu-iotests/245 | 36 +++++++++++++++++++++++++++++++++--- tests/qemu-iotests/245.out | 4 ++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index 24ac43f70e..8cbed7821b 100755 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -1138,12 +1138,13 @@ class TestBlockdevReopen(iotests.QMPTestCase): self.assertEqual(self.get_node('hd1'), None) self.assert_qmp(self.get_node('hd2'), 'ro', True) =20 - def run_test_iothreads(self, iothread_a, iothread_b, errmsg =3D None): - opts =3D hd_opts(0) + def run_test_iothreads(self, iothread_a, iothread_b, errmsg =3D None, + opts_a =3D None, opts_b =3D None): + opts =3D opts_a or hd_opts(0) result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) self.assert_qmp(result, 'return', {}) =20 - opts2 =3D hd_opts(2) + opts2 =3D opts_b or hd_opts(2) result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts= 2) self.assert_qmp(result, 'return', {}) =20 @@ -1194,6 +1195,35 @@ class TestBlockdevReopen(iotests.QMPTestCase): def test_iothreads_switch_overlay(self): self.run_test_iothreads('', 'iothread0') =20 + def test_iothreads_with_throttling(self): + # Create a throttle-group object + opts =3D { 'qom-type': 'throttle-group', 'id': 'group0', + 'limits': { 'iops-total': 1000 } } + result =3D self.vm.qmp('object-add', conv_keys =3D False, **opts) + self.assert_qmp(result, 'return', {}) + + # Options with a throttle filter between format and protocol + opts =3D [ + { + 'driver': iotests.imgfmt, + 'node-name': f'hd{idx}', + 'file' : { + 'node-name': f'hd{idx}-throttle', + 'driver': 'throttle', + 'throttle-group': 'group0', + 'file': { + 'driver': 'file', + 'node-name': f'hd{idx}-file', + 'filename': hd_path[idx], + }, + }, + } + for idx in (0, 2) + ] + + self.run_test_iothreads('iothread0', 'iothread0', None, + opts[0], opts[1]) + if __name__ =3D=3D '__main__': iotests.activate_logging() iotests.main(supported_fmts=3D["qcow2"], diff --git a/tests/qemu-iotests/245.out b/tests/qemu-iotests/245.out index 4eced19294..a4e04a3266 100644 --- a/tests/qemu-iotests/245.out +++ b/tests/qemu-iotests/245.out @@ -17,8 +17,8 @@ read 1/1 bytes at offset 262152 read 1/1 bytes at offset 262160 1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 -............... +................ ---------------------------------------------------------------------- -Ran 25 tests +Ran 26 tests =20 OK --=20 2.34.1