[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH] block/linux-aio: acquire AioContext before qemu
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-block] [PATCH] block/linux-aio: acquire AioContext before qemu_laio_process_completions |
Date: |
Thu, 13 Sep 2018 17:22:51 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 05/09/2018 13:23, Sergio Lopez wrote:
> diff --git a/block/linux-aio.c b/block/linux-aio.c
> index 19eb922fdd..217ce60138 100644
> --- a/block/linux-aio.c
> +++ b/block/linux-aio.c
> @@ -234,9 +234,9 @@ static void qemu_laio_process_completions(LinuxAioState
> *s)
>
> static void qemu_laio_process_completions_and_submit(LinuxAioState *s)
> {
> + aio_context_acquire(s->aio_context);
> qemu_laio_process_completions(s);
>
> - aio_context_acquire(s->aio_context);
> if (!s->io_q.plugged && !QSIMPLEQ_EMPTY(&s->io_q.pending)) {
> ioq_submit(s);
> }
>
The patch is correct, but I think it's papering over the real issue; as
Kevin pointed out recently, the sticking issue is calling aio_poll from
other threads---which right now we're only doing in bdrv_set_aio_context
and bdrv_drain_poll_top_level.
As to the call in bdrv_drain(), Kevin has just posted the series to
remove it.
For the other one, I think we can replace it with AIO_WAIT_WHILE or
BDRV_POLL_WHILE and do the aio_poll in the BlockDriverState's home iothread.
That said, I have nothing against applying it since all it does is move
a function call, that can be removed completely once the underlying root
cause is fixed (the AioContext lock will disappear).
Reviewed-by: Paolo Bonzini <address@hidden>
Thanks,
Paolo