From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwiOW-0007XZ-A8 for qemu-devel@nongnu.org; Fri, 27 Dec 2013 20:08:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwiOR-0005aK-BM for qemu-devel@nongnu.org; Fri, 27 Dec 2013 20:08:48 -0500 Received: from mail-gg0-f175.google.com ([209.85.161.175]:50035) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwiOR-0005aG-6y for qemu-devel@nongnu.org; Fri, 27 Dec 2013 20:08:43 -0500 Received: by mail-gg0-f175.google.com with SMTP id u2so1980799ggn.34 for ; Fri, 27 Dec 2013 17:08:42 -0800 (PST) Message-ID: <52BE246D.4070704@inktank.com> Date: Fri, 27 Dec 2013 17:07:57 -0800 From: Josh Durgin MIME-Version: 1.0 References: <1386257913-13700-1-git-send-email-stefanha@redhat.com> In-Reply-To: <1386257913-13700-1-git-send-email-stefanha@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] rbd: switch from pipe to QEMUBH completion notification List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Kevin Wolf On 12/05/2013 07:38 AM, 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 > --- > Josh: This patch has not been tested. I have just compiled it. Sorry for the delay. This is a great simplification, and it passed my tests. Thanks! Reviewed- and Tested-by: Josh Durgin