inconsistent lock state (tty? input?) - Kernel
This is a discussion on inconsistent lock state (tty? input?) - Kernel ; On current git (a447c0932445f92ce6f4c1bd020f62c5097a7842):
[ 12.288256] Adding 1020112k swap on /dev/sda2. Priority:-1 extents:1 across:1020112k
[ 33.469646] Marking TSC unstable due to cpufreq changes
[ 37.320027] Clocksource tsc unstable (delta = -122876252 ns)
[ 46.696880]
[ 46.696883] =================================
[ 46.696899] [ ...
-
inconsistent lock state (tty? input?)
On current git (a447c0932445f92ce6f4c1bd020f62c5097a7842):
[ 12.288256] Adding 1020112k swap on /dev/sda2. Priority:-1 extents:1 across:1020112k
[ 33.469646] Marking TSC unstable due to cpufreq changes
[ 37.320027] Clocksource tsc unstable (delta = -122876252 ns)
[ 46.696880]
[ 46.696883] =================================
[ 46.696899] [ INFO: inconsistent lock state ]
[ 46.696904] 2.6.27-03556-gbc1d26d #15
[ 46.696908] ---------------------------------
[ 46.696912] inconsistent {hardirq-on-W} -> {in-hardirq-R} usage.
[ 46.696917] swapper/0 [HC1[1]:SC0[0]:HE0:SE1] takes:
[ 46.696921] (tasklist_lock){--?-}, at: [] send_sigio+0x3f/0xa1
[ 46.696940] {hardirq-on-W} state was registered at:
[ 46.696946] [] mark_held_locks+0x52/0x72
[ 46.696955] [] trace_hardirqs_on_caller+0xf9/0x13a
[ 46.696963] [] trace_hardirqs_on+0xd/0xf
[ 46.696970] [] _spin_unlock_irq+0x30/0x57
[ 46.696980] [] proc_clear_tty+0x4e/0x5b
[ 46.696988] [] sys_setsid+0x86/0xa2
[ 46.696998] [] system_call_fastpath+0x16/0x1b
[ 46.697006] [] 0xffffffffffffffff
[ 46.697015] irq event stamp: 406110
[ 46.697019] hardirqs last enabled at (406109): [] trace_hardirqs_on+0xd/0xf
[ 46.697027] hardirqs last disabled at (406110): [] trace_hardirqs_off_thunk+0x3a/0x3c
[ 46.697036] softirqs last enabled at (406098): [] __do_softirq+0xbc/0xc4
[ 46.697045] softirqs last disabled at (406065): [] call_softirq+0x1c/0x28
[ 46.697053]
[ 46.697054] other info that might help us debug this:
[ 46.697059] 6 locks held by swapper/0:
[ 46.697064] #0: (&serio->lock){++..}, at: [] serio_interrupt+0x2b/0x83
[ 46.697080] #1: (&dev->event_lock){++..}, at: [] input_event+0x40/0x7a
[ 46.697096] #2: (rcu_read_lock){..--}, at: [] input_pass_event+0x0/0xfa
[ 46.697111] #3: (rcu_read_lock){..--}, at: [] mousedev_notify_readers+0x0/0x237
[ 46.697127] #4: (fasync_lock){..+.}, at: [] kill_fasync+0x2c/0x4e
[ 46.697142] #5: (&f->f_owner.lock){..+.}, at: [] send_sigio+0x24/0xa1
[ 46.697155]
[ 46.697156] stack backtrace:
[ 46.697165] Pid: 0, comm: swapper Not tainted 2.6.27-03556-gbc1d26d #15
[ 46.697171] Call Trace:
[ 46.697175] [] print_usage_bug+0x1ad/0x1be
[ 46.697188] [] mark_lock_irq+0x29b/0x681
[ 46.697193] [] mark_lock+0x1f9/0x2d1
[ 46.697198] [] mark_irqflags+0x2c/0xf2
[ 46.697204] [] __lock_acquire+0x4e8/0x634
[ 46.697210] [] lock_acquire+0x85/0xa9
[ 46.697216] [] ? send_sigio+0x3f/0xa1
[ 46.697222] [] _read_lock+0x3e/0x4a
[ 46.697227] [] ? send_sigio+0x3f/0xa1
[ 46.697233] [] send_sigio+0x3f/0xa1
[ 46.697238] [] __kill_fasync+0x54/0x65
[ 46.697244] [] kill_fasync+0x3a/0x4e
[ 46.697249] [] mousedev_notify_readers+0x1b6/0x237
[ 46.697256] [] ? mousedev_notify_readers+0x0/0x237
[ 46.697261] [] mousedev_event+0x119/0x14e
[ 46.697267] [] input_pass_event+0x94/0xfa
[ 46.697274] [] ? input_pass_event+0x0/0xfa
[ 46.697279] [] input_handle_event+0x25c/0x281
[ 46.697286] [] input_event+0x62/0x7a
[ 46.697293] [] psmouse_process_byte+0x257/0x267
[ 46.697298] [] psmouse_handle_byte+0x17/0x10d
[ 46.697305] [] psmouse_interrupt+0x277/0x285
[ 46.697311] [] ? serio_interrupt+0x2b/0x83
[ 46.697316] [] serio_interrupt+0x47/0x83
[ 46.697322] [] i8042_interrupt+0x20b/0x223
[ 46.697328] [] handle_IRQ_event+0x25/0x5a
[ 46.697334] [] handle_edge_irq+0xdd/0x123
[ 46.697340] [] do_IRQ+0xe4/0x14c
[ 46.697345] [] ret_from_intr+0x0/0xf
[ 46.697350] [] ? __atomic_notifier_call_chain+0x0/0xb7
[ 46.697363] [] ? default_idle+0x32/0x4c
[ 46.697369] [] ? default_idle+0x30/0x4c
[ 46.697374] [] ? cpu_idle+0x4b/0x87
[ 46.697494] [] ? rest_init+0x75/0x77
Didn't happen on 4480f15b3306f43bbb0310d461142b4e897ca45b (Oct 12)
and fd048088306656824958e7783ffcee27e241b361 (Oct 11).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
-
Re: inconsistent lock state (tty? input?)
On Mon, 13 Oct 2008 20:37:43 +0200
Marcin Slusarz wrote:
> On current git (a447c0932445f92ce6f4c1bd020f62c5097a7842):
\
good spotting;
the patch below should fix this:
From 26c117549415c55585f46ad38cd58a5f84f5adc7 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven
Date: Mon, 13 Oct 2008 14:56:39 -0400
Subject: [PATCH] tty: make sure that proc_clear_tty stores the cpu flags
proc_clear_tty() gets called with interrupts off (while holding the task list lock)
from sys_setid. This means that it needs the _irqsave version of the locking primitives.
Reported-by: Marcin Slusarz
Signed-off-by: Arjan van de Ven
---
drivers/char/tty_io.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index e4dce87..4715961 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3595,9 +3595,10 @@ EXPORT_SYMBOL(tty_devnum);
void proc_clear_tty(struct task_struct *p)
{
- spin_lock_irq(&p->sighand->siglock);
+ unsigned long flags;
+ spin_lock_irqsave(&p->sighand->siglock, flags);
p->signal->tty = NULL;
- spin_unlock_irq(&p->sighand->siglock);
+ spin_unlock_irqrestore(&p->sighand->siglock, flags);
}
/* Called under the sighand lock */
--
1.5.5.1
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
-
Re: inconsistent lock state (tty? input?)
On Mon, Oct 13, 2008 at 02:57:12PM -0400, Arjan van de Ven wrote:
> On Mon, 13 Oct 2008 20:37:43 +0200
> Marcin Slusarz wrote:
>
> > On current git (a447c0932445f92ce6f4c1bd020f62c5097a7842):
> \
>
> good spotting;
>
> the patch below should fix this:
>
> From 26c117549415c55585f46ad38cd58a5f84f5adc7 Mon Sep 17 00:00:00 2001
> From: Arjan van de Ven
> Date: Mon, 13 Oct 2008 14:56:39 -0400
> Subject: [PATCH] tty: make sure that proc_clear_tty stores the cpu flags
>
> proc_clear_tty() gets called with interrupts off (while holding the task list lock)
> from sys_setid. This means that it needs the _irqsave version of the locking primitives.
>
> Reported-by: Marcin Slusarz
> Signed-off-by: Arjan van de Ven
> ---
> drivers/char/tty_io.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
> index e4dce87..4715961 100644
> --- a/drivers/char/tty_io.c
> +++ b/drivers/char/tty_io.c
> @@ -3595,9 +3595,10 @@ EXPORT_SYMBOL(tty_devnum);
>
> void proc_clear_tty(struct task_struct *p)
> {
> - spin_lock_irq(&p->sighand->siglock);
> + unsigned long flags;
> + spin_lock_irqsave(&p->sighand->siglock, flags);
> p->signal->tty = NULL;
> - spin_unlock_irq(&p->sighand->siglock);
> + spin_unlock_irqrestore(&p->sighand->siglock, flags);
> }
>
> /* Called under the sighand lock */
> --
It worked, thanks!
But I had to manually apply this patch (this function looks different now)
Updated patch below:
---
From: Arjan van de Ven
Subject: [PATCH] tty: make sure that proc_clear_tty stores the cpu flags
proc_clear_tty() gets called with interrupts off (while holding the task list lock)
from sys_setid. This means that it needs the _irqsave version of the locking primitives.
Reported-and-tested-by: Marcin Slusarz
Signed-off-by: Arjan van de Ven
---
drivers/char/tty_io.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 7053d63..3f48d88 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3032,11 +3032,12 @@ EXPORT_SYMBOL(tty_devnum);
void proc_clear_tty(struct task_struct *p)
{
+ unsigned long flags;
struct tty_struct *tty;
- spin_lock_irq(&p->sighand->siglock);
+ spin_lock_irqsave(&p->sighand->siglock, flags);
tty = p->signal->tty;
p->signal->tty = NULL;
- spin_unlock_irq(&p->sighand->siglock);
+ spin_unlock_irqrestore(&p->sighand->siglock, flags);
tty_kref_put(tty);
}
--
1.5.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/