From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Lieven <pl@dlhnet.de>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] block: fix initialization in bdrv_io_limits_enable()
Date: Fri, 11 Jan 2013 13:57:11 +0100 [thread overview]
Message-ID: <50F00C27.601@redhat.com> (raw)
In-Reply-To: <50F005C3.5010305@dlhnet.de>
Il 11/01/2013 13:29, Peter Lieven ha scritto:
> 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 <pl@kamp.de>
> ---
> block.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/block.c b/block.c
> index 4e28c55..a40a389 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;
> }
>
Thanks!
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo
next prev parent reply other threads:[~2013-01-11 12:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 12:29 [Qemu-devel] [PATCH] block: fix initialization in bdrv_io_limits_enable() Peter Lieven
2013-01-11 12:57 ` Paolo Bonzini [this message]
2013-01-15 8:26 ` Stefan Hajnoczi
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=50F00C27.601@redhat.com \
--to=pbonzini@redhat.com \
--cc=pl@dlhnet.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).