[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] virtio: Drop out of coroutine context in virtio_load()
From: |
Kevin Wolf |
Subject: |
Re: [PATCH 2/2] virtio: Drop out of coroutine context in virtio_load() |
Date: |
Fri, 8 Sep 2023 10:59:48 +0200 |
Am 07.09.2023 um 20:40 hat Stefan Hajnoczi geschrieben:
> On Tue, Sep 05, 2023 at 04:50:02PM +0200, Kevin Wolf wrote:
> > virtio_load() as a whole should run in coroutine context because it
> > reads from the migration stream and we don't want this to block.
>
> Is that "should" a "must" or a "can"?
>
> If it's a "must" then virtio_load() needs assert(qemu_in_coroutine()).
>
> But the previous patch mentioned that loadvm for snapshots calls it
> outside coroutine context. So maybe it's a "can"?
Where this makes a difference is when the function indirectly calls into
QIOChannel. When called from a coroutine, it yields while waiting for
I/O, and outside of a coroutine it blocks. Yielding is always
preferable, but in cases like HMP savevm/loadvm we also don't really
care because it's synchronous anyway.
Whether that makes it a MAY or a SHOULD in the RFC sense, you decide.
If you wanted to make it a MUST, you'd need to check all callers first
and change some of them.
Kevin
signature.asc
Description: PGP signature