qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Josh Durgin <josh.durgin@inktank.com>
Subject: Re: [Qemu-devel] [PATCH] rbd: switch from pipe to QEMUBH completion notification
Date: Thu, 2 Jan 2014 11:54:02 +0800	[thread overview]
Message-ID: <20140102035402.GA17580@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1386257913-13700-1-git-send-email-stefanha@redhat.com>

On Thu, Dec 05, 2013 at 04:38:33PM +0100, Stefan Hajnoczi wrote:
> rbd callbacks are called from non-QEMU threads.  Up until now a pipe was
> used to signal completion back to the QEMU iothread.
> 
> The pipe writer code handles EAGAIN using select(2).  The select(2) API
> is not scalable since fd_set size is static.  FD_SET() can write beyond
> the end of fd_set if the file descriptor number is too high.  (QEMU's
> main loop uses poll(2) to avoid this issue with select(2).)
> 
> Since the pipe itself is quite clumsy to use and QEMUBH is now
> thread-safe, just schedule a BH from the rbd callback function.  This
> way we can simplify I/O completion in addition to eliminating the
> potential FD_SET() crash when file descriptor numbers become too high.
> 
> Crash scenario: QEMU already has 1024 file descriptors open.  Hotplug an
> rbd drive and get the pipe writer to take the select(2) code path.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> Josh: This patch has not been tested.  I have just compiled it.
> 
>  block/rbd.c | 130 ++++++++++--------------------------------------------------
>  1 file changed, 22 insertions(+), 108 deletions(-)

Applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next

Stefan

      parent reply	other threads:[~2014-01-02  3:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05 15:38 [Qemu-devel] [PATCH] rbd: switch from pipe to QEMUBH completion notification Stefan Hajnoczi
2013-12-28  1:07 ` Josh Durgin
2014-01-02  3:54 ` Stefan Hajnoczi [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=20140102035402.GA17580@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=josh.durgin@inktank.com \
    --cc=kwolf@redhat.com \
    --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).