qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Is bdrv_poll_co() IO_CODE()?
@ 2022-11-10 21:25 Stefan Hajnoczi
  2022-11-11 11:22 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2022-11-10 21:25 UTC (permalink / raw)
  To: Emanuele Giuseppe Esposito
  Cc: Vladimir Sementsov-Ogievskiy, qemu-block, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

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?

Thanks,
Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Is bdrv_poll_co() IO_CODE()?
  2022-11-10 21:25 Is bdrv_poll_co() IO_CODE()? Stefan Hajnoczi
@ 2022-11-11 11:22 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2022-11-11 11:22 UTC (permalink / raw)
  To: Stefan Hajnoczi, Emanuele Giuseppe Esposito
  Cc: Vladimir Sementsov-Ogievskiy, qemu-block, qemu-devel

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-11 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-10 21:25 Is bdrv_poll_co() IO_CODE()? Stefan Hajnoczi
2022-11-11 11:22 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).