From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34957 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJi11-0005YI-VW for qemu-devel@nongnu.org; Wed, 02 Jun 2010 03:05:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJi10-0000vy-BL for qemu-devel@nongnu.org; Wed, 02 Jun 2010 03:05:27 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:50419) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJi0z-0000vs-W4 for qemu-devel@nongnu.org; Wed, 02 Jun 2010 03:05:26 -0400 Message-ID: <4C0602B3.7030902@web.de> Date: Wed, 02 Jun 2010 09:05:23 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Sender: jan.kiszka@web.de Subject: [Qemu-devel] [PATCH][RESEND] char: Flush read buffer in mux_chr_can_read List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , Anthony Liguori Cc: Alexander Graf From: Jan Kiszka Move the buffer flush from mux_chr_read to mux_chr_can_read. While the latter is called periodically, the former will only be invoked when new characters arrive at the back-end. This caused problems to front-end drivers whenever they were unable to read data immediately, e.g. virtio-console attached to stdio. Signed-off-by: Jan Kiszka --- While this may not solve all problems on s390, it does improve the muxed virtio console for x86 guest and still looks correct to me. qemu-char.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index faaf624..00ded76 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -404,6 +404,8 @@ static int mux_chr_can_read(void *opaque) MuxDriver *d = chr->opaque; int m = d->focus; + mux_chr_accept_input(opaque); + if ((d->prod[m] - d->cons[m]) < MUX_BUFFER_SIZE) return 1; if (d->chr_can_read[m]) @@ -418,8 +420,6 @@ static void mux_chr_read(void *opaque, const uint8_t *buf, int size) int m = d->focus; int i; - mux_chr_accept_input (opaque); - for(i = 0; i < size; i++) if (mux_proc_byte(chr, d, buf[i])) { if (d->prod[m] == d->cons[m] && -- 1.6.0.2