From: Max Reitz <mreitz@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Qemu-block <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 1/2] vl: Drain before (block) job cancel when quitting
Date: Thu, 13 Jun 2019 18:03:04 +0200 [thread overview]
Message-ID: <00cce102-a1f1-9205-6eb7-1e48d8991b00@redhat.com> (raw)
In-Reply-To: <57ae7f82-ae02-a382-74f6-cb96672b2058@virtuozzo.com>
[-- Attachment #1.1: Type: text/plain, Size: 2667 bytes --]
[re-adding the original CCs, why not]
On 13.06.19 16:30, Vladimir Sementsov-Ogievskiy wrote:
> 13.06.2019 17:21, Max Reitz wrote:
>> On 13.06.19 16:19, Vladimir Sementsov-Ogievskiy wrote:
>>> 13.06.2019 1:08, Max Reitz wrote:
>>>> If the main loop cancels all block jobs while the block layer is not
>>>> drained, this cancelling may not happen instantaneously. We can start a
>>>> drained section before vm_shutdown(), which entails another
>>>> bdrv_drain_all(); this nested bdrv_drain_all() will thus be a no-op,
>>>> basically.
>>>>
>>>> We do not have to end the drained section, because we actually do not
>>>> want any requests to happen from this point on.
>>>>
>>>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>>>> ---
>>>> I don't know whether it actually makes sense to never end this drained
>>>> section. It makes sense to me. Please correct me if I'm wrong.
>>>> ---
>>>> vl.c | 11 +++++++++++
>>>> 1 file changed, 11 insertions(+)
>>>>
>>>> diff --git a/vl.c b/vl.c
>>>> index cd1fbc4cdc..3f8b3f74f5 100644
>>>> --- a/vl.c
>>>> +++ b/vl.c
>>>> @@ -4538,6 +4538,17 @@ int main(int argc, char **argv, char **envp)
>>>> */
>>>> migration_shutdown();
>>>>
>>>> + /*
>>>> + * We must cancel all block jobs while the block layer is drained,
>>>> + * or cancelling will be affected by throttling and thus may block
>>>> + * for an extended period of time.
>>>> + * vm_shutdown() will bdrv_drain_all(), so we may as well include
>>>> + * it in the drained section.
>>>> + * We do not need to end this section, because we do not want any
>>>> + * requests happening from here on anyway.
>>>> + */
>>>> + bdrv_drain_all_begin();
>>>> +
>>>> /* No more vcpu or device emulation activity beyond this point */
>>>> vm_shutdown();
>>>>
>>>>
>>>
>>> So, actually, the problem is that we may wait for job requests twice:
>>> on drain and then on cancel.
>>
>> We don’t wait on drain. When the throttle node is drained, it will
>> ignore throttling (as noted in the cover letter).
>>
>> We do wait when cancelling a job while the throttle node isn’t drained,
>> though. That’s the problem.
>
> Ah, understand now.
>
> Is it safe to drain_begin before stopping cpus? We may finish up then with some queued
> somewhere IO requests..
Hm... Aren’t guest devices prohibited from issuing requests to the
block layer while their respective block device is drained?
Otherwise, I suppose I’ll have to move the bdrv_drain_all_begin() below
the vm_shutdown(). That wouldn’t be too big of a problem.
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-06-13 18:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 22:08 [Qemu-devel] [PATCH 0/2] vl: Drain before (block) job cancel when quitting Max Reitz
2019-06-12 22:08 ` [Qemu-devel] [PATCH 1/2] " Max Reitz
[not found] ` <b110b753-8546-0d34-f6ef-06c5726766ce@virtuozzo.com>
[not found] ` <c1fbf12a-77af-d939-4266-67b822e5a923@redhat.com>
[not found] ` <57ae7f82-ae02-a382-74f6-cb96672b2058@virtuozzo.com>
2019-06-13 16:03 ` Max Reitz [this message]
2019-06-14 9:22 ` Vladimir Sementsov-Ogievskiy
2019-06-19 19:40 ` Max Reitz
2019-07-16 7:00 ` Philippe Mathieu-Daudé
2019-06-12 22:08 ` [Qemu-devel] [PATCH 2/2] iotests: Test quitting with job on throttled node Max Reitz
2019-06-12 22:31 ` [Qemu-devel] [PATCH 0/2] vl: Drain before (block) job cancel when quitting Max Reitz
2019-07-19 13:26 ` Kevin Wolf
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=00cce102-a1f1-9205-6eb7-1e48d8991b00@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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).