[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC 0/9] block: Rewrite block drain begin/end
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH RFC 0/9] block: Rewrite block drain begin/end |
Date: |
Fri, 1 Dec 2017 17:51:20 +0800 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Thu, 11/30 17:04, Paolo Bonzini wrote:
> On 30/11/2017 16:10, Kevin Wolf wrote:
> >> Yes, I agree, but that (using CoMutex around graph change) requires
> >> everything, especially the defer_to_main_loop_bh, runs in a coroutine
> >> context, which is exactly what I mean by "introducing 'ubiquitous
> >> coroutines'", because currently we don't have them.
> > Is it hard to do, though? Instead of using a BH to switch to the main
> > loop and outside of coroutine context, you could use aio_co_schedule()
> > and yield, which would leave you in the main loop, but still in
> > coroutine context.
>
> Not that I think of, but just aio_co_schedule wouldn't work, because
> "the coroutine must have yielded unless ctx is the context in which the
> coroutine is running (i.e. the value of qemu_get_current_aio_context()
> from the coroutine itself)".
>
> So you'd have to use a bottom half that calls aio_co_schedule. But that
> would work.
>
We have QMP commands that can manupulate the graph which are all not coroutines.
I think running QMP commands in coroutines has it merit especially regarding to
the nested event loops.
Also the bdrv_close_all() and similar at the end of main() do draining too,
which I'm not sure how to deal with. Maybe special case them and forget the
draining CoMutex?
Fam
- Re: [Qemu-devel] [PATCH RFC 0/9] block: Rewrite block drain begin/end,
Fam Zheng <=