From: Ryan Harper <ryanh@us.ibm.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Ryan Harper <ryanh@us.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 0/3] better I/O accounting V2
Date: Mon, 22 Aug 2011 11:46:00 -0500 [thread overview]
Message-ID: <20110822164600.GU5792@us.ibm.com> (raw)
In-Reply-To: <20110822153514.GA4749@lst.de>
* Christoph Hellwig <hch@lst.de> [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 <ryanh@us.ibm.com>
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
next prev parent reply other threads:[~2011-08-22 16:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-21 22:25 [Qemu-devel] [PATCH 0/3] better I/O accounting V2 Christoph Hellwig
2011-08-21 22:25 ` [Qemu-devel] [PATCH 1/3] block: include flush requests in info blockstats Christoph Hellwig
2011-08-21 22:26 ` [Qemu-devel] [PATCH 2/3] block: explicit I/O accounting Christoph Hellwig
2011-08-22 15:48 ` Kevin Wolf
2011-08-24 18:22 ` Christoph Hellwig
2011-08-21 22:26 ` [Qemu-devel] [PATCH 3/3] block: latency accounting Christoph Hellwig
2011-08-22 8:45 ` [Qemu-devel] [PATCH 0/3] better I/O accounting V2 Stefan Hajnoczi
2011-08-22 14:59 ` Ryan Harper
2011-08-22 15:12 ` Christoph Hellwig
2011-08-22 15:29 ` Ryan Harper
2011-08-22 15:35 ` Christoph Hellwig
2011-08-22 16:46 ` Ryan Harper [this message]
2011-08-24 18:45 ` Christoph Hellwig
2011-08-25 16:41 ` Ryan Harper
2011-08-22 15:55 ` Kevin Wolf
2011-08-25 6:25 ` [Qemu-devel] [PATCH 0/3] better I/O accounting V3 Christoph Hellwig
2011-08-25 6:25 ` [Qemu-devel] [PATCH 1/3] block: include flush requests in info blockstats Christoph Hellwig
2011-08-25 6:26 ` [Qemu-devel] [PATCH 2/3] block: explicit I/O accounting Christoph Hellwig
2011-08-25 6:26 ` [Qemu-devel] [PATCH 3/3] block: latency accounting Christoph Hellwig
2011-08-26 13:05 ` Kevin Wolf
2011-08-26 16:06 ` Christoph Hellwig
2011-08-25 16:10 ` [Qemu-devel] [PATCH 0/3] better I/O accounting V3 Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110822164600.GU5792@us.ibm.com \
--to=ryanh@us.ibm.com \
--cc=hch@lst.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).