From: Max Reitz <mreitz@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
Kevin Wolf <kwolf@redhat.com>,
sochin jiang <sochin.jiang@huawei.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] block: Leave valid throttle timers when removing a BDS from a backend
Date: Fri, 10 Nov 2017 21:27:51 +0100 [thread overview]
Message-ID: <e84b73c5-5d27-0a99-0f39-00719bb4f61b@redhat.com> (raw)
In-Reply-To: <e089c66e7c20289b046d782cea4373b765c5bc1d.1510339534.git.berto@igalia.com>
[-- Attachment #1: Type: text/plain, Size: 1713 bytes --]
On 2017-11-10 19:54, Alberto Garcia wrote:
> If a BlockBackend has I/O limits set then its ThrottleGroupMember
> structure uses the AioContext from its attached BlockDriverState.
> Those two contexts must be kept in sync manually. This is not
> ideal and will be fixed in the future by removing the throttling
> configuration from the BlockBackend and storing it in an implicit
> filter node instead, but for now we have to live with this.
>
> When you remove the BlockDriverState from the backend then the
> throttle timers are destroyed. If a new BlockDriverState is later
> inserted then they are created again using the new AioContext.
>
> There'a a couple of problems with this:
>
> a) The code manipulates the timers directly, leaving the
> ThrottleGroupMember.aio_context field in an inconsisent state.
>
> b) If you remove the I/O limits (e.g by destroying the backend)
> when the timers are gone then throttle_group_unregister_tgm()
> will attempt to destroy them again, crashing QEMU.
>
> While b) could be fixed easily by allowing the timers to be freed
> twice, this would result in a situation in which we can no longer
> guarantee that a valid ThrottleState has a valid AioContext and
> timers.
>
> This patch ensures that the timers and AioContext are always valid
> when I/O limits are set, regardless of whether the BlockBackend has a
> BlockDriverState inserted or not.
>
> Reported-by: sochin jiang <sochin.jiang@huawei.com>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> block/block-backend.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
Reviewed-by: Max Reitz <mreitz@redhat.com>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
next prev parent reply other threads:[~2017-11-10 20:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-10 18:54 [Qemu-devel] [PATCH 0/3] Fix throttling crashes in BlockBackend with no BlockDriverState Alberto Garcia
2017-11-10 18:54 ` [Qemu-devel] [PATCH 1/3] block: Check for inserted BlockDriverState in blk_io_limits_disable() Alberto Garcia
2017-11-10 20:16 ` Max Reitz
2017-11-10 18:54 ` [Qemu-devel] [PATCH 2/3] block: Leave valid throttle timers when removing a BDS from a backend Alberto Garcia
2017-11-10 20:27 ` Max Reitz [this message]
2017-11-10 22:06 ` Alberto Garcia
2017-11-10 22:08 ` Max Reitz
2017-11-10 22:32 ` Alberto Garcia
2017-11-10 18:54 ` [Qemu-devel] [PATCH 3/3] qemu-iotests: Test I/O limits with removable media Alberto Garcia
2017-11-10 20:34 ` Max Reitz
2017-11-10 22:21 ` Max Reitz
2017-11-13 14:08 ` Alberto Garcia
2017-11-13 15:49 ` Stefan Hajnoczi
2017-11-13 15:57 ` Alberto Garcia
2017-11-13 15:49 ` [Qemu-devel] [PATCH 0/3] Fix throttling crashes in BlockBackend with no BlockDriverState 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=e84b73c5-5d27-0a99-0f39-00719bb4f61b@redhat.com \
--to=mreitz@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sochin.jiang@huawei.com \
--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).