lkml.org 
[lkml]   [2011]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 'scheduling while atomic' during ppp connection on 2.6.37.1 and 2.6.38
On 03/20/2011 10:58 PM, Alan Cox wrote:
>> + spin_lock_irqsave(&dc->spin_mutex, flags);
>> if (port->port.count)
>> room = kfifo_avail(&port->fifo_ul);
>> - mutex_unlock(&port->tty_sem);
>> + spin_unlock_irqrestore(&dc->spin_mutex, flags);
>
> dc->spin_mutex does not protect port->port.count.

Neither port->tty_sem did.

Anyway is the test needed at all? I.e. could
tty->ops->write/chars_in_buffer/ntty_write_room be called with
port->port.count == 0 at all?

And the lock should not as well be needed. Kfifo assures atomicity where
there is only one reader and one writer which should be the case here.
Unless tty->ops->write can be called in parallel. And it should not,
that's what's tty->atomic_write_lock for.

thanks,
--
js
suse labs


\
 
 \ /
  Last update: 2011-03-21 10:17    [W:0.095 / U:2.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site