qemu-e2k/ui
Michael Roth bd5c51ee6c qemu-char: don't issue CHR_EVENT_OPEN in a BH
When CHR_EVENT_OPENED was initially added, it was CHR_EVENT_RESET,
and it was issued as a bottom-half:

86e94dea5b

Which we basically used to print out a greeting/prompt for the
monitor.

AFAICT the only reason this was ever done in a BH was because in
some cases we'd modify the chr_write handler for a new chardev
backend *after* the site where we issued the reset (see:
86e94d:qemu_chr_open_stdio())

At some point this event was renamed to CHR_EVENT_OPENED, and we've
maintained the use of this BH ever since.

However, due to 9f939df955, we schedule
the BH via g_idle_add(), which is causing events to sometimes be
delivered after we've already begun processing data from backends,
leading to:

 known bugs:

  QMP:
    session negotation resets with OPENED event, in some cases this
    is causing new sessions to get sporadically reset

 potential bugs:

  hw/usb/redirect.c:
    can_read handler checks for dev->parser != NULL, which may be
    true if CLOSED BH has not been executed yet. In the past, OPENED
    quiesced outstanding CLOSED events prior to us reading client
    data. If it's delayed, our check may allow reads to occur even
    though we haven't processed the OPENED event yet, and when we
    do finally get the OPENED event, our state may get reset.

  qtest.c:
    can begin session before OPENED event is processed, leading to
    a spurious reset of the system and irq_levels

  gdbstub.c:
    may start a gdb session prior to the machine being paused

To fix these, let's just drop the BH.

Since the initial reasoning for using it still applies to an extent,
work around that by deferring the delivery of CHR_EVENT_OPENED until
after the chardevs have been fully initialized, toward the end of
qmp_chardev_add() (or some cases, qemu_chr_new_from_opts()). This
defers delivery long enough that we can be assured a CharDriverState
is fully initialized before CHR_EVENT_OPENED is sent.

Also, rather than requiring each chardev to do an explicit open, do it
automatically, and allow the small few who don't desire such behavior to
suppress the OPENED-on-init behavior by setting a 'explicit_be_open'
flag.

We additionally add missing OPENED events for stdio backends on w32,
which were previously not being issued, causing us to not recieve the
banner and initial prompts for qmp/hmp.

Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Message-id: 1370636393-21044-1-git-send-email-mdroth@linux.vnet.ibm.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-10 11:38:37 -05:00
..
Makefile.objs Ensure x_keymap.o is built when GTK is enabled 2013-02-26 13:29:53 -06:00
cocoa.m cocoa: Avoid deprecated NSOpenPanel beginSheetForDirectory 2013-05-29 01:28:31 +02:00
console.c qemu-char: don't issue CHR_EVENT_OPEN in a BH 2013-06-10 11:38:37 -05:00
curses.c console: zap ds arg from register_displaychangelistener 2013-04-25 14:45:46 -05:00
curses_keys.h janitor: add guards to headers 2012-12-19 08:31:31 +01:00
cursor.c ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
cursor_hidden.xpm ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
cursor_left_ptr.xpm ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
d3des.c ui: move all ui components in ui/ 2010-07-26 17:35:54 -05:00
d3des.h janitor: add guards to headers 2012-12-19 08:31:31 +01:00
gtk.c qemu-char: don't issue CHR_EVENT_OPEN in a BH 2013-06-10 11:38:37 -05:00
input.c ui/input.c: replace magic numbers with macros 2013-05-23 09:58:45 -04:00
keymaps.c ui: Drop useless null tests in parse_keyboard_layout() 2013-01-16 12:02:47 -06:00
keymaps.h ui: move all ui components in ui/ 2010-07-26 17:35:54 -05:00
qemu-pixman.c pixman: render vgafont glyphs into pixman images 2013-04-16 09:03:47 +02:00
qemu-x509.h ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
sdl.c console: zap ds arg from register_displaychangelistener 2013-04-25 14:45:46 -05:00
sdl_keysym.h ui: move all ui components in ui/ 2010-07-26 17:35:54 -05:00
sdl_zoom.c sdl: Fix heap smash in sdl_zoom_rgb{16,32} for int > 32 bits 2013-01-15 18:25:30 -06:00
sdl_zoom.h ui: move all ui components in ui/ 2010-07-26 17:35:54 -05:00
sdl_zoom_template.h sdl: Fix heap smash in sdl_zoom_rgb{16,32} for int > 32 bits 2013-01-15 18:25:30 -06:00
spice-core.c spice: Fix unchecked strdup() by converting to g_strdup() 2013-01-30 11:14:46 +01:00
spice-display.c console: zap ds arg from register_displaychangelistener 2013-04-25 14:45:46 -05:00
spice-input.c ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
vgafont.h ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
vnc-auth-sasl.c Merge branch 'trivial-patches' of git://github.com/stefanha/qemu 2012-10-06 18:54:14 +02:00
vnc-auth-sasl.h misc: move include files to include/qemu/ 2012-12-19 08:32:39 +01:00
vnc-auth-vencrypt.c Avoid returning void 2012-07-28 09:23:11 +00:00
vnc-auth-vencrypt.h ui: move all ui components in ui/ 2010-07-26 17:35:54 -05:00
vnc-enc-hextile-template.h pixman/vnc: use pixman images in vnc. 2012-11-01 14:00:04 +01:00
vnc-enc-hextile.c pixman/vnc: remove dead code. 2012-11-01 14:00:05 +01:00
vnc-enc-tight.c vnc: stop using DisplayState 2013-03-18 10:21:58 +01:00
vnc-enc-tight.h vnc: tight add PNG encoding 2010-07-26 17:36:14 -05:00
vnc-enc-zlib.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
vnc-enc-zrle-template.c vnc: Add ZRLE and ZYWRLE encodings. 2011-02-23 16:28:28 -06:00
vnc-enc-zrle.c pixman/vnc: use pixman images in vnc. 2012-11-01 14:00:04 +01:00
vnc-enc-zrle.h vnc: Add ZRLE and ZYWRLE encodings. 2011-02-23 16:28:28 -06:00
vnc-enc-zywrle-template.c Fix spelling in comments, documentation and messages 2011-12-14 11:09:44 +00:00
vnc-enc-zywrle.h Fix spelling in comments, documentation and messages 2011-12-14 11:09:44 +00:00
vnc-jobs.c vnc: stop using DisplayState 2013-03-18 10:21:58 +01:00
vnc-jobs.h vnc: add missing static 2012-11-01 19:49:45 +01:00
vnc-palette.c ui/vnc-palette.c: Include headers it needs 2012-12-06 09:17:05 +01:00
vnc-palette.h misc: move include files to include/qemu/ 2012-12-19 08:32:39 +01:00
vnc-tls.c TLS support for VNC Websockets 2013-05-03 12:04:57 -05:00
vnc-tls.h misc: move include files to include/qemu/ 2012-12-19 08:32:39 +01:00
vnc-ws.c TLS support for VNC Websockets 2013-05-03 12:04:57 -05:00
vnc-ws.h TLS support for VNC Websockets 2013-05-03 12:04:57 -05:00
vnc.c vnc: Make ledstate comparison before modifiers updated 2013-05-15 08:48:43 -05:00
vnc.h TLS support for VNC Websockets 2013-05-03 12:04:57 -05:00
vnc_keysym.h vnc: recognize Hungarian doubleacutes 2013-02-06 08:29:58 -06:00
x_keymap.c ui: move all ui components in ui/ 2010-07-26 17:35:54 -05:00
x_keymap.h Delete useless 'extern' qualifiers for functions 2011-01-23 16:21:20 +00:00