From: tip-bot for Byungchul Park <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, byungchul.park@lge.com, peterz@infradead.org,
boqun.feng@gmail.com, torvalds@linux-foundation.org,
mingo@kernel.org, tglx@linutronix.de,
linux-kernel@vger.kernel.org
Subject: [tip:locking/core] locking/lockdep: Fix the rollback and overwrite detection logic in crossrelease
Date: Mon, 14 Aug 2017 04:46:06 -0700 [thread overview]
Message-ID: <tip-907dc16d7e23ec81a126c9585435494fa1b3a4b7@git.kernel.org> (raw)
In-Reply-To: <1502694052-16085-3-git-send-email-byungchul.park@lge.com>
Commit-ID: 907dc16d7e23ec81a126c9585435494fa1b3a4b7
Gitweb: http://git.kernel.org/tip/907dc16d7e23ec81a126c9585435494fa1b3a4b7
Author: Byungchul Park <byungchul.park@lge.com>
AuthorDate: Mon, 14 Aug 2017 16:00:52 +0900
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 Aug 2017 12:52:17 +0200
locking/lockdep: Fix the rollback and overwrite detection logic in crossrelease
As Boqun Feng pointed out, current->hist_id should be aligned with the
latest valid xhlock->hist_id so that hist_id_save[] storing current->hist_id
can be comparable with xhlock->hist_id. Fix it.
Additionally, the condition for overwrite-detection should be the
opposite. Fix the code and the comments as well.
<- direction to visit
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh (h: history)
^^ ^
|| start from here
|previous entry
current entry
Reported-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Byungchul Park <byungchul.park@lge.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: akpm@linux-foundation.org
Cc: kernel-team@lge.com
Cc: kirill@shutemov.name
Cc: linux-mm@kvack.org
Cc: npiggin@gmail.com
Cc: walken@google.com
Cc: willy@infradead.org
Link: http://lkml.kernel.org/r/1502694052-16085-3-git-send-email-byungchul.park@lge.com
[ Improve the comments some more. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/locking/lockdep.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 257931e..66011c9 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -4853,7 +4853,7 @@ static void add_xhlock(struct held_lock *hlock)
/* Initialize hist_lock's members */
xhlock->hlock = *hlock;
- xhlock->hist_id = current->hist_id++;
+ xhlock->hist_id = ++current->hist_id;
xhlock->trace.nr_entries = 0;
xhlock->trace.max_entries = MAX_XHLOCK_TRACE_ENTRIES;
@@ -5029,12 +5029,12 @@ static void commit_xhlocks(struct cross_lock *xlock)
break;
/*
- * Filter out the cases that the ring buffer was
- * overwritten and the previous entry has a bigger
- * hist_id than the following one, which is impossible
- * otherwise.
+ * Filter out the cases where the ring buffer was
+ * overwritten and the current entry has a bigger
+ * hist_id than the previous one, which is impossible
+ * otherwise:
*/
- if (unlikely(before(xhlock->hist_id, prev_hist_id)))
+ if (unlikely(before(prev_hist_id, xhlock->hist_id)))
break;
prev_hist_id = xhlock->hist_id;
prev parent reply other threads:[~2017-08-14 11:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 7:00 [PATCH 0/2] Fix a bug " Byungchul Park
2017-08-14 7:00 ` [PATCH 1/2] lockdep: Add a comment about crossrelease_hist_end() in lockdep_sys_exit() Byungchul Park
2017-08-14 11:45 ` [tip:locking/core] locking/lockdep: " tip-bot for Byungchul Park
2017-08-14 7:00 ` [PATCH 2/2] lockdep: Fix the rollback and overwrite detection in crossrelease Byungchul Park
2017-08-14 11:46 ` tip-bot for Byungchul Park [this message]
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=tip-907dc16d7e23ec81a126c9585435494fa1b3a4b7@git.kernel.org \
--to=tipbot@zytor.com \
--cc=boqun.feng@gmail.com \
--cc=byungchul.park@lge.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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