From: Peter Zijlstra <peterz@infradead.org>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: "Fengguang Wu" <fengguang.wu@intel.com>,
"Nicolai Hähnle" <Nicolai.Haehnle@amd.com>,
"Chris Wilson" <chris@chris-wilson.co.uk>,
"Ingo Molnar" <mingo@kernel.org>,
linux-kernel@vger.kernel.org, LKP <lkp@01.org>
Subject: Re: [locking/ww_mutex] 2a0c112828 WARNING: CPU: 0 PID: 18 at kernel/locking/mutex.c:305 __ww_mutex_wakeup_for_backoff
Date: Wed, 1 Mar 2017 16:18:45 +0100 [thread overview]
Message-ID: <20170301151845.GK6515@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20170301150138.hdixnmafzfsox7nn@tardis.cn.ibm.com>
On Wed, Mar 01, 2017 at 11:01:38PM +0800, Boqun Feng wrote:
>
> In test-ww_mutex, the stress will use 4096 locks to do the test, and
> given held_lock::references only have 12 bits, so I think this is the
> reason? I made a patch to reduce the lock number of stress test, and it
> seems the problem is resolved.
>
> Thoughts?
Aaaahhh!! YES. I completely overlooked (and forgot) ww_mutex used that.
Let me also do a lockdep patch that complains on overflow there.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5 at ../kernel/locking/lockdep.c:3269 __lock_acquire.isra.7+0xf8/0x703
DEBUG_LOCKS_WARN_ON(hlock->references == (1 << 12)-1)
CPU: 0 PID: 5 Comm: kworker/u2:0 Not tainted 4.10.0-01418-gfba4873-dirty #29
Workqueue: test-ww_mutex stress_inorder_work
Call Trace:
dump_stack+0x16/0x18
__warn+0xa0/0xb7
? __lock_acquire.isra.7+0xf8/0x703
warn_slowpath_fmt+0x28/0x2d
__lock_acquire.isra.7+0xf8/0x703
lock_acquire+0x6c/0x95
? stress_inorder_work+0xbf/0x218
__ww_mutex_lock.constprop.0+0x5c/0x848
? stress_inorder_work+0xbf/0x218
? __might_sleep+0x6c/0x73
ww_mutex_lock+0x34/0x3b
? stress_inorder_work+0xbf/0x218
stress_inorder_work+0xbf/0x218
process_one_work+0x1c0/0x33a
? process_one_work+0x168/0x33a
worker_thread+0x22f/0x315
kthread+0xed/0xf2
? process_scheduled_works+0x24/0x24
? __kthread_create_on_node+0x11f/0x11f
ret_from_fork+0x21/0x30
---[ end trace 326b6bfcd7100ae8 ]---
---
kernel/locking/lockdep.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 9812e5dd409e..c0ee8607c11e 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -3260,10 +3260,17 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
if (depth) {
hlock = curr->held_locks + depth - 1;
if (hlock->class_idx == class_idx && nest_lock) {
- if (hlock->references)
+ if (hlock->references) {
+ /*
+ * Check: unsigned int references:12, overflow.
+ */
+ if (DEBUG_LOCKS_WARN_ON(hlock->references == (1 << 12)-1))
+ return 0;
+
hlock->references++;
- else
+ } else {
hlock->references = 2;
+ }
return 1;
}
next prev parent reply other threads:[~2017-03-01 15:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 5:14 Fengguang Wu
2017-02-27 10:28 ` Peter Zijlstra
2017-02-27 10:35 ` Peter Zijlstra
2017-03-01 15:01 ` Boqun Feng
2017-03-01 15:18 ` Peter Zijlstra [this message]
[not found] ` <20170301154043.hcsbpgooc3kqt45j@wfg-t540p.sh.intel.com>
2017-03-01 15:51 ` Peter Zijlstra
2017-03-01 15:55 ` Fengguang Wu
2017-03-01 15:54 ` Peter Zijlstra
2017-03-01 16:11 ` Chris Wilson
2017-03-01 16:26 ` Chris Wilson
2017-03-01 16:54 ` Peter Zijlstra
2017-03-01 17:39 ` Fengguang Wu
2017-03-02 8:21 ` [tip:locking/urgent] locking/ww_mutex: Adjust the lock number for stress test tip-bot for Boqun Feng
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=20170301151845.GK6515@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Nicolai.Haehnle@amd.com \
--cc=boqun.feng@gmail.com \
--cc=chris@chris-wilson.co.uk \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@01.org \
--cc=mingo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome