Received: from eggs.gnu.org ([2001:4830:134:3::10]:44048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAnNe-0006JN-Kg for qemu-devel@nongnu.org; Tue, 04 Feb 2014 16:18:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAnNY-0005xI-5A for qemu-devel@nongnu.org; Tue, 04 Feb 2014 16:18:06 -0500 Received: from mail-wg0-f44.google.com ([74.125.82.44]:59493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAnNX-0005xB-Uy for qemu-devel@nongnu.org; Tue, 04 Feb 2014 16:18:00 -0500 Received: by mail-wg0-f44.google.com with SMTP id l18so13231491wgh.11 for ; Tue, 04 Feb 2014 13:17:58 -0800 (PST) From: David Marchand Date: Tue, 4 Feb 2014 22:17:46 +0100 Message-Id: <1391548666-5513-1-git-send-email-david.marchand@6wind.com> Subject: [Qemu-devel] [PATCH RFC] char: fix avail_connections init in qemu_chr_open_eventfd() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori Hello, First of all, this is a pure RFC patch, I did not take too much time to dig into qemu source code to find the right solution, but since qemu_chr_open_eventfd() is only used by the code I was looking at, here is a patch. When trying to use a ivshmem server with qemu, ivshmem init code tries to create a CharDriverState object for each eventfd retrieved from the server. To create this object, a call to qemu_chr_open_eventfd() is done. Right after this, before adding a frontend, qemu_chr_fe_claim_no_fail() is called. qemu_chr_open_eventfd() does not set avail_connections to 1, so no frontend can be associated because qemu_chr_fe_claim_no_fail() makes qemu stop right away. I suppose this problem comes from 456d60692310e7ac25cf822cc1e98192ad636ece "qemu-char: Call fe_claim / fe_release when not using qdev chr properties". Fix this, by setting avail_connections to 1 in qemu_chr_open_eventfd(). Signed-off-by: David Marchand --- qemu-char.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qemu-char.c b/qemu-char.c index 30c5a6a..c0adb04 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2492,7 +2492,12 @@ static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) #ifndef _WIN32 CharDriverState *qemu_chr_open_eventfd(int eventfd) { - return qemu_chr_open_fd(eventfd, eventfd); + CharDriverState *chr = qemu_chr_open_fd(eventfd, eventfd); + + if (chr) + chr->avail_connections = 1; + + return chr; } #endif -- David Marchand