qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Peter Lieven" <lieven-lists@dlhnet.de>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>,
	anthony@codemonkey.ws, amit.shah@redhat.com
Subject: Re: [Qemu-devel] [PATCH] fix monitor
Date: Wed, 3 Apr 2013 14:17:40 +0200	[thread overview]
Message-ID: <1ba01d1f676845e458dba25a096bd1fa.squirrel@ssl.dlhnet.de> (raw)
In-Reply-To: <1363701863-13004-1-git-send-email-kraxel@redhat.com>

Hi Gerd,

I today saw this assert when live migrating a VM. Is this related? The
below patch was already applied.

qemu-1.4.5: /usr/src/qemu-1.4.5/monitor.c:297: monitor_puts: Assertion
`mon->outbuf_index < sizeof(mon->outbuf) - 1' failed.

Peter



Gerd Hoffmann wrote:
> chardev flow control broke monitor, fix it by adding watch support.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> v2: fix tyops
> ---
>  monitor.c |   23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 112e920..74807f9 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -261,11 +261,30 @@ int monitor_read_password(Monitor *mon, ReadLineFunc
> *readline_func,
>      }
>  }
>
> +static gboolean monitor_unblocked(GIOChannel *chan, GIOCondition cond,
> +                                  void *opaque)
> +{
> +    monitor_flush(opaque);
> +    return FALSE;
> +}
> +
>  void monitor_flush(Monitor *mon)
>  {
> +    int rc;
> +
>      if (mon && mon->outbuf_index != 0 && !mon->mux_out) {
> -        qemu_chr_fe_write(mon->chr, mon->outbuf, mon->outbuf_index);
> -        mon->outbuf_index = 0;
> +        rc = qemu_chr_fe_write(mon->chr, mon->outbuf, mon->outbuf_index);
> +        if (rc == mon->outbuf_index) {
> +            /* all flushed */
> +            mon->outbuf_index = 0;
> +            return;
> +        }
> +        if (rc > 0) {
> +            /* partial write */
> +            memmove(mon->outbuf, mon->outbuf + rc, mon->outbuf_index -
> rc);
> +            mon->outbuf_index -= rc;
> +        }
> +        qemu_chr_fe_add_watch(mon->chr, G_IO_OUT, monitor_unblocked,
> mon);
>      }
>  }
>
> --
> 1.7.9.7
>
>
>

  parent reply	other threads:[~2013-04-03 12:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-19 14:04 [Qemu-devel] [PATCH] fix monitor Gerd Hoffmann
2013-03-19 14:45 ` Laszlo Ersek
2013-03-19 15:11   ` Gerd Hoffmann
2013-03-19 17:40 ` Markus Armbruster
2013-03-19 19:00   ` Anthony Liguori
2013-03-19 18:58 ` Anthony Liguori
2013-04-03 12:17 ` Peter Lieven [this message]
2013-04-03 12:35   ` Gerd Hoffmann
2013-04-03 13:36     ` Luiz Capitulino
2013-04-04  5:42       ` Peter Lieven
  -- strict thread matches above, loose matches on Subject: below --
2013-03-19  9:57 Gerd Hoffmann
2013-03-19 13:58 ` Hans de Goede
2013-03-19 18:58 ` 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=1ba01d1f676845e458dba25a096bd1fa.squirrel@ssl.dlhnet.de \
    --to=lieven-lists@dlhnet.de \
    --cc=amit.shah@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.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 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).