public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix reading from character devices
@ 2008-01-21  9:29 Jan Kiszka
       [not found] ` <47946610.9040001-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2008-01-21  9:29 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hi Avi,

commit "kvm: qemu: consume all pending I/O in I/O loop"
(8ab8bb09f1115b9bf733f885cc92b6c63d83f420) broke reading data bursts
from serial devices (and maybe from other character devices as well) by
guests. Reason: serial devices do input flow control via fd_read_poll,
but qemu now ignores this fact by pushing all data into the virtual
device as soon as it is available.

Patch below is not really nice (just as the whole internal virtual I/O
interface at the moment, IMHO), but it re-enables the serial ports for
now.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

---
 qemu/vl.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: kvm-userspace/qemu/vl.c
===================================================================
--- kvm-userspace.orig/qemu/vl.c
+++ kvm-userspace/qemu/vl.c
@@ -7751,7 +7751,10 @@ void main_loop_wait(int timeout)
         for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) {
             if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) {
                 ioh->fd_read(ioh->opaque);
-                more = 1;
+                if (!ioh->fd_read_poll || ioh->fd_read_poll(ioh->opaque))
+                    more = 1;
+                else
+                    FD_CLR(ioh->fd, &rfds);
             }
             if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) {
                 ioh->fd_write(ioh->opaque);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-02-22  7:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21  9:29 [PATCH] fix reading from character devices Jan Kiszka
     [not found] ` <47946610.9040001-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
2008-01-21 10:13   ` Avi Kivity
     [not found]     ` <47947045.6040106-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-21 10:43       ` Dor Laor
     [not found]         ` <1200912198.3188.6.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-01-21 10:50           ` Avi Kivity
     [not found]             ` <479478E6.6030903-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-21 11:23               ` Dor Laor
2008-02-21 12:32                 ` Jan Kiszka
2008-02-22  7:41                   ` Avi Kivity
2008-01-21 11:30               ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox