qemu/hw
Daniel P. Berrange bce6261eb2 virtio-console: set frontend open permanently for console devs
The virtio-console.c file handles both serial consoles
and interactive consoles, since they're backed by the
same device model.

Since serial devices are expected to be reliable and
need to notify the guest when the backend is opened
or closed, the virtio-console.c file wires up support
for chardev events. This affects both serial consoles
and interactive consoles, using a network connection
based chardev backend such as 'socket', but not when
using a PTY based backend or plain 'file' backends.

When the host side is not connected the handle_output()
method in virtio-serial-bus.c will drop any data sent
by the guest, before it even reaches the virtio-console.c
code. This means that if the chardev has a logfile
configured, the data will never get logged.

Consider for example, configuring a x86_64 guest with a
plain UART serial port

  -chardev socket,id=charserial1,host=127.0.0.1,port=9001,server,nowait,logfile=console1.log,logappend=on
  -device isa-serial,chardev=charserial1,id=serial1

vs a s390 guest which has to use the virtio-console port

  -chardev socket,id=charconsole1,host=127.0.0.1,port=9000,server,nowait,logfile=console2.log,logappend=on
  -device virtconsole,chardev=charconsole1,id=console1

The isa-serial one gets data written to the log regardless
of whether a client is connected, while the virtioconsole
one only gets data written to the log when a client is
connected.

There is no need for virtio-serial-bus.c to aggressively
drop the data for console devices, as the chardev code is
prefectly capable of discarding the data itself.

So this patch changes virtconsole devices so that they
are always marked as having the host side open. This
ensures that the guest OS will always send any data it
has (Linux virtio-console hvc driver actually ignores
the host open state and sends data regardless, but we
should not rely on that), and also prevents the
virtio-serial-bus code prematurely discarding data.

The behaviour of virtserialport devices is *not* changed,
only virtconsole, because for the former, it is important
that the guest OSknow exactly when the host side is opened
/ closed so it can do any protocol re-negotiation that may
be required.

Fixes bug: https://bugs.launchpad.net/qemu/+bug/1599214

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1470241360-3574-2-git-send-email-berrange@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-08-11 16:38:58 +05:30
..
9pfs
acpi
alpha
arm
audio
block Block layer patches for 2.7.0-rc2 2016-08-05 13:05:29 +01:00
bt
char virtio-console: set frontend open permanently for console devs 2016-08-11 16:38:58 +05:30
core block/qdev: Let 'drive' property fall back to node name 2016-08-08 13:05:43 +02:00
cpu
cris
display
dma
gpio
i2c i2c: fix migration regression introduced by broadcast support 2016-08-03 18:44:56 +02:00
i386 error: Fix error_printf() calls lacking newlines 2016-08-08 09:01:27 +02:00
ide atapi: fix halted DMA reset 2016-08-09 11:47:23 -04:00
input virtio-input: free config list 2016-08-08 00:00:28 +04:00
intc x86: ioapic: add support for explicit EOI 2016-08-03 18:44:57 +02:00
ipack
ipmi
isa
lm32
m68k
mem
microblaze
mips error: Strip trailing '\n' from error string arguments (again) 2016-08-08 09:00:44 +02:00
misc
moxie
net virtio/vhost: fixes 2016-08-10 17:14:35 +01:00
nvram error: Strip trailing '\n' from error string arguments (again) 2016-08-08 09:00:44 +02:00
openrisc
pci
pci-bridge
pci-host
pcmcia
ppc hw/ppc/spapr: Look up CPU alias names instead of hard-coding the aliases 2016-08-10 13:12:20 +10:00
s390x s390x/pci: fix null pointer bug 2016-08-08 12:47:02 +02:00
scsi mptsas: really fix migration compatibility 2016-08-03 18:44:56 +02:00
sd
sh4
smbios
sparc hw/sparc/leon3: Don't call get_image_size() on a NULL pointer 2016-08-08 13:58:42 +01:00
sparc64
ssi
timer
tpm
tricore
unicore32
usb usb: free leaking path 2016-08-08 00:00:36 +04:00
vfio vfio: Use error_report() instead of error_printf() for errors 2016-08-08 09:01:18 +02:00
virtio vhost-user: Attempt to fix a race with set_mem_table. 2016-08-10 17:47:29 +03:00
watchdog
xen Xen PCI passthrough: fix passthrough failure when no interrupt pin 2016-08-04 10:42:48 -07:00
xenpv xen: use a common function for pv and hvm guest backend register calls 2016-08-03 14:52:11 +02:00
xtensa
Makefile.objs