public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Mysterious lockdep warning from the SCSI workqueue code
@ 2007-12-22 17:27 James Bottomley
  2007-12-22 22:56 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2007-12-22 17:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arjan van de Ven

I've no idea why this is occurring:

WARNING: at kernel/lockdep.c:700 look_up_lock_class()
Pid: 2068, comm: scsi_wq_3 Not tainted 2.6.24-rc6 #38
 [<c010535a>] show_trace_log_lvl+0x1a/0x30
 [<c0105ce2>] show_trace+0x12/0x20
 [<c010601c>] dump_stack+0x6c/0x80
 [<c014696d>] __lock_acquire+0x46d/0x10b0
 [<c0147628>] lock_acquire+0x78/0xa0
 [<c0136d18>] run_workqueue+0x128/0x1d0
 [<c013795c>] worker_thread+0x8c/0xf0
 [<c013ab32>] kthread+0x42/0x70
 [<c0104f47>] kernel_thread_helper+0x7/0x10
 =======================

it looks to be happening on the initial workqueue.c:run_workqueue()

	spin_lock_irq(&cwq->lock);

It's caused by lockdep.c:look_up_lock_class()

	WARN_ON_ONCE(class->name != lock->name);

but I'm not entirely sure what this actually means, not fully
understanding lockdep classes and how we acquire them in scsi.

James



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Mysterious lockdep warning from the SCSI workqueue code
  2007-12-22 17:27 Mysterious lockdep warning from the SCSI workqueue code James Bottomley
@ 2007-12-22 22:56 ` Rafael J. Wysocki
  2007-12-22 23:16   ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2007-12-22 22:56 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-kernel, Arjan van de Ven, Ingo Molnar, Peter Zijlstra

On Saturday, 22 of December 2007, James Bottomley wrote:
> I've no idea why this is occurring:
> 
> WARNING: at kernel/lockdep.c:700 look_up_lock_class()
> Pid: 2068, comm: scsi_wq_3 Not tainted 2.6.24-rc6 #38
>  [<c010535a>] show_trace_log_lvl+0x1a/0x30
>  [<c0105ce2>] show_trace+0x12/0x20
>  [<c010601c>] dump_stack+0x6c/0x80
>  [<c014696d>] __lock_acquire+0x46d/0x10b0
>  [<c0147628>] lock_acquire+0x78/0xa0
>  [<c0136d18>] run_workqueue+0x128/0x1d0
>  [<c013795c>] worker_thread+0x8c/0xf0
>  [<c013ab32>] kthread+0x42/0x70
>  [<c0104f47>] kernel_thread_helper+0x7/0x10
>  =======================
> 
> it looks to be happening on the initial workqueue.c:run_workqueue()
> 
> 	spin_lock_irq(&cwq->lock);
> 
> It's caused by lockdep.c:look_up_lock_class()
> 
> 	WARN_ON_ONCE(class->name != lock->name);
> 
> but I'm not entirely sure what this actually means, not fully
> understanding lockdep classes and how we acquire them in scsi.

I guess Ingo and/or Peter should have a look at this.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Mysterious lockdep warning from the SCSI workqueue code
  2007-12-22 22:56 ` Rafael J. Wysocki
@ 2007-12-22 23:16   ` Peter Zijlstra
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2007-12-22 23:16 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: James Bottomley, linux-kernel, Arjan van de Ven, Ingo Molnar


On Sat, 2007-12-22 at 23:56 +0100, Rafael J. Wysocki wrote:
> On Saturday, 22 of December 2007, James Bottomley wrote:
> > I've no idea why this is occurring:
> > 
> > WARNING: at kernel/lockdep.c:700 look_up_lock_class()
> > Pid: 2068, comm: scsi_wq_3 Not tainted 2.6.24-rc6 #38
> >  [<c010535a>] show_trace_log_lvl+0x1a/0x30
> >  [<c0105ce2>] show_trace+0x12/0x20
> >  [<c010601c>] dump_stack+0x6c/0x80
> >  [<c014696d>] __lock_acquire+0x46d/0x10b0
> >  [<c0147628>] lock_acquire+0x78/0xa0
> >  [<c0136d18>] run_workqueue+0x128/0x1d0
> >  [<c013795c>] worker_thread+0x8c/0xf0
> >  [<c013ab32>] kthread+0x42/0x70
> >  [<c0104f47>] kernel_thread_helper+0x7/0x10
> >  =======================
> > 
> > it looks to be happening on the initial workqueue.c:run_workqueue()
> > 
> > 	spin_lock_irq(&cwq->lock);
> > 
> > It's caused by lockdep.c:look_up_lock_class()
> > 
> > 	WARN_ON_ONCE(class->name != lock->name);
> > 
> > but I'm not entirely sure what this actually means, not fully
> > understanding lockdep classes and how we acquire them in scsi.
> 
> I guess Ingo and/or Peter should have a look at this.

This makes me think of an invalid use of lockdep_set_class(). The
typical way to trigger this is:

struct lock_class_key my_keys[10];

struct my_obj *create_my_obj1()
{
	...
	spin_lock_init(&my_obj.lock);
	lockdep_set_class(&my_obj.lock, my_keys + foo);
	...
}

struct my_obj *create_my_obj2()
{
	...
	spin_lock_init(&my_obj.lock);
	lockdep_set_class(&my_obj.lock, my_keys + bar);
	...
}

This initializes &my_obj.lock to the same class (provides foo and bar
evaluate to the same), but give it a different name.

#define lockdep_set_class(lock, key) \
                lockdep_init_map(&(lock)->dep_map, #key, key, 0)

The name is #key, so: "my_keys + foo" vs "my_keys + bar"

The possible fixes are:
  - make key identical by changing the expression
  - use lockdep_set_class_and_name() and specify a
    consistent name by hand.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-12-22 23:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-22 17:27 Mysterious lockdep warning from the SCSI workqueue code James Bottomley
2007-12-22 22:56 ` Rafael J. Wysocki
2007-12-22 23:16   ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox