Am 07.03.2023 um 11:58 hat Paolo Bonzini geschrieben: > On 3/7/23 09:48, Kevin Wolf wrote: > > You mean we have a device that has a separate iothread, but a request is > > submitted from the main thread? This isn't even allowed today; if a node > > is in an iothread, all I/O must be submitted from that iothread. Do you > > know any code that does submit I/O from the main thread instead? > > I think it is allowed, you just have to take the AioContext lock around the > bdrv_*?
Didn't we say at some point that we don't want to do this either? Though maybe it's not strictly forbidden then. > For example it could happen when you do block device migration. As in migration/block.c? As far as I can tell, all of the requests made there are actually processed in the iothread. (blk_aio_*() calls the callback in the iothread even when it was called from the main thread itself, which feels like a trap, but it shouldn't be affected by this change lower in the stack.) The potentially critical code would be coroutine_fns that call blk_co_*() or bdrv_co_*() directly while running in a different thread. Everything else schedules a new coroutine in the AioContext of the block node. Kevin