qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] moving CHR_EVENT_OPEN out of BH broke echo for muxed mon
Date: Mon, 29 Jul 2013 15:26:20 +0400	[thread overview]
Message-ID: <51F6515C.8040304@msgid.tls.msk.ru> (raw)
In-Reply-To: <CANAOKxtU3Zmo+iGRJBLBRm5QzMw4ObB6vvn5B1ko6bShf6u+NA@mail.gmail.com>

Can we try to fix this for 1.6 please? :)
Or should I try to cook up a patch?

Thanks,

/mjt

04.07.2013 01:06, Michael Roth wrote:
> On Wed, Jul 3, 2013 at 1:03 AM, Michael Tokarev <mjt@tls.msk.ru> wrote:
>> Before
>>
>> commit bd5c51ee6c4f1c79cae5ad2516d711a27b4ea8ec
>> Author: Michael Roth <mdroth@linux.vnet.ibm.com>
>> Date:   Fri Jun 7 15:19:53 2013 -0500
>>
>>      qemu-char: don't issue CHR_EVENT_OPEN in a BH
>>
>> we had no echo by default with -nographic, and it gave
>> the prompt when switching to monitor:
>>
>>    $ qemu-system-x86_64 -nographic
>>    _
>>
>> (nothing is on the screen except the command line)
>>
>>    (Ctrl+A, c)
>>    QEMU 1.5.0 monitor - type 'help' for more information
>>    (qemu) _
>>
>> After this patch, we now have:
>>
>>    $ qemu-system-x86_64 -nographic
>>    QEMU 1.5.0 monitor - type 'help' for more information
>>    (qemu)
>>    _
>>
>> (note the cursor position on the _next_ line after the prompt),
>> and the system is actually in "serial port" mode, not monitor
>> mode (you still need to hit Ctrl+A,c to switch to monitor).
>
> After a bit of unwinding I think I know what's going on.
>
> When we attach a new front-end to a mux (via qemu_chr_add_handlers), we call the
> mux_chr_update_read_handler() to take those new handlers and stick them in an
> array of FEs.
>
> We then switch over to the new FE by issuing CHR_EVENT_MUX_OUT to the
> previously active FE (if there was one), updating our focus idx to be the
> current FE count, and issuing CHR_EVENT_MUX_IN.
>
> Then, finally, toward the end of qemu_chr_add_handlers(), we issue a
> CHR_EVENT_OPENED if the backend is already open (true in the case of stdio).
>
> Then we repeat this for subsequent FEs, which in the normal case results in
> the monitor FE getting a CHR_EVENT_MUX_OUT shortly after.
>
> - CHR_EVENT_MUX_IN prints the prompt if EVENT_OPENED has already been sent
> - CHR_EVENT_OPENED causes the monitor to output the banner and initial prompt
> - CHR_EVENT_MUX_OUT causes the monitor to print a newline (to delimit any
> subsequent output from another FE.
>
> Previously, due to CHR_EVENT_OPENED getting sent in a BH, the monitor FE
> would've already gotten the MUX_OUT event, so the banner and initial prompt
> would be buffered, and not sent till we switched back to the monitor. Now,
> we sent CHR_EVENT_OPENED before the initial MUX_OUT, so the banner actually
> gets display before we switch over to the next FE.
>
> The start-up state is actually exactly what you'd see if you cycled once
> through all the FEs in prior versions of QEMU, resulting in all this
> buffered up output getting flushed.
>
> Fix should be simple: defer CHR_EVENT_OPENED until after MUX_OUT to retain
> the previous behavior. Gonna be out this week but can send a patch when I
> get back.
>
> Thanks for the catch.
>
>>
>> Thanks,
>>
>> /mjt
>>
>

  reply	other threads:[~2013-07-29 11:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03  6:03 [Qemu-devel] moving CHR_EVENT_OPEN out of BH broke echo for muxed mon Michael Tokarev
2013-07-03 21:06 ` Michael Roth
2013-07-29 11:26   ` Michael Tokarev [this message]
2013-07-29 19:07     ` Michael Roth

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=51F6515C.8040304@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=aliguori@us.ibm.com \
    --cc=mdroth@linux.vnet.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 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).