All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fbcon: fix lockdep warning from fbcon_deinit()
Date: Tue, 14 Sep 2010 00:35:40 +0200	[thread overview]
Message-ID: <20100913223540.GB2176@del.dom.local> (raw)
In-Reply-To: <20100913152127.c2328034.akpm@linux-foundation.org>

On Mon, Sep 13, 2010 at 03:21:27PM -0700, Andrew Morton wrote:
> On Mon, 13 Sep 2010 23:58:50 +0200
> Jarek Poplawski <jarkao2@gmail.com> 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]  [<c13002c8>] ? printk+0x18/0x20
> > [   13.657202]  [<c1056cf6>] register_lock_class+0x336/0x350
> > [   13.657208]  [<c1058bf9>] __lock_acquire+0x449/0x1180
> > [   13.657215]  [<c1059997>] lock_acquire+0x67/0x80
> > [   13.657222]  [<c1042bf1>] ? __cancel_work_timer+0x51/0x230
> > [   13.657227]  [<c1042c23>] __cancel_work_timer+0x83/0x230
> > [   13.657231]  [<c1042bf1>] ? __cancel_work_timer+0x51/0x230
> > [   13.657236]  [<c10582b2>] ? mark_held_locks+0x62/0x80
> > [   13.657243]  [<c10b3a2f>] ? kfree+0x7f/0xe0
> > [   13.657248]  [<c105853c>] ? trace_hardirqs_on_caller+0x11c/0x160
> > [   13.657253]  [<c105858b>] ? trace_hardirqs_on+0xb/0x10
> > [   13.657259]  [<c117f4cd>] ? fbcon_deinit+0x16d/0x1e0
> > [   13.657263]  [<c117f4cd>] ? fbcon_deinit+0x16d/0x1e0
> > [   13.657268]  [<c1042dea>] cancel_work_sync+0xa/0x10
> > [   13.657272]  [<c117f444>] 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 <jarkao2@gmail.com>
> > ---
> > 
> > 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.
> 

Sure, it's a fast hack. Proper fix, or at least verifying if there
could more such uninitialized things, is welcome.

Jarek P.

WARNING: multiple messages have this Message-ID (diff)
From: Jarek Poplawski <jarkao2@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fbcon: fix lockdep warning from fbcon_deinit()
Date: Mon, 13 Sep 2010 22:35:40 +0000	[thread overview]
Message-ID: <20100913223540.GB2176@del.dom.local> (raw)
In-Reply-To: <20100913152127.c2328034.akpm@linux-foundation.org>

On Mon, Sep 13, 2010 at 03:21:27PM -0700, Andrew Morton wrote:
> On Mon, 13 Sep 2010 23:58:50 +0200
> Jarek Poplawski <jarkao2@gmail.com> 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]  [<c13002c8>] ? printk+0x18/0x20
> > [   13.657202]  [<c1056cf6>] register_lock_class+0x336/0x350
> > [   13.657208]  [<c1058bf9>] __lock_acquire+0x449/0x1180
> > [   13.657215]  [<c1059997>] lock_acquire+0x67/0x80
> > [   13.657222]  [<c1042bf1>] ? __cancel_work_timer+0x51/0x230
> > [   13.657227]  [<c1042c23>] __cancel_work_timer+0x83/0x230
> > [   13.657231]  [<c1042bf1>] ? __cancel_work_timer+0x51/0x230
> > [   13.657236]  [<c10582b2>] ? mark_held_locks+0x62/0x80
> > [   13.657243]  [<c10b3a2f>] ? kfree+0x7f/0xe0
> > [   13.657248]  [<c105853c>] ? trace_hardirqs_on_caller+0x11c/0x160
> > [   13.657253]  [<c105858b>] ? trace_hardirqs_on+0xb/0x10
> > [   13.657259]  [<c117f4cd>] ? fbcon_deinit+0x16d/0x1e0
> > [   13.657263]  [<c117f4cd>] ? fbcon_deinit+0x16d/0x1e0
> > [   13.657268]  [<c1042dea>] cancel_work_sync+0xa/0x10
> > [   13.657272]  [<c117f444>] 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 <jarkao2@gmail.com>
> > ---
> > 
> > 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.
> 

Sure, it's a fast hack. Proper fix, or at least verifying if there
could more such uninitialized things, is welcome.

Jarek P.

  reply	other threads:[~2010-09-13 22:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-13 21:58 [PATCH] fbcon: fix lockdep warning from fbcon_deinit() Jarek Poplawski
2010-09-13 21:58 ` Jarek Poplawski
2010-09-13 22:21 ` Andrew Morton
2010-09-13 22:21   ` Andrew Morton
2010-09-13 22:35   ` Jarek Poplawski [this message]
2010-09-13 22:35     ` Jarek Poplawski
2010-09-15 19:01   ` James Simmons
2010-09-15 19:01     ` James Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100913223540.GB2176@del.dom.local \
    --to=jarkao2@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.