All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH RFC] char: fix avail_connections init in qemu_chr_open_eventfd()
@ 2014-02-04 21:17 David Marchand
  2014-02-13 14:47 ` David Marchand
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: David Marchand @ 2014-02-04 21:17 UTC (permalink / raw)
  To: qemu-devel; +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 <david.marchand@6wind.com>
---
 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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-06-12  9:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-04 21:17 [Qemu-devel] [PATCH RFC] char: fix avail_connections init in qemu_chr_open_eventfd() David Marchand
2014-02-13 14:47 ` David Marchand
2014-02-13 18:58 ` Cam Macdonell
2014-02-14 12:16   ` David Marchand
2014-02-17 11:52     ` David Marchand
2014-02-21 16:10       ` David Marchand
2014-03-27 15:20         ` David Marchand
2014-06-11 13:39 ` [Qemu-devel] [PATCH] " David Marchand
2014-06-11 14:56   ` Paolo Bonzini
2014-06-11 15:25     ` [Qemu-devel] [PATCH v2] " David Marchand
2014-06-12  9:10       ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.