qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is bdrv_poll_co() IO_CODE()?


From: Paolo Bonzini
Subject: Re: Is bdrv_poll_co() IO_CODE()?
Date: Fri, 11 Nov 2022 12:22:57 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0

On 11/10/22 22:25, Stefan Hajnoczi wrote:
Hi,
bdrv_coroutine_enter() is IO_CODE but is called from any coroutine
wrapper function. When there is an IOThread and main loop code calls a
coroutine wrapper function then I think bdrv_coroutine_enter() is called
from outside IO_CODE?

No, I think bdrv_poll_co() should be IO_OR_GS_CODE().

"These functions use BDRV_POLL_WHILE(bs), which requires the caller to be either in the main thread and hold the BlockdriverState (bs) AioContext lock, or directly in the home thread that runs the bs AioContext. Calling them from another thread in another AioContext would cause deadlocks." describes it very well.

bdrv_coroutine_enter() is IO_CODE because it's able to start the coroutine on the right iothread (using aio_co_schedule() if needed).

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]