From patchwork Tue Jan 15 16:48:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 212258 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2B6572C009B for ; Wed, 16 Jan 2013 04:28:01 +1100 (EST) Received: from localhost ([::1]:51770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv9hb-0003qY-TT for incoming@patchwork.ozlabs.org; Tue, 15 Jan 2013 11:49:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:32976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv9gy-00025P-Vk for qemu-devel@nongnu.org; Tue, 15 Jan 2013 11:48:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tv9gw-0005Wx-7e for qemu-devel@nongnu.org; Tue, 15 Jan 2013 11:48:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8957) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv9gw-0005Wc-10 for qemu-devel@nongnu.org; Tue, 15 Jan 2013 11:48:50 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0FGmgiI002337 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Jan 2013 11:48:43 -0500 Received: from localhost (ovpn-112-16.ams2.redhat.com [10.36.112.16]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0FGmd9I009036; Tue, 15 Jan 2013 11:48:40 -0500 From: Stefan Hajnoczi To: Date: Tue, 15 Jan 2013 17:48:18 +0100 Message-Id: <1358268511-27061-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1358268511-27061-1-git-send-email-stefanha@redhat.com> References: <1358268511-27061-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Lieven , Anthony Liguori , Peter Lieven , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 02/15] block: fix initialization in bdrv_io_limits_enable() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Peter Lieven bdrv_io_limits_enable() starts a new slice, but does not set io_base correctly for that slice. Here is how io_base is used: bytes_base = bs->nr_bytes[is_write] - bs->io_base.bytes[is_write]; bytes_res = (unsigned) nb_sectors * BDRV_SECTOR_SIZE; if (bytes_base + bytes_res <= bytes_limit) { /* no wait */ } else { /* operation needs to be throttled */ } As a result, any I/O operations that are triggered between now and bs->slice_end are incorrectly limited. If 10 MB of data has been written since the VM was started, QEMU thinks that 10 MB of data has been written in this slice. This leads to a I/O lockup in the guest. We fix this by delaying the start of a new slice to the next call of bdrv_exceed_io_limits(). Signed-off-by: Peter Lieven Reviewed-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi --- block.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/block.c b/block.c index b5e64ec..4a90dd1 100644 --- a/block.c +++ b/block.c @@ -155,10 +155,6 @@ void bdrv_io_limits_enable(BlockDriverState *bs) { qemu_co_queue_init(&bs->throttled_reqs); bs->block_timer = qemu_new_timer_ns(vm_clock, bdrv_block_timer, bs); - bs->slice_time = 5 * BLOCK_IO_SLICE_TIME; - bs->slice_start = qemu_get_clock_ns(vm_clock); - bs->slice_end = bs->slice_start + bs->slice_time; - memset(&bs->io_base, 0, sizeof(bs->io_base)); bs->io_limits_enabled = true; }