From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753320Ab0IMWVa (ORCPT ); Mon, 13 Sep 2010 18:21:30 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:49882 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808Ab0IMWV3 (ORCPT ); Mon, 13 Sep 2010 18:21:29 -0400 Date: Mon, 13 Sep 2010 15:21:27 -0700 From: Andrew Morton To: Jarek Poplawski Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fbcon: fix lockdep warning from fbcon_deinit() Message-Id: <20100913152127.c2328034.akpm@linux-foundation.org> In-Reply-To: <20100913215850.GA2176@del.dom.local> References: <20100913215850.GA2176@del.dom.local> X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.9; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 13 Sep 2010 23:58:50 +0200 Jarek Poplawski wrote: > This patch fixes the lockdep warning: > > [ 13.657164] INFO: trying to register non-static key. > [ 13.657169] the code is fine but needs lockdep annotation. > [ 13.657171] turning off the locking correctness validator. > [ 13.657177] Pid: 622, comm: modprobe Not tainted 2.6.36-rc3c #8 > [ 13.657180] Call Trace: > [ 13.657194] [] ? printk+0x18/0x20 > [ 13.657202] [] register_lock_class+0x336/0x350 > [ 13.657208] [] __lock_acquire+0x449/0x1180 > [ 13.657215] [] lock_acquire+0x67/0x80 > [ 13.657222] [] ? __cancel_work_timer+0x51/0x230 > [ 13.657227] [] __cancel_work_timer+0x83/0x230 > [ 13.657231] [] ? __cancel_work_timer+0x51/0x230 > [ 13.657236] [] ? mark_held_locks+0x62/0x80 > [ 13.657243] [] ? kfree+0x7f/0xe0 > [ 13.657248] [] ? trace_hardirqs_on_caller+0x11c/0x160 > [ 13.657253] [] ? trace_hardirqs_on+0xb/0x10 > [ 13.657259] [] ? fbcon_deinit+0x16d/0x1e0 > [ 13.657263] [] ? fbcon_deinit+0x16d/0x1e0 > [ 13.657268] [] cancel_work_sync+0xa/0x10 > [ 13.657272] [] fbcon_deinit+0xe4/0x1e0 > ... > > The warning is caused by trying to cancel an uninitialized work from > fbcon_exit(). Fix it by adding a check for queue.func, similarly to > other places in this code. > > Signed-off-by: Jarek Poplawski > --- > > diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c > index 84f8423..7ccc967 100644 > --- a/drivers/video/console/fbcon.c > +++ b/drivers/video/console/fbcon.c > @@ -3508,7 +3508,7 @@ static void fbcon_exit(void) > softback_buf = 0UL; > > for (i = 0; i < FB_MAX; i++) { > - int pending; > + int pending = 0; > > mapped = 0; > info = registered_fb[i]; > @@ -3516,7 +3516,8 @@ static void fbcon_exit(void) > if (info == NULL) > continue; > > - pending = cancel_work_sync(&info->queue); > + if (info->queue.func) > + pending = cancel_work_sync(&info->queue); > DPRINTK("fbcon: %s pending work\n", (pending ? "canceled" : > "no")); > Well. It'd be better to just initialise the dang thing. But all that code looks really hacky, fiddling around inside workqueue internals as a driver-private state variable. Needs a rewrite, I suspect. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Date: Mon, 13 Sep 2010 22:21:27 +0000 Subject: Re: [PATCH] fbcon: fix lockdep warning from fbcon_deinit() Message-Id: <20100913152127.c2328034.akpm@linux-foundation.org> List-Id: References: <20100913215850.GA2176@del.dom.local> In-Reply-To: <20100913215850.GA2176@del.dom.local> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Jarek Poplawski Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org On Mon, 13 Sep 2010 23:58:50 +0200 Jarek Poplawski wrote: > This patch fixes the lockdep warning: > > [ 13.657164] INFO: trying to register non-static key. > [ 13.657169] the code is fine but needs lockdep annotation. > [ 13.657171] turning off the locking correctness validator. > [ 13.657177] Pid: 622, comm: modprobe Not tainted 2.6.36-rc3c #8 > [ 13.657180] Call Trace: > [ 13.657194] [] ? printk+0x18/0x20 > [ 13.657202] [] register_lock_class+0x336/0x350 > [ 13.657208] [] __lock_acquire+0x449/0x1180 > [ 13.657215] [] lock_acquire+0x67/0x80 > [ 13.657222] [] ? __cancel_work_timer+0x51/0x230 > [ 13.657227] [] __cancel_work_timer+0x83/0x230 > [ 13.657231] [] ? __cancel_work_timer+0x51/0x230 > [ 13.657236] [] ? mark_held_locks+0x62/0x80 > [ 13.657243] [] ? kfree+0x7f/0xe0 > [ 13.657248] [] ? trace_hardirqs_on_caller+0x11c/0x160 > [ 13.657253] [] ? trace_hardirqs_on+0xb/0x10 > [ 13.657259] [] ? fbcon_deinit+0x16d/0x1e0 > [ 13.657263] [] ? fbcon_deinit+0x16d/0x1e0 > [ 13.657268] [] cancel_work_sync+0xa/0x10 > [ 13.657272] [] fbcon_deinit+0xe4/0x1e0 > ... > > The warning is caused by trying to cancel an uninitialized work from > fbcon_exit(). Fix it by adding a check for queue.func, similarly to > other places in this code. > > Signed-off-by: Jarek Poplawski > --- > > diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c > index 84f8423..7ccc967 100644 > --- a/drivers/video/console/fbcon.c > +++ b/drivers/video/console/fbcon.c > @@ -3508,7 +3508,7 @@ static void fbcon_exit(void) > softback_buf = 0UL; > > for (i = 0; i < FB_MAX; i++) { > - int pending; > + int pending = 0; > > mapped = 0; > info = registered_fb[i]; > @@ -3516,7 +3516,8 @@ static void fbcon_exit(void) > if (info = NULL) > continue; > > - pending = cancel_work_sync(&info->queue); > + if (info->queue.func) > + pending = cancel_work_sync(&info->queue); > DPRINTK("fbcon: %s pending work\n", (pending ? "canceled" : > "no")); > Well. It'd be better to just initialise the dang thing. But all that code looks really hacky, fiddling around inside workqueue internals as a driver-private state variable. Needs a rewrite, I suspect.