[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/15] block: fix initialization in bdrv_io_limits_e
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 02/15] block: fix initialization in bdrv_io_limits_enable() |
Date: |
Tue, 15 Jan 2013 17:48:18 +0100 |
From: Peter Lieven <address@hidden>
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 <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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;
}
--
1.8.0.2
- [Qemu-devel] [PULL 00/15] Block patches for QEMU 1.4, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 01/15] qcow2: Fix segfault on zero-length write, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 05/15] raw: support discard on block devices, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 02/15] block: fix initialization in bdrv_io_limits_enable(),
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 04/15] raw-posix: remember whether discard failed, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 03/15] raw-posix: support discard on more filesystems, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 06/15] block: make discard asynchronous, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 07/15] ide: fix TRIM with empty range entry, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 08/15] ide: issue discard asynchronously but serialize the pieces, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 09/15] block: clear dirty bitmap when discarding, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 12/15] w32: Make qemu_vfree() accept NULL like the POSIX implementation, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 11/15] sheepdog: clean up sd_aio_setup(), Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 13/15] scsi-disk: qemu_vfree(NULL) is fine, simplify, Stefan Hajnoczi, 2013/01/15
- [Qemu-devel] [PATCH 14/15] win32-aio: Fix how win32_aio_process_completion() frees buffer, Stefan Hajnoczi, 2013/01/15