From: Christoph Hellwig <hch@lst.de>
To: Ryan Harper <ryanh@us.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 0/3] better I/O accounting V2
Date: Wed, 24 Aug 2011 20:45:06 +0200 [thread overview]
Message-ID: <20110824184506.GA20556@lst.de> (raw)
In-Reply-To: <20110822164600.GU5792@us.ibm.com>
On Mon, Aug 22, 2011 at 11:46:00AM -0500, Ryan Harper wrote:
> 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.
We do initialize all write fields correctly. Where we fail right now
is for non-read/write requests. I can reproduce your issue by reading
the serial attribute in sysfs - any chance Fedora does that during boot?
The patch below should take care of these cases:
Index: qemu/hw/virtio-blk.c
===================================================================
--- qemu.orig/hw/virtio-blk.c 2011-08-24 20:32:03.764503179 +0200
+++ qemu/hw/virtio-blk.c 2011-08-24 20:35:55.716579922 +0200
@@ -59,9 +59,6 @@ static void virtio_blk_req_complete(Virt
stb_p(&req->in->status, status);
virtqueue_push(s->vq, &req->elem, req->qiov.size + sizeof(*req->in));
virtio_notify(&s->vdev, s->vq);
-
- bdrv_acct_done(s->bs, &req->acct);
- g_free(req);
}
static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
@@ -83,6 +80,8 @@ static int virtio_blk_handle_rw_error(Vi
vm_stop(VMSTOP_DISKFULL);
} else {
virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
+ bdrv_acct_done(s->bs, &req->acct);
+ g_free(req);
bdrv_mon_event(s->bs, BDRV_ACTION_REPORT, is_read);
}
@@ -102,6 +101,8 @@ static void virtio_blk_rw_complete(void
}
virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
+ bdrv_acct_done(req->dev->bs, &req->acct);
+ g_free(req);
}
static void virtio_blk_flush_complete(void *opaque, int ret)
@@ -115,6 +116,8 @@ static void virtio_blk_flush_complete(vo
}
virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
+ bdrv_acct_done(req->dev->bs, &req->acct);
+ g_free(req);
}
static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s)
@@ -157,6 +160,7 @@ static void virtio_blk_handle_scsi(VirtI
*/
if (req->elem.out_num < 2 || req->elem.in_num < 3) {
virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
+ g_free(req);
return;
}
@@ -165,6 +169,7 @@ static void virtio_blk_handle_scsi(VirtI
*/
if (req->elem.out_num > 2 && req->elem.in_num > 3) {
virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP);
+ g_free(req);
return;
}
@@ -231,11 +236,13 @@ static void virtio_blk_handle_scsi(VirtI
stl_p(&req->scsi->data_len, hdr.dxfer_len);
virtio_blk_req_complete(req, status);
+ g_free(req);
}
#else
static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
{
virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP);
+ g_free(req);
}
#endif /* __linux__ */
@@ -378,6 +385,7 @@ static void virtio_blk_handle_request(Vi
s->serial ? s->serial : "",
MIN(req->elem.in_sg[0].iov_len, VIRTIO_BLK_ID_BYTES));
virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
+ g_free(req);
} else if (type & VIRTIO_BLK_T_OUT) {
qemu_iovec_init_external(&req->qiov, &req->elem.out_sg[1],
req->elem.out_num - 1);
next prev parent reply other threads:[~2011-08-24 18:45 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
2011-08-24 18:45 ` Christoph Hellwig [this message]
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=20110824184506.GA20556@lst.de \
--to=hch@lst.de \
--cc=qemu-devel@nongnu.org \
--cc=ryanh@us.ibm.com \
/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).