[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1468379196-21096-1-git-send-email-tom.leiming@gmail.com>
Date: Wed, 13 Jul 2016 11:06:36 +0800
From: Ming Lei <tom.leiming@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Ming Lei <tom.leiming@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>
Subject: [PATCH] lockdep: fix warning in case of no_validate lock
Now there are several locks which are marked as
no_validate, so name of the lock class can be
different with the no_validate lock.
This patch avoids this warning for this case, and
fix the following warning:
[ 14.413292] ------------[ cut here ]------------
[ 14.413297] WARNING: CPU: 1 PID: 1434 at kernel/locking/lockdep.c:704
register_lock_class+0x44a/0x4f0
[ 14.413298] Modules linked in: bcache raid1 psmouse dax_pmem dax nd_pmem
serio_raw nvme nd_btt nvme_core floppy null_blk configs autofs4
[ 14.413309] CPU: 1 PID: 1434 Comm: bcache-register Tainted: G
W 4.7.0-rc6-next-20160708+ #2069
[ 14.413310] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
rel-1.9.0-0-g01a84be-prebuilt.qemu-project.org 04/01/2014
[ 14.413311] 0000000000000000 ffff880076973900 ffffffffba459dec 0000000000000000
[ 14.413313] 0000000000000000 ffff880076973940 ffffffffba08af71 000002c0ba1312a2
[ 14.413316] ffffffffbb9fd1e0 0000000000000000 0000000000000000 ffff880074d078d0
[ 14.413318] Call Trace:
[ 14.413321] [<ffffffffba459dec>] dump_stack+0x85/0xc9
[ 14.413323] [<ffffffffba08af71>] __warn+0xd1/0xf0
[ 14.413324] [<ffffffffba08b05d>] warn_slowpath_null+0x1d/0x20
[ 14.413326] [<ffffffffba0e5b8a>] register_lock_class+0x44a/0x4f0
[ 14.413328] [<ffffffffba0e81a5>] __lock_acquire+0x85/0x1920
[ 14.413330] [<ffffffffba06c893>] ? kvm_clock_read+0x23/0x40
[ 14.413332] [<ffffffffba03ebc9>] ? sched_clock+0x9/0x10
[ 14.413334] [<ffffffffba0c5568>] ? sched_clock_local+0x18/0x80
[ 14.413336] [<ffffffffba0ea0c4>] lock_acquire+0xd4/0x240
[ 14.413342] [<ffffffffc02f29b4>] ? mca_reap+0x54/0x180 [bcache]
[ 14.413343] [<ffffffffba0e3937>] down_write_trylock+0x67/0x80
[ 14.413347] [<ffffffffc02f29b4>] ? mca_reap+0x54/0x180 [bcache]
[ 14.413351] [<ffffffffc02f29b4>] mca_reap+0x54/0x180 [bcache]
[ 14.413354] [<ffffffffc02f2e62>] mca_alloc+0xc2/0x5a0 [bcache]
[ 14.413358] [<ffffffffc02f39f3>] bch_btree_node_get+0x143/0x290 [bcache]
[ 14.413364] [<ffffffffc0305939>] run_cache_set+0x239/0x8f0 [bcache]
[ 14.413368] [<ffffffffc0307c12>] register_bcache+0x14d2/0x1a30 [bcache]
[ 14.413370] [<ffffffffba80191b>] ? mutex_lock_nested+0x2db/0x460
[ 14.413372] [<ffffffffba45c52f>] kobj_attr_store+0xf/0x20
[ 14.413374] [<ffffffffba2f5f44>] sysfs_kf_write+0x44/0x60
[ 14.413376] [<ffffffffba2f54d4>] kernfs_fop_write+0x144/0x1e0
[ 14.413378] [<ffffffffba265728>] __vfs_write+0x28/0x120
[ 14.413380] [<ffffffffba0e3bd7>] ? percpu_down_read+0x57/0x90
[ 14.413381] [<ffffffffba26910a>] ? __sb_start_write+0xca/0xe0
[ 14.413382] [<ffffffffba26910a>] ? __sb_start_write+0xca/0xe0
[ 14.413383] [<ffffffffba265e35>] vfs_write+0xb5/0x1b0
[ 14.413385] [<ffffffffba0e7ccf>] ? trace_hardirqs_on_caller+0xef/0x210
[ 14.413386] [<ffffffffba2671c9>] SyS_write+0x49/0xa0
[ 14.413388] [<ffffffffba806ec0>] entry_SYSCALL_64_fastpath+0x23/0xc1
[ 14.413391] [<ffffffffba478c93>] ? __this_cpu_preempt_check+0x13/0x20
[ 14.413392] ---[ end trace 16710c495b4dbf2f ]---
Signed-off-by: Ming Lei <tom.leiming@...il.com>
---
kernel/locking/lockdep.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 589d763..cf071ec 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -701,7 +701,8 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)
* Huh! same key, different name? Did someone trample
* on some memory? We're most confused.
*/
- WARN_ON_ONCE(class->name != lock->name);
+ WARN_ON_ONCE(lock->key != &__lockdep_no_validate__ &&
+ class->name != lock->name);
return class;
}
}
--
1.9.1
Powered by blists - more mailing lists