From: Stefan Hajnoczi <stefanha@gmail.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] throttle-groups: fix hang when group member leaves
Date: Tue, 17 Jul 2018 09:11:43 +0100 [thread overview]
Message-ID: <20180717081143.GA28999@stefanha-x1.localdomain> (raw)
In-Reply-To: <20180704145410.794-1-stefanha@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]
On Wed, Jul 04, 2018 at 03:54:10PM +0100, Stefan Hajnoczi wrote:
> 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>
> 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(+)
Berto is away in July. I am merging this fix for QEMU 3.0. If there
are any comments when Berto is back I'll send a follow-up patch.
Applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
next prev parent reply other threads:[~2018-07-17 8:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-04 14:54 [Qemu-devel] [PATCH] throttle-groups: fix hang when group member leaves Stefan Hajnoczi
2018-07-11 12:32 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-07-13 12:19 ` Kashyap Chamarthy
2018-07-17 8:11 ` Stefan Hajnoczi [this message]
2018-07-31 13:47 ` [Qemu-devel] " Alberto Garcia
2018-07-31 16:47 ` Alberto Garcia
2018-08-01 14:45 ` Alberto Garcia
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=20180717081143.GA28999@stefanha-x1.localdomain \
--to=stefanha@gmail.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).