[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0912122244530.3089@localhost.localdomain>
Date: Sat, 12 Dec 2009 22:48:41 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...e.hu>, Greg KH <gregkh@...e.de>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
linux-kernel@...r.kernel.org
Subject: Re: [GIT PATCH] TTY patches for 2.6.33-git
On Sat, 12 Dec 2009, Alan Cox wrote:
> > I think we could possibly add a "__might_sleep()" to _lock_kernel(). It
> > doesn't really sleep, but it's invalid to take the kernel lock in an
> > atomic region, so __might_sleep() might be the right thing anyway.
>
> It's only invalid if you don't already hold the lock. The old tty code
> worked because every path into tty_fasync already held the lock ! That
> specific case - taking it the first time should definitely
> __might_sleep().
>
> Mind you it's probably still rather dumb and would be a good debugging
> aid for -next to be able to warn on all offences if only to catch this
> stuff for the future BKL removal work.
Just patched the following in and it catched your problem nicely. With
your AB/BA fix patch applied everything is fine.
Thanks,
tglx
---
Subject: BKL: Add might sleep to __lock_kernel
From: Thomas Gleixner <tglx@...utronix.de>
Date: Sat, 12 Dec 2009 20:29:00 +0100
Catches all offenders which take the BKL first time in an atomic
region. Recursive lock_kernel calls are not affected.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
lib/kernel_lock.c | 2 ++
1 file changed, 2 insertions(+)
Index: linux-2.6/lib/kernel_lock.c
===================================================================
--- linux-2.6.orig/lib/kernel_lock.c
+++ linux-2.6/lib/kernel_lock.c
@@ -64,6 +64,8 @@ void __lockfunc __release_kernel_lock(vo
#ifdef CONFIG_PREEMPT
static inline void __lock_kernel(void)
{
+ might_sleep();
+
preempt_disable();
if (unlikely(!_raw_spin_trylock(&kernel_flag))) {
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists