[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] rbd: switch from pipe to QEMUBH completion noti
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH] rbd: switch from pipe to QEMUBH completion notification |
Date: |
Thu, 2 Jan 2014 11:54:02 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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 <address@hidden>
> ---
> 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH] rbd: switch from pipe to QEMUBH completion notification,
Stefan Hajnoczi <=