Message ID | 20090705145203.GA8326@linux-sh.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers |
Return-path: <linux-media-owner@vger.kernel.org> Envelope-to: mchehab@infradead.org Delivery-date: Sun, 05 Jul 2009 14:52:40 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for <mchehab@localhost> (single-drop); Sun, 05 Jul 2009 11:53:40 -0300 (BRT) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MNT56-0000gs-GX; Sun, 05 Jul 2009 14:52:40 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753239AbZGEOwP (ORCPT <rfc822; kmpark@infradead.org> + 1 other); Sun, 5 Jul 2009 10:52:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756515AbZGEOwP (ORCPT <rfc822;linux-media-outgoing>); Sun, 5 Jul 2009 10:52:15 -0400 Received: from 124x34x33x190.ap124.ftth.ucom.ne.jp ([124.34.33.190]:55248 "EHLO master.linux-sh.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753239AbZGEOwO (ORCPT <rfc822; linux-media@vger.kernel.org>); Sun, 5 Jul 2009 10:52:14 -0400 Received: from localhost (unknown [127.0.0.1]) by master.linux-sh.org (Postfix) with ESMTP id 8F3CF63754; Sun, 5 Jul 2009 14:52:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at linux-sh.org Received: from master.linux-sh.org ([127.0.0.1]) by localhost (master.linux-sh.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qJ1GNXIrQL9h; Sun, 5 Jul 2009 23:52:04 +0900 (JST) Received: by master.linux-sh.org (Postfix, from userid 500) id 2612763758; Sun, 5 Jul 2009 23:52:04 +0900 (JST) Date: Sun, 5 Jul 2009 23:52:03 +0900 From: Paul Mundt <lethal@linux-sh.org> To: Linus Torvalds <torvalds@linux-foundation.org> Cc: Wu Zhangjin <wuzhangjin@gmail.com>, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Krzysztof Helt <krzysztof.h1@wp.pl>, Peter Zijlstra <a.p.zijlstra@chello.nl>, "Rafael J. Wysocki" <rjw@sisk.pl>, Andrew Morton <akpm@linux-foundation.org>, Ralf Baechle <ralf@linux-mips.org>, ???? <yanh@lemote.com>, zhangfx <zhangfx@lemote.com> Subject: Re: [BUG] drivers/video/sis: deadlock introduced by "fbdev: add mutex for fb_mmap locking" Message-ID: <20090705145203.GA8326@linux-sh.org> Mail-Followup-To: Paul Mundt <lethal@linux-sh.org>, Linus Torvalds <torvalds@linux-foundation.org>, Wu Zhangjin <wuzhangjin@gmail.com>, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Krzysztof Helt <krzysztof.h1@wp.pl>, Peter Zijlstra <a.p.zijlstra@chello.nl>, "Rafael J. Wysocki" <rjw@sisk.pl>, Andrew Morton <akpm@linux-foundation.org>, Ralf Baechle <ralf@linux-mips.org>, ???? <yanh@lemote.com>, zhangfx <zhangfx@lemote.com> References: <1246785112.14240.34.camel@falcon> <alpine.LFD.2.01.0907050715490.3210@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <alpine.LFD.2.01.0907050715490.3210@localhost.localdomain> User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org |
Commit Message
Paul Mundt
July 5, 2009, 2:52 p.m. UTC
On Sun, Jul 05, 2009 at 07:19:33AM -0700, Linus Torvalds wrote: > > > On Sun, 5 Jul 2009, Wu Zhangjin wrote: > > > > then it works! so, I guess there is a deadlock introduced by the above > > commit. > > Hmm. Perhaps more likely, the 'mm_lock' mutex hasn't even been initialized > yet. We appear to have had that problem with matroxfb and sm501fb, and it > may be more common than that. See commit f50bf2b2. > > That said, I do agree that the mm_lock seems to be causing more problems > than it actually fixes, and maybe we should revert it. Krzysztof? > Looking at this a bit closer, just moving the mutex initialization in to framebuffer_alloc() should basically fix most of these, at least it certainly does for sm501fb and for this sis case as well. So, here's a patch to do that. As an aside note, matroxfb is the odd one out, as it doesn't use framebuffer_alloc() directly for whatever reason. This actually raises an additional issue, in that framebuffer_alloc() is already where other mutexes are initialized, which will simply never happen on matroxfb (suggesting that at least the FB_BACKLIGHT and matroxfb combination will blow up, although perhaps that's not a valid combination). Signed-off-by: Paul Mundt <lethal@linux-sh.org> --- drivers/video/fbmem.c | 1 - drivers/video/fbsysfs.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Comments
On Sun, 5 Jul 2009, Paul Mundt wrote: > break; > fb_info->node = i; > mutex_init(&fb_info->lock); > - mutex_init(&fb_info->mm_lock); Why not "lock" as well? Linus -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sun, Jul 05, 2009 at 07:56:56AM -0700, Linus Torvalds wrote: > > > On Sun, 5 Jul 2009, Paul Mundt wrote: > > break; > > fb_info->node = i; > > mutex_init(&fb_info->lock); > > - mutex_init(&fb_info->mm_lock); > > Why not "lock" as well? > I had that initially, but matroxfb will break if we do that, and presently nothing cares about trying to take ->lock that early on. ->mm_lock was a special case as the lock/unlock pairs were sprinkled around well before initialization, while in the ->lock case all of the lock/unlock pairs are handled internally by the fbmem code (at least a quick grep does not show any drivers using it on their own). -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, 6 Jul 2009, Paul Mundt wrote: > > > > Why not "lock" as well? > > I had that initially, but matroxfb will break if we do that, and > presently nothing cares about trying to take ->lock that early on. I really would rather have consistency than some odd rules like that. In particular - if matroxfb is different and needs its own lock initialization because it doesn't use the common allocation routine, then please make _that_ consistent too. Rather than have it special-case just one lock that it needs to initialize separately, make it clear that since it does its own allocations it needs to initialize _everything_ separately. Otherwise anybody grepping for things will always be confused, since depending on random factors they'll notice the initializations in one place or the other, and then do the wrong thing - exactly like mm_lock was not correctly initialized this time around. In other words: it's actually _better_ to make the matroxfb pain _more_ obvious rather than less. And maybe we can deprecate the driver, throw it out entirely, or have somebody actually fix it? Linus -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 53ea056..27a5271 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -1514,7 +1514,6 @@ register_framebuffer(struct fb_info *fb_info) break; fb_info->node = i; mutex_init(&fb_info->lock); - mutex_init(&fb_info->mm_lock); fb_info->dev = device_create(fb_class, fb_info->device, MKDEV(FB_MAJOR, i), NULL, "fb%d", i); diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index d4a2c11..dd413ad 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c @@ -62,6 +62,8 @@ struct fb_info *framebuffer_alloc(size_t size, struct device *dev) mutex_init(&info->bl_curve_mutex); #endif + mutex_init(&info->mm_lock); + return info; #undef PADDING #undef BYTES_PER_LONG