From patchwork Tue Feb 4 21:17:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 316785 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 48B6B2C0096 for ; Wed, 5 Feb 2014 12:01:33 +1100 (EST) Received: from localhost ([::1]:56934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAqrr-0005VL-92 for incoming@patchwork.ozlabs.org; Tue, 04 Feb 2014 20:01:31 -0500 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) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hFvIGXsKLkRbaM5jhzFy0fwrDXA31rV+iCUowkHNt5E=; b=ZamEF+HRzPScKfvjHy5LpcP5a3A0uJyVzN+AfG3rmZGLLZb+dnTSTT2tEU35Dw63rv /miPLsmvz/it6EXreOMcoo3zfzg29ZtjFgUAWYFelaPIz754XT+GY3dfDew/DvuuFnnM fXzOSuTLWzKvKN9vr1Yn3x0UfTyidMkvGY/3/6pG+nC4MQa5p6Avikgkk2LcDD/zTiN5 WqNwtrX0PumbvNHZo1SjF+OABllKO/L/mAFGlSDyu6xMiHJvc6c5XNRFCjXUR/WWKOsM GtnT+KCcoXR6u20wC1a1gZhCknCJHek29qB9nlh6sbskjZJpec/Jgle+GWrf2YsWJxeW SYVA== X-Gm-Message-State: ALoCoQnQUTfW/Ap4bRU5zSSCWxZsRmpoQwgYgS98Bem+1HFdQoFGzXyKq/ToV5IdjpHC0cW7N9fo X-Received: by 10.180.100.70 with SMTP id ew6mr14186170wib.57.1391548678069; Tue, 04 Feb 2014 13:17:58 -0800 (PST) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id fm3sm39288236wib.8.2014.02.04.13.17.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Feb 2014 13:17:56 -0800 (PST) From: David Marchand To: qemu-devel@nongnu.org Date: Tue, 4 Feb 2014 22:17:46 +0100 Message-Id: <1391548666-5513-1-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.44 X-Mailman-Approved-At: Tue, 04 Feb 2014 19:58:14 -0500 Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH RFC] 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 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