Bug 195395 - serial console as qemu-kvm guest stops responding freezes on duplex I/O
Summary: serial console as qemu-kvm guest stops responding freezes on duplex I/O
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.1-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-26 01:36 UTC by Taketo Kabe
Modified: 2014-11-27 08:20 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Taketo Kabe 2014-11-26 01:36:28 UTC
Overview:
When FreeBSD as a guest under qvm-kemu, and guest setup to use serial console,
simultaneous I/O on serial console will lock up the serial console.

That is, on console, you could "ls -lR /" and press any key during the scrolling, 
and console freezes instantly.
Ditto for Copy-Pasting a long string on the serial console.


Reproduce:
Host OS: CentOS 6.5 + kernel-2.6.32-431.el6.x86_64 + qemu-kvm-0.12.1.2-2.415.el6_5.10.x86_64
Guest OS: FreeBSD 10.1 release (amd64)

* Boot FreeBSD media on host as Linux qemu-kvm guest.
Example: 
host# virt-install -n fbtest -r 128 --vcpus=1 \
	--nodisks \
	--cdrom /home/libvirt/images/FreeBSD-10.0-RELEASE-amd64-dvd1.iso \
	--network=network=default,model=virtio \
	--video=vga --graphics none


* Loader prompt will appear on serial; press [Esc] to get OK prompt and type
OK set console=comconsole
OK boot -s
to get single user prompt.

* # ls -lR /
During scrolling, press any key.

Actual Results:
Console stops responding.

Expected results:
At least it should respond for buffer overflow or something.

Additional Information:
Console freeze will still occur on HDD(-image) installed, multiuser
FreeBSD guest with serial console configured as in Hnadbook.
When ps-ed from other tty (such as ssh), "ls -lR / >/dev/console" is stuck on "ttyout".

  0 632    1   0  20  0 14488 1932 ttyin    Ss+  u0  0:00.02 /usr/libexec/getty 3wire.9600 ttyu0
  0 595    1   0  52  0 14488 1932 ttyin    Is+  v0  0:00.01 /usr/libexec/getty Pc ttyv0
  0 621  620   0  21  0 47716 2672 wait     Is    0  0:00.06 su
  0 624  621   0  20  0 23572 3292 pause    S     0  0:00.03 _su (csh)
  0 636  624   0  52  0 16852 2932 ttyout   S     0  0:00.39 ls -lR /
  0 643  624   0  20  0 18736 2100 -        R+    0  0:00.00 ps axlww

SIGHUP or SIGKILL-ing process holding /dev/ttyu0 doesn't help.
The only way to unlock the console is to reboot. (single user is not enough)
Comment 1 Taketo Kabe 2014-11-26 01:58:27 UTC
kill -HUP ing the getty doesn't change anything.
kill -KILL ing the getty results in unkillable getty going CPU 100% and not exitting.
  0 598    1   0 102  0 14488 1980 -        REs+ u0- 0:43.47 /usr/libexec/getty 3wire.9600 ttyu0

spinlock or something?
Comment 2 Taketo Kabe 2014-11-27 08:20:35 UTC
Workaround:
set hw.broken_txfifo=1
in /boot/loader.conf, /boot/device.hints, wherever suites.

hw.broken_txfifo was added in FreeBSD 8.4 for workaround of QEMU UART emulation bug.