qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Iwan Budi Kusnanto <ibk@labhijau.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Qemu coroutine behaviour on blocking send(3)
Date: Fri, 28 Nov 2014 12:47:48 +0000	[thread overview]
Message-ID: <20141128124748.GK13631@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CALv1wjHW_YxJvLkEkHi0-sg8XjT+H9xbqLjPmzkUGToGBowd7g@mail.gmail.com>

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

On Fri, Nov 28, 2014 at 01:55:00PM +0700, Iwan Budi Kusnanto wrote:
> I meant, does the coroutine will do yield internally when it get
> blocked on send(3)?

No.  In general, QEMU will use non-blocking file descriptors so the
blocking case does not apply.  (You can't use blocking file descriptors
in an event loop without a risk of blocking the entire event loop.)

There is qemu_co_send(), which attempts the non-blocking send(2) and
yields on EAGAIN.

block/sheepdog.c and nbd.c both use this function.  It's a little ugly
because the caller must add/remove the socket write fd handler function
so that the coroutine is re-entered when the fd becomes writable again.

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-11-28 12:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28  6:50 [Qemu-devel] Qemu coroutine behaviour on blocking send(3) Iwan Budi Kusnanto
2014-11-28  6:55 ` Iwan Budi Kusnanto
2014-11-28 12:47   ` Stefan Hajnoczi [this message]
2014-11-28 13:46     ` Iwan Budi Kusnanto
2014-11-28 14:15       ` Paolo Bonzini

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=20141128124748.GK13631@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=ibk@labhijau.net \
    --cc=qemu-devel@nongnu.org \
    /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).