* [Qemu-devel] [PULL for-v3.0 0/1] Block patches
@ 2018-07-19 14:28 Stefan Hajnoczi
2018-07-19 14:28 ` [Qemu-devel] [PULL for-v3.0 1/1] throttle-groups: fix hang when group member leaves Stefan Hajnoczi
2018-07-19 15:55 ` [Qemu-devel] [PULL for-v3.0 0/1] Block patches Peter Maydell
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2018-07-19 14:28 UTC (permalink / raw)
To: qemu-devel
Cc: Max Reitz, qemu-block, Alberto Garcia, Kevin Wolf, Peter Maydell,
Stefan Hajnoczi
The following changes since commit ea6abffa8a08d832feb759d359d5b935e3087cf7:
Update version for v3.0.0-rc1 release (2018-07-17 18:15:19 +0100)
are available in the Git repository at:
git://github.com/stefanha/qemu.git tags/block-pull-request
for you to fetch changes up to 6fccbb475bc6effc313ee9481726a1748b6dae57:
throttle-groups: fix hang when group member leaves (2018-07-19 13:08:26 +0100)
----------------------------------------------------------------
Pull request
This fix prevents hangs when a drive leaves a throttling group.
----------------------------------------------------------------
Stefan Hajnoczi (1):
throttle-groups: fix hang when group member leaves
block/throttle-groups.c | 4 ++++
1 file changed, 4 insertions(+)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PULL for-v3.0 1/1] throttle-groups: fix hang when group member leaves
2018-07-19 14:28 [Qemu-devel] [PULL for-v3.0 0/1] Block patches Stefan Hajnoczi
@ 2018-07-19 14:28 ` Stefan Hajnoczi
2018-07-19 15:55 ` [Qemu-devel] [PULL for-v3.0 0/1] Block patches Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2018-07-19 14:28 UTC (permalink / raw)
To: qemu-devel
Cc: Max Reitz, qemu-block, Alberto Garcia, Kevin Wolf, Peter Maydell,
Stefan Hajnoczi
Throttle groups consist of members sharing one throttling state
(including bps/iops limits). Round-robin scheduling is used to ensure
fairness. If a group member already has a timer pending then other
groups members do not schedule their own timers. The next group member
will have its turn when the existing timer expires.
A hang may occur when a group member leaves while it had a timer
scheduled. Although the code carefully removes the group member from
the round-robin list, it does not schedule the next member. Therefore
remaining members continue to wait for the removed member's timer to
expire.
This patch schedules the next request if a timer is pending.
Unfortunately the actual bug is a race condition that I've been unable
to capture in a test case.
Sometimes drive2 hangs when drive1 is removed from the throttling group:
$ qemu ... -drive if=none,id=drive1,cache=none,format=qcow2,file=data1.qcow2,iops=100,group=foo \
-device virtio-blk-pci,id=virtio-blk-pci0,drive=drive1 \
-drive if=none,id=drive2,cache=none,format=qcow2,file=data2.qcow2,iops=10,group=foo \
-device virtio-blk-pci,id=virtio-blk-pci1,drive=drive2
(guest-console1)# fio -filename /dev/vda 4k-seq-read.job
(guest-console2)# fio -filename /dev/vdb 4k-seq-read.job
(qmp) {"execute": "block_set_io_throttle", "arguments": {"device": "drive1","bps": 0,"bps_rd": 0,"bps_wr": 0,"iops": 0,"iops_rd": 0,"iops_wr": 0}}
Reported-by: Nini Gu <ngu@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20180704145410.794-1-stefanha@redhat.com
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1535914
Cc: Alberto Garcia <berto@igalia.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/throttle-groups.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/throttle-groups.c b/block/throttle-groups.c
index 36cc0430c3..e297b04e17 100644
--- a/block/throttle-groups.c
+++ b/block/throttle-groups.c
@@ -564,6 +564,10 @@ void throttle_group_unregister_tgm(ThrottleGroupMember *tgm)
qemu_mutex_lock(&tg->lock);
for (i = 0; i < 2; i++) {
+ if (timer_pending(tgm->throttle_timers.timers[i])) {
+ tg->any_timer_armed[i] = false;
+ schedule_next_request(tgm, i);
+ }
if (tg->tokens[i] == tgm) {
token = throttle_group_next_tgm(tgm);
/* Take care of the case where this is the last tgm in the group */
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PULL for-v3.0 0/1] Block patches
2018-07-19 14:28 [Qemu-devel] [PULL for-v3.0 0/1] Block patches Stefan Hajnoczi
2018-07-19 14:28 ` [Qemu-devel] [PULL for-v3.0 1/1] throttle-groups: fix hang when group member leaves Stefan Hajnoczi
@ 2018-07-19 15:55 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2018-07-19 15:55 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: QEMU Developers, Max Reitz, Qemu-block, Alberto Garcia, Kevin Wolf
On 19 July 2018 at 15:28, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The following changes since commit ea6abffa8a08d832feb759d359d5b935e3087cf7:
>
> Update version for v3.0.0-rc1 release (2018-07-17 18:15:19 +0100)
>
> are available in the Git repository at:
>
> git://github.com/stefanha/qemu.git tags/block-pull-request
>
> for you to fetch changes up to 6fccbb475bc6effc313ee9481726a1748b6dae57:
>
> throttle-groups: fix hang when group member leaves (2018-07-19 13:08:26 +0100)
>
> ----------------------------------------------------------------
> Pull request
>
> This fix prevents hangs when a drive leaves a throttling group.
>
> ----------------------------------------------------------------
>
> Stefan Hajnoczi (1):
> throttle-groups: fix hang when group member leaves
>
> block/throttle-groups.c | 4 ++++
> 1 file changed, 4 insertions(+)
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-19 15:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 14:28 [Qemu-devel] [PULL for-v3.0 0/1] Block patches Stefan Hajnoczi
2018-07-19 14:28 ` [Qemu-devel] [PULL for-v3.0 1/1] throttle-groups: fix hang when group member leaves Stefan Hajnoczi
2018-07-19 15:55 ` [Qemu-devel] [PULL for-v3.0 0/1] Block patches Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.