public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Kyle McMartin <kyle@mcmartin.ca>
Cc: Valdis.Kletnieks@vt.edu, akpm@linux-foundation.org,
	mm-commits@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alan Cox <alan@lxorguk.ukuu.org.uk>, Greg KH <gregkh@suse.de>
Subject: Re: mmotm 2010-11-23 - WARNING: at drivers/tty/tty_io.c:1331
Date: Thu, 25 Nov 2010 17:44:48 +0100	[thread overview]
Message-ID: <4CEE9280.9050504@suse.cz> (raw)
In-Reply-To: <20101125151436.GG22651@bombadil.infradead.org>

On 11/25/2010 04:14 PM, Kyle McMartin wrote:
> On Tue, Nov 23, 2010 at 11:55:39PM -0500, Valdis.Kletnieks@vt.edu wrote:
>> On Tue, 23 Nov 2010 16:13:06 PST, akpm@linux-foundation.org said:
>>> The mm-of-the-moment snapshot 2010-11-23-16-12 has been uploaded to
>>>
>>>    http://userweb.kernel.org/~akpm/mmotm/
>>
>> Seen during boot:
>>
>> [   23.015448] Modules linked in:
>> [   23.015453] Pid: 1207, comm: plymouthd Not tainted 2.6.37-rc3-mmotm1123 #3
>> [   23.015455] Call Trace:
> 
> I've been trying to figure this one out for a while, without much luck.
> (Users are seeing it in 2.6.36 as well.)
> 
> I *think* (I added a rawhide debugging patch to print the tty->name)
> that plymouth is always opening tty7 to cause this. My guess is the BKL
> removal has exposed some kind of race, but it's not obvious to me (and
> there's many other bugs to sort through too. :(
> 
> CC-ing Jiri since he seems to be the poor guy who's been poking this
> recently (there's a good few threads about this (though the others look
> like an ldisc attach race...)) I wouldn't think that's the case here
> since N_TTY is the default...

Ok, tty_reopen is called without TTY_LDISC set. For further
considerations, note tty_lock is held in tty_open. TTY_LDISC is cleared in:

1) __tty_hangup from tty_ldisc_hangup to tty_ldisc_enable. During this
section tty_lock is held.

2) tty_release via tty_ldisc_release till the end of tty existence. If
tty->count <= 1, tty_lock is taken, TTY_CLOSING bit set and then
tty_ldisc_release called. tty_reopen checks TTY_CLOSING before checking
TTY_LDISC.

3) tty_set_ldisc from tty_ldisc_halt to tty_ldisc_enable. We take
tty_lock, set TTY_LDISC_CHANGING, put tty_lock, do some other work, take
tty_lock, call tty_ldisc_enable, put tty_lock.

So the only option I see is 3) and we should do:
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1310,7 +1310,8 @@ static int tty_reopen(struct tty_struct *tty)
 {
        struct tty_driver *driver = tty->driver;

-       if (test_bit(TTY_CLOSING, &tty->flags))
+       if (test_bit(TTY_CLOSING, &tty->flags) ||
+                       test_bit(TTY_LDISC_CHANGING, &tty->flags))
                return -EIO;

        if (driver->type == TTY_DRIVER_TYPE_PTY &&

Alan, Greg?

thanks,
-- 
js
suse labs

  reply	other threads:[~2010-11-25 16:45 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-24  0:13 mmotm 2010-11-23-16-12 uploaded akpm
2010-11-24  4:52 ` mmotm 2010-11-23 - lockdep whinge in e1000e driver Valdis.Kletnieks
2010-11-24  4:55 ` mmotm 2010-11-23 - WARNING: at drivers/tty/tty_io.c:1331 Valdis.Kletnieks
2010-11-25 15:14   ` Kyle McMartin
2010-11-25 16:44     ` Jiri Slaby [this message]
2010-11-25 16:51       ` Jiri Slaby
2010-11-25 17:16         ` [PATCH 1/1] TTY: don't allow reopen when ldisc is changing Jiri Slaby
2010-11-25 17:59           ` Kyle McMartin
2010-11-26  0:28           ` Kyle McMartin
2010-11-26  7:46             ` Jiri Slaby
2010-11-26 13:27               ` Kyle McMartin
2010-11-27  2:59               ` Kyle McMartin
2010-11-27  8:50                 ` Jiri Slaby
2010-11-27  9:43                   ` Jiri Slaby
2010-11-27 15:11                     ` Jiri Slaby
2010-11-27 23:53                       ` Kyle McMartin
2010-11-24  5:01 ` mmotm 2010-11-23 + autogroups -> inconsistent lock state Valdis.Kletnieks
2010-11-24 20:25   ` Mike Galbraith
2010-11-24 20:39     ` Mike Galbraith
2010-11-25  6:09     ` Valdis.Kletnieks
2010-12-02 18:16     ` Paul E. McKenney
2010-12-03  3:58       ` Mike Galbraith
2010-11-24 13:56 ` mmotm 2010-11-23-16-12 uploaded Zimny Lech
2010-11-24 18:51 ` mmotm 2010-11-23-16-12 uploaded (olpc) Randy Dunlap
2010-11-24 19:13   ` Andres Salomon
2010-11-26 16:46   ` Daniel Drake
2010-11-24 19:41 ` [PATCH -mmotm/-next] media: fix timblogiw kconfig & build error Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CEE9280.9050504@suse.cz \
    --to=jslaby@suse.cz \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@suse.de \
    --cc=kyle@mcmartin.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mm-commits@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox