From: Paolo Bonzini <pbonzini@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Anthony Liguori <aliguori@us.ibm.com>,
"Todd T. Fries" <todd@fries.net>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] display: stop using DT_NOGRAPHIC, use DT_NONE
Date: Fri, 28 Jun 2013 14:05:24 +0200 [thread overview]
Message-ID: <51CD7C04.1090608@redhat.com> (raw)
In-Reply-To: <51CD76D5.2050709@msgid.tls.msk.ru>
Il 28/06/2013 13:43, Michael Tokarev ha scritto:
>> >
>> > All I'm saying is that I use -display none and I like that
>> > it defaults to "ctrl-c works and kills qemu" and I don't
>> > want you to break that :-)
> I'm not. Code in qemu-char.c:
>
> static bool stdio_allow_signal;
>
> static void qemu_chr_set_echo_stdio(CharDriverState *chr, bool echo)
> {
> ...
> /* if graphical mode, we allow Ctrl-C handling */
> if (!stdio_allow_signal)
> tty.c_lflag &= ~ISIG;
> ...
> }
>
> static CharDriverState *qemu_chr_open_stdio(ChardevStdio *opts)
> {
> ...
> stdio_allow_signal = display_type != DT_NOGRAPHIC;
> if (opts->has_signal) {
> stdio_allow_signal = opts->signal;
> }
> ...
> }
>
>
> Note it is used only for stdio char device, like -serial stdio,
> so if you _just_ use -display none, without -serial stdio, you
> wont notice a change.
>
> And note that original intention isn't exactly clear, either.
> How it is related with, say, curses display which needs raw
> keypresses?
>
> Adding Paolo who wrote that code in bb002513.
I didn't, the code was already there:
if (!qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC))
tty.c_lflag &= ~ISIG;
I just did
- if (!qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC))
+ if (!stdio_allow_signal)
tty.c_lflag &= ~ISIG;
...
+ stdio_allow_signal = qemu_opt_get_bool(opts, "signal",
+ display_type != DT_NOGRAPHIC);
I think the idea is that "-nographic" sets up "-serial mon:stdio" so in
theory you do not need Ctrl-C and it is better to pass it to the VM. Which
suggests this (untested) patch in turn:
-------------- 8< -----------------
From: Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH] trap signals for "-serial mon:stdio"
With mon:stdio you can exit the VM by switching to the monitor and
sending the "quit" command. It is then useful to pass Ctrl-C to the
VM instead of exiting.
This in turn lets us stop tying the default signal handling behavior
to -nographic, removing gratuitous differences between "-display none"
and "-nographic".
This patch changes behavior for "-display none -serial mon:stdio", as
expected, but not for "-display none -serial stdio".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/qemu-char.c b/qemu-char.c
index a030e6b..dc42b58 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -955,7 +955,6 @@ static CharDriverState *qemu_chr_open_stdio(ChardevStdio *opts)
chr = qemu_chr_open_fd(0, 1);
chr->chr_close = qemu_chr_close_stdio;
chr->chr_set_echo = qemu_chr_set_echo_stdio;
- stdio_allow_signal = display_type != DT_NOGRAPHIC;
if (opts->has_signal) {
stdio_allow_signal = opts->signal;
}
@@ -2929,7 +2928,10 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
if (strstart(filename, "mon:", &p)) {
filename = p;
- qemu_opt_set(opts, "mux", "on");
+ qemu_opt_set(opts, "mux", "yes");
+ if (strcmp(filename, "stdio") == 0) {
+ qemu_opt_set(opts, "signal", "no");
+ }
}
if (strcmp(filename, "null") == 0 ||
@@ -3058,8 +3060,7 @@ static void qemu_chr_parse_stdio(QemuOpts *opts, ChardevBackend *backend,
{
backend->stdio = g_new0(ChardevStdio, 1);
backend->stdio->has_signal = true;
- backend->stdio->signal =
- qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC);
+ backend->stdio->signal = qemu_opt_get_bool(opts, "signal", true);
}
static void qemu_chr_parse_serial(QemuOpts *opts, ChardevBackend *backend,
next prev parent reply other threads:[~2013-06-28 12:05 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 12:34 [Qemu-devel] [PATCH] display: stop using DT_NOGRAPHIC, use DT_NONE Michael Tokarev
2013-06-28 10:38 ` Michael Tokarev
2013-06-28 11:24 ` Peter Maydell
2013-06-28 11:29 ` Michael Tokarev
2013-06-28 11:34 ` Peter Maydell
2013-06-28 11:43 ` Michael Tokarev
2013-06-28 11:50 ` Peter Maydell
2013-06-28 12:05 ` Paolo Bonzini [this message]
2013-06-28 11:45 ` Andreas Färber
2013-06-28 11:50 ` Michael Tokarev
2013-06-28 11:55 ` Peter Maydell
2013-06-28 12:05 ` Michael Tokarev
2013-06-28 12:06 ` Paolo Bonzini
2013-06-28 12:09 ` Peter Maydell
2013-06-28 11:56 ` Andreas Färber
2013-06-28 12:05 ` Andreas Färber
2013-06-28 12:11 ` Paolo Bonzini
2013-07-09 18:37 ` Anthony Liguori
2013-07-09 19:00 ` Michael Tokarev
2013-07-09 20:45 ` Anthony Liguori
2013-07-09 21:18 ` Peter Maydell
2013-07-09 21:24 ` Anthony Liguori
2013-07-09 21:36 ` Peter Maydell
2013-07-09 22:03 ` Anthony Liguori
2013-07-16 11:10 ` Michael Tokarev
2013-07-10 4:45 ` Michael Tokarev
2013-07-10 5:08 ` Michael Tokarev
2013-07-16 11:35 ` Peter Maydell
2013-07-10 4:18 ` Michael Tokarev
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=51CD7C04.1090608@redhat.com \
--to=pbonzini@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=mjt@tls.msk.ru \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=todd@fries.net \
/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.