Skip to contentSkip to conversation

Debug bits for the tty ldisc problem

PATCH In review Alan Cox 3 participants 6 messages Jun 15, 2009 Char and misc drivers

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

cover Debug bits for the tty ldisc problem

See if this turns anything up or fixes it. I'm not 100% sure the close one is safe for locking but as the lock detector has been busted since 2.6.30 its a bit hard to be sure.
---

Alan Cox (2):
ldisc: debug aids
ldisc: Make sure the ldisc isn't active when we close it

 drivers/char/tty_ldisc.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Signature · 3 lines
	"In flight refueling scares me. It's like two elephants 
			mating at mach one"
				-- Arjan van de Ven
author
#1 lore raw

PATCH 1/2 ldisc: Make sure the ldisc isn't active when we close it

From: Alan Cox <[email protected]>

---

 drivers/char/tty_ldisc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/char/tty_ldisc.c +2 -0
index 94b3e06..874c248 100644
@@ -793,6 +793,8 @@ void tty_ldisc_hangup(struct tty_struct *tty)
 		/* Avoid racing set_ldisc */
 		mutex_lock(&tty->ldisc_mutex);
 		/* Switch back to N_TTY */
+		tty_ldisc_halt(tty);
+		tty_ldisc_wait_idle(tty);
 		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
author
#2 lore raw

PATCH 2/2 ldisc: debug aids

In reply to Alan Cox

From: Alan Cox <[email protected]>

---

 drivers/char/tty_ldisc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/char/tty_ldisc.c +1 -0
index 874c248..a19e935 100644
@@ -207,6 +207,7 @@ static void tty_ldisc_put(struct tty_ldisc *ld)
 	ldo->refcount--;
 	module_put(ldo->owner);
 	spin_unlock_irqrestore(&tty_ldisc_lock, flags);
+	WARN_ON(ld->refcount);
 	kfree(ld);
 }
 
#3 lore raw
In reply to Alan Cox
Quoted 3 lines · Alan Cox

I'm not 100% sure the close one is
safe for locking but as the lock detector has been busted since 2.6.30 its a bit hard to be sure.

Would you have some specifics?

author
#4 lore raw
Quoted 6 lines · On Mon, 15 Jun 2009 16:39:56 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 3 lines · Alan Cox

I'm not 100% sure the close one is
safe for locking but as the lock detector has been busted since 2.6.30 its a bit hard to be sure.

Would you have some specifics?

I stuck it in bugzilla basically it blows up with a

BUG: MAX_STACK_TRACE_ENTRIES too low! turning off the locking correctness

validator.

and has done for ages.

#5 lore raw
Quoted 8 lines · Alan Cox
Quoted 5 lines · On Mon, 15 Jun 2009 16:39:56 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 3 lines · Alan Cox

I'm not 100% sure the close one is
safe for locking but as the lock detector has been busted since 2.6.30 its a bit hard to be sure.

Quoted 8 lines
Quoted 1 line

Would you have some specifics?

I stuck it in bugzilla basically it blows up with a

BUG: MAX_STACK_TRACE_ENTRIES too low! turning off the locking 

correctness validator.

and has done for ages.

It's hitting a simple limit. Please try the patch below - it quadruples the value printed in the warning (the number of entries)
- does that get your system going?

Lock validation is getting more and more popular, covering now a lot more than just locks (workqueues, timers, etc.), so the max number of entries is steadily increasing. Some configs will run into this faster.

Ingo

kernel/lockdep_internals.h +1 -1
index 699a2ac..031f4c6 100644
@@ -65,7 +65,7 @@ enum {
  * Stack-trace: tightly packed array of stack backtrace
  * addresses. Protected by the hash_lock.
  */
-#define MAX_STACK_TRACE_ENTRIES	262144UL
+#define MAX_STACK_TRACE_ENTRIES	1048576UL
 
 extern struct list_head all_lock_classes;
 extern struct lock_chain lock_chains[];