qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>,
	Emanuele Giuseppe Esposito <eesposit@redhat.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: Is bdrv_poll_co() IO_CODE()?
Date: Fri, 11 Nov 2022 12:22:57 +0100	[thread overview]
Message-ID: <d88e84a8-4bad-d491-6563-b5f30df9a700@redhat.com> (raw)
In-Reply-To: <Y21sUJMNc/I8iCzg@fedora>

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	other threads:[~2022-11-11 11:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 21:25 Is bdrv_poll_co() IO_CODE()? Stefan Hajnoczi
2022-11-11 11:22 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d88e84a8-4bad-d491-6563-b5f30df9a700@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=eesposit@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).