Re: WARNING at: drivers/char/tty_ldisc.c

From: Sergey Senozhatsky
Date: Sun Aug 02 2009 - 18:13:21 EST


On (08/02/09 13:20), Linus Torvalds wrote:
> On Sun, 2 Aug 2009, Sergey Senozhatsky wrote:
> >
> > non-SMP system 'fails' as well.
>
> Ahh, can you trigger this reliably? Is it 100% of the time when you shut
> down from single user mode? Or just occasionally?
>
Yes, 100% in both SMP and non-SMP builds.

> I take it that you can't get a trace with sysrq-T because nothing gets
> logged,
TRUE

> and you don't have a serial port console?
I don't have a serial port console.


I think there is no need in
mutex_unlock(&tty->ldisc_mutex); // HACK
...
mutex_lock(&tty->ldisc_mutex); // HACK

since we have tty_ldisc.c:794
mutex_lock(&tty->ldisc_mutex); <<
if (tty->ldisc) { /* Not yet closed */

Anyway, code looks like this:
//JUST FOR TEST!

if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) {
/* Avoid racing set_ldisc or tty_ldisc_release */
//mutex_lock(&tty->ldisc_mutex); // Commented
if (tty->ldisc) { /* Not yet closed */
int work = 0;
/* Switch back to N_TTY */
mutex_unlock(&tty->ldisc_mutex); // HACK

work = tty_ldisc_halt(tty); //to be sure
if (work) {
WARN_ON(0 != 1);
wait_event_timeout(tty_ldisc_wait,
(1 == 0), 15 * HZ); //Just to read what is written on the screen
}

if (tty_ldisc_wait_idle(tty) != 0) {
WARN_ON(0 != 1);
wait_event_timeout(tty_ldisc_wait,
(1 == 0), 15 * HZ); //Just to read what is written on the screen
}
mutex_lock(&tty->ldisc_mutex); // HACK
tty_ldisc_reinit(tty);
/* At this point we have a closed ldisc and we want to
reopen it. We could defer this to the next open but
it means auditing a lot of other paths so this is
a FIXME */
WARN_ON(tty_ldisc_open(tty, tty->ldisc));
tty_ldisc_enable(tty);
}
mutex_unlock(&tty->ldisc_mutex);
tty_reset_termios(tty);
}

This code gave me WARNINGS:
tty_io.c:1267 //tty_reopen: WARN_ON(!test_bit(TTY_LDISC, &tty->flags));
tty_ldisc.c:808 //tty_ldisc_wait_idle
tty_ldisc.c:209 //tty_ldisc_put


Sergey

Attachment: signature.asc
Description: Digital signature