[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 3/3] migration: avoid recursive Aio
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 3/3] migration: avoid recursive AioContext locking in save_vmstate() |
Date: |
Wed, 17 May 2017 15:24:55 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
On 05/17/2017 12:09 PM, Stefan Hajnoczi wrote:
> AioContext was designed to allow nested acquire/release calls. It uses
> a recursive mutex so callers don't need to worry about nesting...or so
> we thought.
>
> BDRV_POLL_WHILE() is used to wait for block I/O requests. It releases
> the AioContext temporarily around aio_poll(). This gives IOThreads a
> chance to acquire the AioContext to process I/O completions.
>
> It turns out that recursive locking and BDRV_POLL_WHILE() don't mix.
> BDRV_POLL_WHILE() only releases the AioContext once, so the IOThread
> will not be able to acquire the AioContext if it was acquired
> multiple times.
>
> Instead of trying to release AioContext n times in BDRV_POLL_WHILE(),
> this patch simply avoids nested locking in save_vmstate(). It's the
> simplest fix and we should step back to consider the big picture with
> all the recent changes to block layer threading.
>
> This patch is the final fix to solve 'savevm' hanging with -object
> iothread.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> migration/savevm.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH 1/3] block: count bdrv_co_rw_vmstate() requests, (continued)
[Qemu-block] [PATCH 3/3] migration: avoid recursive AioContext locking in save_vmstate(), Stefan Hajnoczi, 2017/05/17
Re: [Qemu-block] [Qemu-devel] [PATCH 0/3] block: fix 'savevm' hang with -object iothread, Paolo Bonzini, 2017/05/17