aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2005-03-30 16:36:46 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-03-30 16:36:46 -0800
commit598ae05567f1304998c3f4ea895f6702fc08ea8c (patch)
tree6c52b64f5017550cf5523fe246f3c24857eeb07e
parent927f804e1d9921d499878f94701d26348a244343 (diff)
downloadhistory-598ae05567f1304998c3f4ea895f6702fc08ea8c.tar.gz
[PATCH] uml: Fix the console stuttering
I spent far too much of the weekend tracking this sucker down through the guts of the tty code. The problem turns out to be that drivers/char/n_tty.c has a write_chan that does buffering and retransmitting data, and arch/um/drivers/chan_kern.c ALSO has a write_chan that buffers and retransmits data, and the first calls the second but the second doesn't always return correct status information for the -EAGAIN case. When they get confused, both of them try to buffer and retransmit data, hence the stuttering. The first fix is that if chan_kern's write_chan gets an -EAGAIN, it should NOT gratuitously change that to a 0 before returning. I don't know why that code is in there, but deleting those two lines makes 90% the stuttering go away. But not quite all of it. The second half of the fix is arch/um/drivers/line.c has a buffer_data() function that adds data to the buffer, tries to flush the buffer out to disk, gets -EAGAIN, and then returns -EAGAIN even though it successfully buffered all the data it was sent. So the upper layer resubmits the last chunk of data it sent when the console unblocks, even though the lower layer buffered it and sent it on by that point. With this patch, I can't get the UML console to stutter anymore by suspending the process it's writing to. (Add tee to the mix and you can still make it hang by suspending its xterm for a second or two, but I think that tee is hanging, not UML. Hangs with RHEL4 tee, but not busybox tee...) Signed-off-by: Rob Landley <rob@landley.net> Acked-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/um/drivers/chan_kern.c5
-rw-r--r--arch/um/drivers/line.c2
2 files changed, 2 insertions, 5 deletions
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index b760b5a2a34350..1f77deb3fd237a 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -248,11 +248,8 @@ int write_chan(struct list_head *chans, const char *buf, int len,
n = chan->ops->write(chan->fd, buf, len, chan->data);
if (chan->primary) {
ret = n;
- if ((ret == -EAGAIN) || ((ret >= 0) && (ret < len))){
+ if ((ret == -EAGAIN) || ((ret >= 0) && (ret < len)))
reactivate_fd(chan->fd, write_irq);
- if (ret == -EAGAIN)
- ret = 0;
- }
}
}
return(ret);
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index d4286de17f0700..6924f273ced9fd 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -128,7 +128,7 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
ret = buffer_data(line, buf, len);
err = flush_buffer(line);
local_irq_restore(flags);
- if(err <= 0)
+ if(err <= 0 && (err != -EAGAIN || !ret))
ret = err;
}
else {