From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvXda-0002mr-5Y for qemu-devel@nongnu.org; Mon, 22 Aug 2011 12:46:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvXdZ-00069m-2F for qemu-devel@nongnu.org; Mon, 22 Aug 2011 12:46:10 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:42948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvXdY-00069h-Rw for qemu-devel@nongnu.org; Mon, 22 Aug 2011 12:46:09 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e9.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p7MGCOXZ012353 for ; Mon, 22 Aug 2011 12:12:24 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7MGk7Lf2920468 for ; Mon, 22 Aug 2011 12:46:07 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7MCjsEb000688 for ; Mon, 22 Aug 2011 09:45:54 -0300 Date: Mon, 22 Aug 2011 11:46:00 -0500 From: Ryan Harper Message-ID: <20110822164600.GU5792@us.ibm.com> References: <20110821222547.GA22046@lst.de> <20110822145916.GS5792@us.ibm.com> <20110822151208.GB4130@lst.de> <20110822152911.GT5792@us.ibm.com> <20110822153514.GA4749@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110822153514.GA4749@lst.de> Subject: Re: [Qemu-devel] [PATCH 0/3] better I/O accounting V2 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: Ryan Harper , qemu-devel@nongnu.org * Christoph Hellwig [2011-08-22 10:37]: > On Mon, Aug 22, 2011 at 10:29:11AM -0500, Ryan Harper wrote: > > (gdb) frame 0 > > #0 0x00000000004200c1 in bdrv_acct_done (bs=0x12310b0, cookie=0x1c68810) at /root/git/qemu/block_int.h:239 239 bs->nr_bytes[cookie->type] += cookie->bytes; > > (gdb) p *cookie > > $3 = {bytes = 72057589759737855, start_time_ns = 72057589759737855, type = 16777215} > > So it is indeed corrupted. I'll try to figure out how that could have > happened. So, I believe this is how it's happening. we start accounting on a write which is turned into a multiwrite via virtio_blk_handle_write() which calls virtio_submit_multiwrite(). Then when the multiwrite completes, we invoke virtio_blk_rw_complete() on each part of the multiwrite. None of these requests have had their acct structure initialized since there was just *one* initial write. We could do a bdrv_acct_start() on each req, but that would break the concept of hiding the additional writes under the initial request. So ensuring that the acct field is initialed when the request is allocated will fix the issue. With this patch, I don't see the crash anymore. Signed-off-by: Ryan Harper diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 2660d1d..e746917 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -123,6 +123,7 @@ static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s) req->dev = s; req->qiov.size = 0; req->next = NULL; + memset(&req->acct, 0, sizeof(BlockAcctCookie)); return req; } -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com