From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WukPA-0008M9-2j for qemu-devel@nongnu.org; Wed, 11 Jun 2014 11:25:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WukP3-00061h-4C for qemu-devel@nongnu.org; Wed, 11 Jun 2014 11:25:36 -0400 Received: from mail-we0-f179.google.com ([74.125.82.179]:36665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WukP2-00061b-UI for qemu-devel@nongnu.org; Wed, 11 Jun 2014 11:25:29 -0400 Received: by mail-we0-f179.google.com with SMTP id w62so4816614wes.38 for ; Wed, 11 Jun 2014 08:25:27 -0700 (PDT) From: David Marchand Date: Wed, 11 Jun 2014 17:25:16 +0200 Message-Id: <1402500316-6894-1-git-send-email-david.marchand@6wind.com> In-Reply-To: <53986E13.4090607@redhat.com> References: <53986E13.4090607@redhat.com> Subject: [Qemu-devel] [PATCH v2] 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: pbonzini@redhat.com, cam@cs.ualberta.ca, kraxel@redhat.com, aliguori@amazon.com 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. 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) Changes since v1 - fix coding style issue (missing braces) -- David Marchand diff --git a/qemu-char.c b/qemu-char.c index 17b476e..53eccc2 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2493,7 +2493,13 @@ 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 -- 1.7.10.4