qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-char: do not forward events through the mux until QEMU has started
@ 2016-10-27 13:38 Paolo Bonzini
  2016-10-27 13:52 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2016-10-27 13:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, dgilbert

Otherwise, the CHR_EVENT_OPENED event is sent twice: first when the
backend (for example "stdio") is opened, and second after processing
the command line.

The incorrect sending of the event prints the monitor banner when
QEMU is started with "-serial mon:stdio".  This includes the "(qemu)"
prompt; thus the monitor seems to be dead, whereas actually the
active front-end is the serial port.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-char.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index 6dd779f..2e02d95 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -735,19 +735,23 @@ static void mux_chr_read(void *opaque, const uint8_t *buf, int size)
         }
 }
 
+static bool muxes_realized;
+
 static void mux_chr_event(void *opaque, int event)
 {
     CharDriverState *chr = opaque;
     MuxDriver *d = chr->opaque;
     int i;
 
+    if (!muxes_realized) {
+        return;
+    }
+
     /* Send the event to all registered listeners */
     for (i = 0; i < d->mux_cnt; i++)
         mux_chr_send_event(d, i, event);
 }
 
-static bool muxes_realized;
-
 /**
  * Called after processing of default and command-line-specified
  * chardevs to deliver CHR_EVENT_OPENED events to any FEs attached
-- 
2.7.4

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

* Re: [Qemu-devel] [PATCH] qemu-char: do not forward events through the mux until QEMU has started
  2016-10-27 13:38 [Qemu-devel] [PATCH] qemu-char: do not forward events through the mux until QEMU has started Paolo Bonzini
@ 2016-10-27 13:52 ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 2+ messages in thread
From: Dr. David Alan Gilbert @ 2016-10-27 13:52 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, marcandre.lureau

* Paolo Bonzini (pbonzini@redhat.com) wrote:
> Otherwise, the CHR_EVENT_OPENED event is sent twice: first when the
> backend (for example "stdio") is opened, and second after processing
> the command line.
> 
> The incorrect sending of the event prints the monitor banner when
> QEMU is started with "-serial mon:stdio".  This includes the "(qemu)"
> prompt; thus the monitor seems to be dead, whereas actually the
> active front-end is the serial port.
> 
> Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

ok, that seems to fix the monitor; it doesn't fix slirp.

Tested--by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Dave

> ---
>  qemu-char.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 6dd779f..2e02d95 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -735,19 +735,23 @@ static void mux_chr_read(void *opaque, const uint8_t *buf, int size)
>          }
>  }
>  
> +static bool muxes_realized;
> +
>  static void mux_chr_event(void *opaque, int event)
>  {
>      CharDriverState *chr = opaque;
>      MuxDriver *d = chr->opaque;
>      int i;
>  
> +    if (!muxes_realized) {
> +        return;
> +    }
> +
>      /* Send the event to all registered listeners */
>      for (i = 0; i < d->mux_cnt; i++)
>          mux_chr_send_event(d, i, event);
>  }
>  
> -static bool muxes_realized;
> -
>  /**
>   * Called after processing of default and command-line-specified
>   * chardevs to deliver CHR_EVENT_OPENED events to any FEs attached
> -- 
> 2.7.4
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

end of thread, other threads:[~2016-10-27 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-27 13:38 [Qemu-devel] [PATCH] qemu-char: do not forward events through the mux until QEMU has started Paolo Bonzini
2016-10-27 13:52 ` Dr. David Alan Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).