From patchwork Fri Jun 13 11:18:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 359503 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 092501400EA for ; Fri, 13 Jun 2014 21:19:12 +1000 (EST) Received: from localhost ([::1]:58200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvPVl-0007eH-UG for incoming@patchwork.ozlabs.org; Fri, 13 Jun 2014 07:19:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvPVK-0007Xh-9F for qemu-devel@nongnu.org; Fri, 13 Jun 2014 07:18:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvPVF-0002Jy-78 for qemu-devel@nongnu.org; Fri, 13 Jun 2014 07:18:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvPVE-0002Jp-V7 for qemu-devel@nongnu.org; Fri, 13 Jun 2014 07:18:37 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5DBIXGr018453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jun 2014 07:18:34 -0400 Received: from nilsson.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5DBIWOm021711; Fri, 13 Jun 2014 07:18:33 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id C524B80836; Fri, 13 Jun 2014 13:18:31 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 13 Jun 2014 13:18:29 +0200 Message-Id: <1402658309-8841-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1402658309-8841-1-git-send-email-kraxel@redhat.com> References: <1402658309-8841-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: David Marchand , Anthony Liguori , Gerd Hoffmann Subject: [Qemu-devel] [PULL 1/1] char: fix avail_connections init in qemu_chr_open_eventfd() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: David Marchand 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 Signed-off-by: Gerd Hoffmann --- qemu-char.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qemu-char.c b/qemu-char.c index 4c04bbc..f918f90 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