[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-devel] [PATCH] qemu-char: fix terminal crash wh
From: |
Li Liu |
Subject: |
Re: [Qemu-trivial] [Qemu-devel] [PATCH] qemu-char: fix terminal crash when using "-monitor stdio -nographic" |
Date: |
Tue, 9 Sep 2014 10:22:26 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
On 2014/9/5 17:31, Gerd Hoffmann wrote:
> On Fr, 2014-09-05 at 11:04 +0200, Markus Armbruster wrote:
>> Li Liu <address@hidden> writes:
>>
>>> Ping, any more comments? Thanks.
>>
>> I'd like to hear Gerd's opinion (cc'ed).
>>
>>>>> But is having multiple character devices use the same terminal valid?
>
> No (guess we should catch that case in stdio init).
>
> Beside the tty initialization and cleanup you also have the problem that
> both users are racing for input. Well, maybe not in the qemu case as it
> is the same process and it very well might be that it polls the two
> chardevs in a well defined order, so one of them gets all input and the
> other gets nothing. With two processes reading from the terminal (try
> 'cat | less') it is actually random though.
>
>>>> I'm not sure. But I have found such comments in vl.c
>>>> "According to documentation and historically, -nographic redirects
>>>> serial port, parallel port and monitor to stdio"
>
> In that case mux chardev is used (that is the piece which handles the
> input switching between serial and monitor via 'Ctrl-A c'). There is
> one stdio instance, and one mux instance, the mux is chained to stdio,
> and mux allows multiple backends to connect.
>
> You can construct it on the command line this way:
>
> qemu -nographic -nodefaults \
> -chardev stdio,mux=on,id=terminal \
> -serial chardev:terminal \
> -monitor chardev:terminal
>
> [ serial is default, so no output here, unless you boot a guest
> with serial console configured ]
>
> [ Hit 'Ctrl-A h' now ]
>
> C-a h print this help
> C-a x exit emulator
> C-a s save disk data back to file (if -snapshot)
> C-a t toggle console timestamps
> C-a b send break (magic sysrq)
> C-a c switch between console and monitor
> C-a C-a sends C-a
>
> [ Hit 'Ctrl-A c' now ]
>
> QEMU 2.1.50 monitor - type 'help' for more information
> (qemu) info chardev
> terminal: filename=mux
> terminal-base: filename=stdio
> (qemu)
>
> HTH,
> Gerd
>
Appreciate your detailed answer. Thank you very much.
Li.
>
>
> .
>