From patchwork Tue Aug 15 15:09:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 801636 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=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xWwrg04pmz9t3f for ; Wed, 16 Aug 2017 01:10:10 +1000 (AEST) Received: from localhost ([::1]:40057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhdTs-00044Z-DX for incoming@patchwork.ozlabs.org; Tue, 15 Aug 2017 11:10:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhdT4-00041d-5Y for qemu-devel@nongnu.org; Tue, 15 Aug 2017 11:09:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhdT3-0002Xz-7p for qemu-devel@nongnu.org; Tue, 15 Aug 2017 11:09:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37082) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dhdT0-0002WW-Pk; Tue, 15 Aug 2017 11:09:14 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id D20AA46289; Tue, 15 Aug 2017 15:09:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D20AA46289 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eblake@redhat.com Received: from red.redhat.com (ovpn-121-22.rdu2.redhat.com [10.10.121.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEA705D9CA; Tue, 15 Aug 2017 15:09:12 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Tue, 15 Aug 2017 10:09:02 -0500 Message-Id: <20170815150907.21495-3-eblake@redhat.com> In-Reply-To: <20170815150907.21495-1-eblake@redhat.com> References: <20170815150907.21495-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 15 Aug 2017 15:09:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/7] qemu-iotests: step clock after each test iteration 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: Kevin Wolf , "open list:Block layer core" , Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi The 093 throttling test submits twice as many requests as the throttle limit in order to ensure that we reach the limit. The remaining requests are left in-flight at the end of each test iteration. Commit 452589b6b47e8dc6353df257fc803dfc1383bed8 ("vl.c/exit: pause cpus before closing block devices") exposed a hang in 093. This happens because requests are still in flight when QEMU terminates but QEMU_CLOCK_VIRTUAL time is frozen. bdrv_drain_all() hangs forever since throttled requests cannot complete. Step the clock at the end of each test iteration so in-flight requests actually finish. This solves the hang and is cleaner than leaving tests in-flight. Note that this could also be "fixed" by disabling throttling when drives are closed in QEMU. That approach has two issues: 1. We must drain requests before disabling throttling, so the hang cannot be easily avoided! 2. Any time QEMU disables throttling internally there is a chance that malicious users can abuse the code path to bypass throttling limits. Therefore it makes more sense to fix the test case than to modify QEMU. Signed-off-by: Stefan Hajnoczi Message-Id: <20170815130502.8736-1-stefanha@redhat.com> Signed-off-by: Eric Blake --- tests/qemu-iotests/093 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index 2ed393a548..ef3997206b 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -133,6 +133,10 @@ class ThrottleTestCase(iotests.QMPTestCase): self.assertTrue(check_limit(params['iops_rd'], rd_iops)) self.assertTrue(check_limit(params['iops_wr'], wr_iops)) + # Allow remaining requests to finish. We submitted twice as many to + # ensure the throttle limit is reached. + self.vm.qtest("clock_step %d" % ns) + # Connect N drives to a VM and test I/O in all of them def test_all(self): params = {"bps": 4096,