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

* Re: [Qemu-devel] [PATCH RFC] char: fix avail_connections init in qemu_chr_open_eventfd()
  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-06-11 13:39 ` [Qemu-devel] [PATCH] " David Marchand
  2 siblings, 0 replies; 11+ messages in thread
From: David Marchand @ 2014-02-13 14:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

[-- Attachment #1: Type: text/plain, Size: 1851 bytes --]

Hello,

Can someone take a look at my previous email and tell me if my patch is
just wrong ?

Thank you.


-- 
David Marchand


On Tue, Feb 4, 2014 at 10:17 PM, David Marchand <david.marchand@6wind.com>wrote:

> 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
>
>

[-- Attachment #2: Type: text/html, Size: 2516 bytes --]

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

* Re: [Qemu-devel] [PATCH RFC] char: fix avail_connections init in qemu_chr_open_eventfd()
  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-06-11 13:39 ` [Qemu-devel] [PATCH] " David Marchand
  2 siblings, 1 reply; 11+ messages in thread
From: Cam Macdonell @ 2014-02-13 18:58 UTC (permalink / raw)
  To: David Marchand; +Cc: qemu-devel@nongnu.org Developers, Anthony Liguori

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

Hi David,

I'm not sure which is the correct approach.  You could either do what you
did or you could simply remove the qemu_chr_fe_claim_no_fail() from
ivshmem.c.  I'm not sure how your change impacts other devices.

Sincerely,
Cam



On Tue, Feb 4, 2014 at 2:17 PM, David Marchand <david.marchand@6wind.com>wrote:

> 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
>
>
>

[-- Attachment #2: Type: text/html, Size: 2798 bytes --]

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

* Re: [Qemu-devel] [PATCH RFC] char: fix avail_connections init in qemu_chr_open_eventfd()
  2014-02-13 18:58 ` Cam Macdonell
@ 2014-02-14 12:16   ` David Marchand
  2014-02-17 11:52     ` David Marchand
  0 siblings, 1 reply; 11+ messages in thread
From: David Marchand @ 2014-02-14 12:16 UTC (permalink / raw)
  To: Cam Macdonell; +Cc: qemu-devel@nongnu.org Developers, Anthony Liguori

[-- Attachment #1: Type: text/plain, Size: 824 bytes --]

Hello Cam,


On Thu, Feb 13, 2014 at 7:58 PM, Cam Macdonell <cam@cs.ualberta.ca> wrote:

> I'm not sure which is the correct approach.  You could either do what you
> did or you could simply remove the qemu_chr_fe_claim_no_fail() from
> ivshmem.c.  I'm not sure how your change impacts other devices.
>
>
Actually, the first thing I tried, when I encountered the problem, was to
remove qemu_chr_fe_claim_no_fail(), and it worked.

In HEAD, ivshmem seems to be the only place where qemu_chr_open_eventfd()
is used :
$ git grep qemu_chr_open_eventfd
hw/misc/ivshmem.c:    chr = qemu_chr_open_eventfd(eventfd);
include/sysemu/char.h:CharDriverState *qemu_chr_open_eventfd(int eventfd);
qemu-char.c:CharDriverState *qemu_chr_open_eventfd(int eventfd)

I suppose my change is not that impacting :-)


Regards,
-- 
David Marchand

[-- Attachment #2: Type: text/html, Size: 2068 bytes --]

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

* Re: [Qemu-devel] [PATCH RFC] char: fix avail_connections init in qemu_chr_open_eventfd()
  2014-02-14 12:16   ` David Marchand
@ 2014-02-17 11:52     ` David Marchand
  2014-02-21 16:10       ` David Marchand
  0 siblings, 1 reply; 11+ messages in thread
From: David Marchand @ 2014-02-17 11:52 UTC (permalink / raw)
  To: qemu-devel@nongnu.org Developers; +Cc: Cam Macdonell, Anthony Liguori

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

Hello all,

On Fri, Feb 14, 2014 at 1:16 PM, David Marchand <david.marchand@6wind.com>wrote:

>
> In HEAD, ivshmem seems to be the only place where qemu_chr_open_eventfd()
> is used :
> $ git grep qemu_chr_open_eventfd
> hw/misc/ivshmem.c:    chr = qemu_chr_open_eventfd(eventfd);
> include/sysemu/char.h:CharDriverState *qemu_chr_open_eventfd(int eventfd);
> qemu-char.c:CharDriverState *qemu_chr_open_eventfd(int eventfd)
>
> I suppose my change is not that impacting :-)
>


Since this change has no impact, can it be pulled in current git tree ?

Thanks.


