linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	WANG Cong <xiyou.wangcong@gmail.com>, Tejun Heo <tj@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] sysfs: don't use allocated key for lockdep
Date: Tue, 20 Apr 2010 06:14:20 -0700	[thread overview]
Message-ID: <20100420131420.GA27126@suse.de> (raw)
In-Reply-To: <4BCD246F.4090005@cn.fujitsu.com>

On Tue, Apr 20, 2010 at 11:50:07AM +0800, Lai Jiangshan wrote:
> Reported-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> 
> The commit 6992f5334995af474c2b58d010d08bc597f0f2fe
> does wrong thing that use allocated key for lockdep_map.
> 
> Lockdep requires keys that are static:
> 
> lockdep_init_map() {
> ......
> 	/*
> 	 * Sanity check, the lock-class key must be persistent:
> 	 */
> 	if (!static_obj(key)) {
> 		printk("BUG: key %p not in .data!\n", key);
> 		DEBUG_LOCKS_WARN_ON(1);
> 		return;
> 	}
> 	lock->key = key;
> ......
> }
> 
> Could you please fix it.

All in-kernel attributes should now be fixed, so what exactly is the
remaining issue?

> ----------------
> One other comment (not relate to this bug, but relate to the commit):
> It is not a very good idea that use one lockdep class per sysfs attribute.
> 
> First: we don't have too much lockdep class resource.
> Second: lockdep validator is O(N*N) algorithm.
>         (N is the number of used lockdep class)
> 
> So it is recommended that use only one class for a group of locks.
> 
> For some nesting requirement, you can use
> lock_acquire(...,subclass,...nest_lock,...)
> 
> Or change the design.
> --------------------
> 
> BUG: key ffff880042c68220 not in .data!
> ------------[ cut here ]------------
> WARNING: at kernel/lockdep.c:2706 lockdep_init_map+0xe6/0x4fb()
> Hardware name: Lenovo WQ T168/T468 G6
> Modules linked in: mptsas(+) mptscsih mptbase scsi_transport_sas ext4 jbd2 crc16 uhci_hcd ohci_hcd ehci_hcd
> Pid: 1329, comm: modprobe Not tainted 2.6.34-rc3-22949-gbc8a97a-dirty #1

Please try 2.6.34-rc5 and let us know if this still shows up.

thanks,

greg k-h

  reply	other threads:[~2010-04-20 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20  3:50 [BUG] sysfs: don't use allocated key for lockdep Lai Jiangshan
2010-04-20 13:14 ` Greg KH [this message]
2010-04-20 16:09   ` Jiri Kosina
2010-04-20 16:23     ` Greg KH

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=20100420131420.GA27126@suse.de \
    --to=gregkh@suse.de \
    --cc=ebiederm@xmission.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tj@kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).