qemu-e2k/hw
Kirill Batuzov f702e62a19 serial: change retry logic to avoid concurrency
Whenever serial_xmit fails to transmit a byte it adds a watch that would
call it again when the "line" becomes ready. This results in a retry
chain:
  serial_xmit -> add_watch -> serial_xmit
Each chain is able to transmit one character, and for every character
passed to serial by the guest driver a new chain is spawned.

The problem lays with the fact that a new chain is spawned even when
there is one already waiting on the watch. So there can be several retry
chains waiting concurrently on one "line". Every chain tries to transmit
current character, so character order is not messed up. But also every
chain increases retry counter (tsr_retry). If there are enough
concurrent chains this counter will hit MAX_XMIT_RETRY value and
the character will be dropped.

To reproduce this bug you need to feed serial output to some program
consuming it slowly enough. A python script from bug #1335444
description is an example of such program.

This commit changes retry logic in the following way to avoid
concurrency: instead of spawning a new chain for each character being
transmitted spawn only one and make it transmit characters until FIFO is
empty.

The change consists of two parts:
 - add a do {} while () loop in serial_xmit (diff is a bit erratic
   for this part, diff -w will show actual change),
 - do not call serial_xmit from serial_ioport_write if there is one
   waiting on the watch already.

This should fix another issue causing bug #1335444.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-07-14 16:14:14 +02:00
..
9pfs virtio-9p: use virtio wrappers to access headers 2014-06-29 19:39:43 +03:00
acpi acpi: fix typo in memory hotplug MMIO region name 2014-07-06 09:13:54 +03:00
alpha machine: Conversion of QEMUMachineInitArgs to MachineState 2014-05-28 17:35:01 +02:00
arm hw/arm/vexpress: Alias NOR flash at 0 for vexpress-a9 2014-07-08 13:05:10 +01:00
audio audio: fmopl: drop INLINE macro 2014-06-23 11:01:24 -04:00
block dataplane: submit I/O as a batch 2014-07-07 11:05:17 +02:00
bt Preparation for usb-bt-dongle conditional build 2013-09-10 11:14:41 +02:00
char serial: change retry logic to avoid concurrency 2014-07-14 16:14:14 +02:00
core qdev: Fix crash when using non-device class name on -global 2014-07-06 09:13:54 +03:00
cpu icc_bus: QOM'ify ICC 2013-12-24 18:02:18 +01:00
cris machine: Conversion of QEMUMachineInitArgs to MachineState 2014-05-28 17:35:01 +02:00
display cirrus: Fix host CPU blits 2014-07-11 10:17:02 +02:00
dma hw: Fix qemu_allocate_irqs() leaks 2014-06-30 21:13:30 +02:00
gpio savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
i2c savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
i386 pc: make isapc and pc-0.10 to pc-0.13 have 1.7.0 memory layout 2014-06-29 18:59:41 +03:00
ide ahci: map memory via device's address space instead of address_space_memory 2014-07-07 10:22:43 +02:00
input input: fix jumpy mouse cursor with USB mouse emulation 2014-07-01 13:26:37 +02:00
intc xics: Implement xics_ics_free() 2014-06-27 13:48:26 +02:00
ipack irq: Allocate IRQs individually 2014-07-01 04:02:53 +02:00
isa acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices 2014-06-19 18:44:22 +03:00
lm32 machine: Conversion of QEMUMachineInitArgs to MachineState 2014-05-28 17:35:01 +02:00
m68k machine: Conversion of QEMUMachineInitArgs to MachineState 2014-05-28 17:35:01 +02:00
mem pc-dimm: error out if memory hotplug is not enabled 2014-07-06 09:13:54 +03:00
microblaze ssi: Name the CS GPIO 2014-05-28 17:36:21 +02:00
mips mips_malta: Catch kernels linked at wrong address 2014-07-09 18:17:08 +02:00
misc hw: Fix qemu_allocate_irqs() leaks 2014-06-30 21:13:30 +02:00
moxie hw/moxie/moxiesim.c: Remove unused moxie_intc_create() 2014-06-24 20:01:24 +04:00
net vhost-net: disable when cross-endian 2014-06-29 19:39:43 +03:00
nvram spapr: Fix RTAS token numbers 2014-06-27 13:48:22 +02:00
openrisc machine: Conversion of QEMUMachineInitArgs to MachineState 2014-05-28 17:35:01 +02:00
pci pci: assign devfn to pci_dev before calling pci_device_iommu_address_space() 2014-07-06 09:13:54 +03:00
pci-bridge hw/pcie: implement power controller functionality 2014-06-23 17:48:42 +03:00
pci-host prep: Remove PCI memory hack related to OpenHack'Ware 2014-07-07 16:46:35 +02:00
pcmcia hw: Fix qemu_allocate_irqs() leaks 2014-06-30 21:13:30 +02:00
ppc hw/ppc/spapr_hcall.c: Add ULL suffix to 64 bit constant 2014-07-08 16:03:19 +01:00
s390x s390x/css: reflect cpa in scsw 2014-07-08 15:08:03 +02:00
scsi scsi: Report error when lun number is in use 2014-07-14 11:54:57 +02:00
sd hw: Fix qemu_allocate_irqs() leaks 2014-06-30 21:13:30 +02:00
sh4 hw: Fix qemu_allocate_irqs() leaks 2014-06-30 21:13:30 +02:00
sparc tcx: move initialisation from realizefn to initfn 2014-06-05 20:51:57 +01:00
sparc64 machine: Conversion of QEMUMachineInitArgs to MachineState 2014-05-28 17:35:01 +02:00
ssi ssi: Name the CS GPIO 2014-05-28 17:36:21 +02:00
timer mc146818rtc: register the clock reset notifier on the right clock 2014-07-10 17:06:33 +02:00
tpm aio / timers: Untangle include files 2013-08-22 19:10:27 +02:00
unicore32 machine: Conversion of QEMUMachineInitArgs to MachineState 2014-05-28 17:35:01 +02:00
usb mtp: linux guest detection fix. 2014-07-11 12:31:41 +02:00
virtio virtio-pci: fix MSI memory region use after free 2014-07-06 09:13:54 +03:00
watchdog watchdog: fix deadlock with -watchdog-action pause 2014-07-09 18:17:08 +02:00
xen xen_backend: introduce xenstore_read_uint64 and xenstore_read_fe_uint64 2014-07-07 10:37:40 +00:00
xenpv machine: Conversion of QEMUMachineInitArgs to MachineState 2014-05-28 17:35:01 +02:00
xtensa hw/xtensa/xtfpga: implement initrd loading 2014-06-29 02:32:42 +04:00
Makefile.objs pc: implement pc-dimm device abstraction 2014-06-19 16:41:47 +03:00