-- 
David Marchand

[-- Attachment #2: Type: text/html, Size: 1395 bytes --]

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

* Re: [Qemu-devel] [PATCH RFC] char: fix avail_connections init in qemu_chr_open_eventfd()
  2014-02-17 11:52     ` David Marchand
@ 2014-02-21 16:10       ` David Marchand
  2014-03-27 15:20         ` David Marchand
  0 siblings, 1 reply; 11+ messages in thread
From: David Marchand @ 2014-02-21 16:10 UTC (permalink / raw)
  To: qemu-devel@nongnu.org Developers; +Cc: Cam Macdonell, Anthony Liguori

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

On Mon, Feb 17, 2014 at 12:52 PM, David Marchand
<david.marchand@6wind.com>wrote:

>
> Since this change has no impact, can it be pulled in current git tree ?
>
>
ping

http://patchwork.ozlabs.org/patch/316785/


-- 
David Marchand

[-- Attachment #2: Type: text/html, Size: 925 bytes --]

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

* Re: [Qemu-devel] [PATCH RFC] char: fix avail_connections init in qemu_chr_open_eventfd()
  2014-02-21 16:10       ` David Marchand
@ 2014-03-27 15:20         ` David Marchand
  0 siblings, 0 replies; 11+ messages in thread
From: David Marchand @ 2014-03-27 15:20 UTC (permalink / raw)
  To: qemu-devel@nongnu.org Developers; +Cc: Cam Macdonell, Anthony Liguori

On 02/21/2014 05:10 PM, David Marchand wrote:
> On Mon, Feb 17, 2014 at 12:52 PM, David Marchand
> <david.marchand@6wind.com <mailto:david.marchand@6wind.com>> wrote:
>
>
>     Since this change has no impact, can it be pulled in current git tree ?
>
>
> ping
>
> http://patchwork.ozlabs.org/patch/316785/

ping


-- 
David Marchand

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

* [Qemu-devel] [PATCH] char: fix avail_connections init in qemu_chr_open_eventfd()
  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-06-11 13:39 ` David Marchand
  2014-06-11 14:56   ` Paolo Bonzini
  2 siblings, 1 reply; 11+ messages in thread
From: David Marchand @ 2014-06-11 13:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: cam, aliguori

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 <david.marchand@6wind.com>
---
 qemu-char.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)


No change since initial patch: http://patchwork.ozlabs.org/patch/316785/
I just rebased this patch on top of master branch and removed the [RFC] part.


-- 
David Marchand

diff --git a/qemu-char.c b/qemu-char.c
index 17b476e..7640f17 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2493,7 +2493,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
 
-- 
1.7.10.4

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

* Re: [Qemu-devel] [PATCH] char: fix avail_connections init in qemu_chr_open_eventfd()
  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
  0 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2014-06-11 14:56 UTC (permalink / raw)
  To: David Marchand, qemu-devel; +Cc: cam, Gerd Hoffmann, aliguori

Il 11/06/2014 15:39, David Marchand ha scritto:
> 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 <david.marchand@6wind.com>
> ---
>  qemu-char.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
>
> No change since initial patch: http://patchwork.ozlabs.org/patch/316785/
> I just rebased this patch on top of master branch and removed the [RFC] part.

CCing Gerd who lately has been taking care of qemu-char.c 
(kraxel@redhat.com).

The patch has a small coding style problem; it's missing braces around 
the "if" statement.  Please send an updated version and include Gerd in 
the email.

Thanks,

Paolo

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

* [Qemu-devel] [PATCH v2] char: fix avail_connections init in qemu_chr_open_eventfd()
  2014-06-11 14:56   ` Paolo Bonzini
@ 2014-06-11 15:25     ` David Marchand
  2014-06-12  9:10       ` Gerd Hoffmann
  0 siblings, 1 reply; 11+ messages in thread
From: David Marchand @ 2014-06-11 15:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, cam, kraxel, aliguori

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 <david.marchand@6wind.com>
---
 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

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

* Re: [Qemu-devel] [PATCH v2] char: fix avail_connections init in qemu_chr_open_eventfd()
  2014-06-11 15:25     ` [Qemu-devel] [PATCH v2] " David Marchand
@ 2014-06-12  9:10       ` Gerd Hoffmann
  0 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2014-06-12  9:10 UTC (permalink / raw)
  To: David Marchand; +Cc: pbonzini, cam, qemu-devel, aliguori

On Mi, 2014-06-11 at 17:25 +0200, David Marchand wrote:
> 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 <david.marchand@6wind.com>

Picked up.

cheers,
  Gerd

^ permalink raw reply	[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.