[Bug 518346] [NEW] Emulated serial port does not work with FreeBSD 8.0 guest

Garry Dolley gdolley at arpnetworks.com
Sun Feb 7 11:10:01 GMT 2010


Public bug reported:

Binary package hint: kvm

I'm running a handful of Jaunty systems and this bug appears in kvm 1:84
+dfsg-0ubuntu12.4

Host:

$ lsb_release -rd
Description:    Ubuntu 9.04
Release:        9.04
$

Description of bug:

If you start a FreeBSD 8.0 guest with "-serial
telnet:127.0.0.1:<port>,server,nowait", and then try to connect to the
guest's serial port with telnet, there will be no output to the telnet
side.  The FreeBSD 8.0 guest is running a getty process on /dev/ttyu0.

This is specific to FreeBSD 8.0.  FreeBSD 7.1 and 7.2 guests did not
exhibit this problem.

FreeBSD 8.0 uses a new uart(4) driver (/dev/ttyu0).  Prior versions used
sio(4) (/dev/ttyd0).

Proposed fix:

There is an upstream QEMU patch that fixes this.

I've rolled this patch into my PPA for kvm (among other changes):
https://launchpad.net/~gdolley/+archive/ppa/+packages

A debdiff for just this specific issue that fixes the problem is:

diff -u kvm-84+dfsg/debian/changelog kvm-84+dfsg/debian/changelog
--- kvm-84+dfsg/debian/changelog
+++ kvm-84+dfsg/debian/changelog
@@ -1,3 +1,11 @@                
+kvm (1:84+dfsg-0ubuntu12.5~ppa1) jaunty; urgency=low
+                               
+  * debian/patches/qemu-serial-lost-tx-irqs-affecting-freebsd-new-uart-driver.patch:
+    cherry-pick from upstream  
+    - Fixes qemu serial vs. FreeBSD 8.0 uart(4) not working properly
+                               
+ -- Garry Dolley <gdolley at arpnetworks.com>  Wed, 09 Dec 2009 03:53:31 -0800
+                               
 kvm (1:84+dfsg-0ubuntu12.4) jaunty-proposed; urgency=low
                                
   * debian/patches/Fix-cluster-freeing-in-qcow2.patch: cherry-pick
diff -u kvm-84+dfsg/debian/control kvm-84+dfsg/debian/control
diff -u kvm-84+dfsg/debian/patches/series kvm-84+dfsg/debian/patches/series
--- kvm-84+dfsg/debian/patches/series
+++ kvm-84+dfsg/debian/patches/series
@@ -17,0 +18 @@                 
+qemu-serial-lost-tx-irqs-affecting-freebsd-new-uart-driver.patch
only in patch2:                 
unchanged:                      
--- kvm-84+dfsg.orig/debian/patches/qemu-serial-lost-tx-irqs-affecting-freebsd-new-uart-driver.patch
+++ kvm-84+dfsg/debian/patches/qemu-serial-lost-tx-irqs-affecting-freebsd-new-uart-driver.patch
@@ -0,0 +1,37 @@                
+commit 2d6ee8e7e17227d5eb8c6e9a054dd88d5b37c5ae
+Author: Juergen Lock <nox at jelal.kn-bremen.de>
+Date:   Sat Sep 12 18:52:22 2009 +0200
+                               
+    qemu serial: lost tx irqs (affecting FreeBSD's new uart(4) driver)
+                               
+    Well one problem seems to be the rx condition,
+            ... if ((s->ier & UART_IER_RDI) && (s->lsr & UART_LSR_DR))
+    is not enough to trigger an irq, yet still causes the following
+    conditions not to be checked anymore at all.
+                               
+    Signed-off-by: Juergen Lock <nox at jelal.kn-bremen.de>
+    Acked-by: Jan Kiszka <jan.kiszka at web.de>
+    Acked-by: Stefano Stabellini <stefano.stabellini at eu.citrix.com>
+    Signed-off-by: Aurelien Jarno <aurelien at aurel32.net>
+                               
+diff --git a/qemu/hw/serial.c b/qemu/hw/serial.c
+index 1f4ce77..a22770f 100644  
+--- a/qemu/hw/serial.c         
++++ b/qemu/hw/serial.c         
+@@ -197,12 +197,10 @@ static void serial_update_irq(SerialState *s)
+          * this is not in the specification but is observed on existing
+          * hardware.  */      
+         tmp_iir = UART_IIR_CTI;
+-    } else if ((s->ier & UART_IER_RDI) && (s->lsr & UART_LSR_DR)) {
+-        if (!(s->fcr & UART_FCR_FE)) {
+-           tmp_iir = UART_IIR_RDI;
+-        } else if (s->recv_fifo.count >= s->recv_fifo.itl) {
+-           tmp_iir = UART_IIR_RDI;
+-        }
++    } else if ((s->ier & UART_IER_RDI) && (s->lsr & UART_LSR_DR) &&
++               (!(s->fcr & UART_FCR_FE) ||
++                s->recv_fifo.count >= s->recv_fifo.itl)) {
++        tmp_iir = UART_IIR_RDI;
+     } else if ((s->ier & UART_IER_THRI) && s->thr_ipending) {
+         tmp_iir = UART_IIR_THRI;
+     } else if ((s->ier & UART_IER_MSI) && (s->msr & UART_MSR_ANY_DELTA)) {


My modified kvm package with the above patch runs about 80 production virtual machines of the following flavors: FreeBSD 7.1, 7.2, and 8.0; OpenBSD 4.5 and 4.6; Ubuntu 9.04; Debian 5.02; ArchLinux; and Gentoo.  None of these have had any serial port problems after the above patch was applied.

Might be worth applying to Karmic or Lucid kvm packages if the QEMU
upstream in those kvm packages do not already include it.

** Affects: kvm (Ubuntu)
     Importance: Undecided
         Status: New

-- 
Emulated serial port does not work with FreeBSD 8.0 guest
https://bugs.launchpad.net/bugs/518346
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to kvm in ubuntu.



More information about the Ubuntu-server-bugs mailing list