All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Adam Litke <agl@us.ibm.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] QMP: Emit asynchronous events on all QMP monitors
Date: Fri, 15 Jan 2010 13:00:51 -0200	[thread overview]
Message-ID: <20100115130051.024ff95b@doriath> (raw)
In-Reply-To: <1263566042.3536.11.camel@aglitke>

On Fri, 15 Jan 2010 08:34:02 -0600
Adam Litke <agl@us.ibm.com> wrote:

> When using a control/QMP monitor in tandem with a regular monitor, asynchronous
> messages can get lost depending on the order of the QEMU program arguments.
> QEMU events issued by monitor_protocol_event() always go to cur_mon.  If the
> user monitor was specified on the command line first (or it has ,default), the
> message will be directed to the user monitor (not the QMP monitor).
> Additionally, only one QMP session is currently able to receive async messages.
> 
> To avoid this confusion, scan through the list of monitors and emit the message
> on each QMP monitor.
> 
> Signed-off-by: Adam Litke <agl@us.ibm.com>
> 
> diff --git a/monitor.c b/monitor.c
> index 134ed15..06c8bf0 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -334,13 +334,10 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
>  {
>      QDict *qmp;
>      const char *event_name;
> -    Monitor *mon = cur_mon;
> +    Monitor *mon;
>  
>      assert(event < QEVENT_MAX);
>  
> -    if (!monitor_ctrl_mode(mon))
> -        return;
> -
>      switch (event) {
>          case QEVENT_DEBUG:
>              event_name = "DEBUG";
> @@ -373,7 +370,12 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
>          qdict_put_obj(qmp, "data", data);
>      }
>  
> -    monitor_json_emitter(mon, QOBJECT(qmp));
> +    QLIST_FOREACH(mon, &mon_list, entry) {
> +        if (!monitor_ctrl_mode(mon))
> +            return;
> +
> +        monitor_json_emitter(mon, QOBJECT(qmp));
> +    }

 The function will return on the first !QMP Monitor, the
right QLIST_FOREACH() body is:

if (monitor_ctrl_mode(mon)) {
 monitor_json_emitter(mon, QOBJECT(qmp));
}

 I'll ACK the respin.

>      QDECREF(qmp);
>  }
>  
> 
> 

  reply	other threads:[~2010-01-15 15:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-14 21:20 [Qemu-devel] [PATCH] QMP: Save default control monitor for emitting async events Adam Litke
2010-01-15 13:38 ` [Qemu-devel] " Luiz Capitulino
2010-01-15 13:48   ` Adam Litke
2010-01-15 14:34   ` [Qemu-devel] [PATCH] QMP: Emit asynchronous events on all QMP monitors Adam Litke
2010-01-15 15:00     ` Luiz Capitulino [this message]
2010-01-15 15:16       ` [Qemu-devel] Re: [PATCH][RESPIN] " Adam Litke
2010-01-15 15:23         ` Luiz Capitulino
2010-01-19 22:40     ` [Qemu-devel] [PATCH] " Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100115130051.024ff95b@doriath \
    --to=lcapitulino@redhat.com \
    --cc=agl@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.