All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Lock <nox@jelal.kn-bremen.de>
To: qemu-devel@nongnu.org
Cc: Olivier =?iso-8859-1?Q?Cochard-Labb=E9?= <olivier@cochard.me>,
	freebsd-current@FreeBSD.org
Subject: [Qemu-devel] qemu serial: lost tx irqs (affectig FreeBSD's new uart(4) driver)
Date: Fri, 11 Sep 2009 23:35:08 +0200	[thread overview]
Message-ID: <20090911213508.GA97446@triton8.kn-bremen.de> (raw)

Hi!

 I got a report of FreeBSD guest's new uart(4) driver misbehaving in
qemu again(?) (output stopping for no apparent reason), and now found
out the problem is tx irqs (UART_IIR_THRI) are getting lost because
serial_update_irq() checks for the rx condtion,
	... if ((s->ier & UART_IER_RDI) && (s->lsr & UART_LSR_DR))
first before checking for the tx irq condition,
	... if ((s->ier & UART_IER_THRI) && s->thr_ipending)
which at least in this case (FreeBSD 8 guest after doing
	set console="comconsole"
at the loader prompt or when simply echo'ing text to /dev/ttyu0
or typing to the serial port from cu(1) on a `regular' vga console)
causes the second condition (.. && s->thr_ipending) to be never
reached anymore, or only after a very long delay.  Moving that
condition up so it is checked first like this,

Index: qemu/hw/serial.c
@@ -189,7 +188,9 @@ static void serial_update_irq(SerialStat
 {
     uint8_t tmp_iir = UART_IIR_NO_INT;
 
-    if ((s->ier & UART_IER_RLSI) && (s->lsr & UART_LSR_INT_ANY)) {
+    if ((s->ier & UART_IER_THRI) && s->thr_ipending) {
+        tmp_iir = UART_IIR_THRI;
+    } else if ((s->ier & UART_IER_RLSI) && (s->lsr & UART_LSR_INT_ANY)) {
         tmp_iir = UART_IIR_RLSI;
     } else if ((s->ier & UART_IER_RDI) && s->timeout_ipending) {
         /* Note that(s->ier & UART_IER_RDI) can mask this interrupt,
@@ -202,8 +203,6 @@ static void serial_update_irq(SerialStat
         } else if (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)) {
         tmp_iir = UART_IIR_MSI;
     }

...fixes the issue for me, but I'm not 100% sure if this might cause
rx irqs to come (too?) late when a guest keeps sending while its
receiving at the same time.  Anyone care to comment? :)

 Thanx,
	Juergen

             reply	other threads:[~2009-09-11 21:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-11 21:35 Juergen Lock [this message]
2009-09-12 11:20 ` [Qemu-devel] Re: qemu serial: lost tx irqs (affectig FreeBSD's new uart(4) driver) Olivier Cochard-Labbé
2009-09-12 12:26 ` Jan Kiszka
2009-09-12 16:52   ` Juergen Lock
2009-09-12 17:00     ` Jan Kiszka
2009-09-14 16:59     ` Stefano Stabellini
2009-09-16 19:01     ` Aurelien Jarno
2009-09-23 18:47       ` Juergen Lock
2009-09-24 16:20         ` Aurelien Jarno
2009-09-24 21:26           ` Juergen Lock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090911213508.GA97446@triton8.kn-bremen.de \
    --to=nox@jelal.kn-bremen.de \
    --cc=freebsd-current@FreeBSD.org \
    --cc=olivier@cochard.me \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.