On Tue, 2006-02-07 at 13:34 +0100, Olaf Hering wrote:
> > [PATCH] new tty buffering locking fix
> This patch breaks the hvc console, no input is accepted, even with
> init=/bin/sash? Any idea what this driver needs to do now?
> I wonder if it worked ok on -mm.
I think this is happening:
1. hvc calls tty_buffer_request_room, claiming a
tty buffer for use by the driver
2. hvc adds data to the tty buffer
3. hvc calls tty_schedule_flip or tty_flip_buffer_push,
which releases the buffer for processing
4. *before* the buffer can be processed, hvc again calls
tty_buffer_request_room, reclaiming the same buffer
which still has free room
5. hvc does not have more data to input, so it does
not call tty_schedule_flip or tty_flip_buffer_push
Now the tty buffer contains some data but can't be processed
because it is still marked as in use by the driver.
Try the below patches (for testing only, I'm not suggesting
these as a final fix yet) and let me know if it fixes it.
Thanks,
Paul
--- linux-2.6.16-rc2/drivers/char/hvc_console.c 2006-02-06 13:50:39.000000000 -0600
+++ b/drivers/char/hvc_console.c 2006-02-07 10:10:18.000000000 -0600
@@ -613,6 +613,7 @@ static int hvc_poll(struct hvc_struct *h
tty_hangup(tty);
spin_lock_irqsave(&hp->lock, flags);
}
+ tty_schedule_flip(tty);
break;
}
for (i = 0; i < n; ++i) {
@@ -633,8 +634,7 @@ static int hvc_poll(struct hvc_struct *h
tty_insert_flip_char(tty, buf[i], 0);
}
- if (count)
- tty_schedule_flip(tty);
+ tty_schedule_flip(tty);
/*
* Account for the total amount read in one loop, and if above
--- linux-2.6.16-rc2/drivers/char/hvcs.c 2006-02-06 13:50:39.000000000 -0600
+++ b/drivers/char/hvcs.c 2006-02-07 10:09:57.000000000 -0600
@@ -469,8 +469,7 @@ static int hvcs_io(struct hvcs_struct *h
spin_unlock_irqrestore(&hvcsd->lock, flags);
/* This is synch because tty->low_latency == 1 */
- if(got)
- tty_flip_buffer_push(tty);
+ tty_flip_buffer_push(tty);
if (!got) {
/* Do this _after_ the flip_buffer_push */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]