lkml.org 
[lkml]   [2009]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Bug #14388] keyboard under X with 2.6.31
Linus Torvalds wrote:

> and by releasing that lock it actually seems to break all the buffering
> guarantees! What can happen is:
>
> CPU1 (or thread1 with PREEMPTION)
> CPU2 (or thread2 with PREEMPTION)
>
> flush_to_ldisc()
> ...
> spin_lock_irqsave(..)
> .. get one buffer..
> spin_unlock_irqrestore(..);
>
> <- PREEMPTION POINT, anything can happen ->
> <- more buffers can be added, etc ->
>
> flush_to_ldisc()
> spin_lock_irqsave(..)
> .. get second buffer..
> spin_unlock_irqrestore(..);
> ->receive_buf(tty, char_buf, ...
> spin_lock_irqrestore(..)
> .. all done ..
>
>
> ->receive_buf(tty, char_buf, ...
> spin_lock_irqrestore(...)
>
> Notice how the "->receive_buf()" calls were done out of order, even if the
> data was perfectly in-order in the buffers.

The buffer head is removed and set to null just before
the flushing loop.

If flush_to_ldisc() is reentered with the head set to null, nothing
is done. New buffers can be added where you say, but they are
added to the tail. So the order of flushed data is retained.

This existing mechanism essentially does the same thing as your patch.


--
Paul Fulghum
MicroGate Systems, Ltd.
=Customer Driven, by Design=
(800)444-1982
(512)345-7791 (Direct)
(512)343-9046 (Fax)
Central Time Zone (GMT -5h)
www.microgate.com


\
 
 \ /
  Last update: 2009-10-13 23:59    [W:0.191 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site