Problem of g_serial

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Recently, I ran into a problem of running g_serial,that is kernel
crashes when running "cat myfile > /dev/ttyGS0"
I also found a discussion about the similar problem after some big
changes applied to TTY layer.
see :http://lkml.org/lkml/2009/6/22/137
It suggests to  disable the low_latency mode,but this only solves the
problem of "scheduling while atomic",
actually, a new problem is introduced after disabling the low_latency mode.
see the code snippet in  ...gadget/u_serial.c/gs_rx_push()
......
	if (tty && do_push) {
		spin_unlock_irq(&port->port_lock);
		tty_flip_buffer_push(tty);
		wake_up_interruptible(&tty->read_wait);
		spin_lock_irq(&port->port_lock);

		/* tty may have been closed */
		tty = port->port_tty;
	}
......
tty_flip_buffer_push() in tty_buffer.c
......
void tty_flip_buffer_push(struct tty_struct *tty)
{
	unsigned long flags;
	spin_lock_irqsave(&tty->buf.lock, flags);
	if (tty->buf.tail != NULL)
		tty->buf.tail->commit = tty->buf.tail->used;
	spin_unlock_irqrestore(&tty->buf.lock, flags);

	if (tty->low_latency)
		flush_to_ldisc(&tty->buf.work.work);
	else
		schedule_delayed_work(&tty->buf.work, 1);
}
......
When low_latency is disabled,tty_flip_buffer_push(tty) will hire a
work queue to push the buffer,obviously,this is a deferred job.
So, it's not proper  to wake up the read thread right after calling
tty_flip_buffer_push().I have few knowledge about tty stuff.
Does anyone here could give some hints on this problem?

Thanks a lot!


Cliff
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux