Skip to contentSkip to conversation

char: Flush read buffer in mux_chr_can_read

PATCH RESEND In review Jan Kiszka 2 participants 7 messages Oct 19, 2010 – Nov 17, 2010

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH RESEND 1/1 char: Flush read buffer in mux_chr_can_read

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.

---
 qemu-char.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
qemu-char.c +2 -2
index 6d2dce7..f4c3876 100644
@@ -398,6 +398,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])
@@ -412,8 +414,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] &&
Signature · 1 line
1.7.1
author
#2 lore raw
In reply to Alexander Graf
Quoted 10 lines · Alexander Graf

Am 19.10.2010 um 17:04 schrieb Jan Kiszka <[email protected]>:

Quoted 5 lines

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.

This should help ny s390 virtio console issue, right? :) I'll try it out asap, worst case that might take until the weekend.

I think you already tried and still found some scenarios broken (we still need to understand them IIRC). However, this one fixes at least those virtio-console scenarios I tested (with x86 guests).

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#1 lore raw
In reply to Jan Kiszka

Am 19.10.2010 um 17:04 schrieb Jan Kiszka <[email protected]>:

Quoted 5 lines

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.

This should help ny s390 virtio console issue, right? :) I'll try it out asap, worst case that might take until the weekend.

Alex

Quoted 1 line
author
#3 lore raw
In reply to Jan Kiszka
Quoted 6 lines · 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.

Ping.

Quoted 27 lines
---
 qemu-char.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
qemu-char.c +2 -2
index 6d2dce7..f4c3876 100644
@@ -398,6 +398,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])
@@ -412,8 +414,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] &&
#4 lore raw
Quoted 9 lines · Jan Kiszka
Quoted 6 lines · 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.

Ping.

It's still broken, even with this patch applied.

Alex

author
#5 lore raw
Quoted 11 lines · Alexander Graf
Quoted 8 lines · Jan Kiszka
Quoted 6 lines · 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.

Quoted 4 lines
Quoted 1 line

Ping.

It's still broken, even with this patch applied.

No surprise. Still, the patch fixes other archs (namely x86).

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#6 lore raw
Quoted 12 lines · Jan Kiszka
Quoted 11 lines · Alexander Graf
Quoted 8 lines · Jan Kiszka
Quoted 6 lines · 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.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Ping.

It's still broken, even with this patch applied.

No surprise. Still, the patch fixes other archs (namely x86).

Sure, no complaints on the patch from my side. The framework is still broken though :).

Alex