Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1710677
| From | Byungchul Park <byungchul.park@lge.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] lockdep: Fix the rollback and overwrite detection in crossrelease |
| Date | 2017-08-14 09:10 +0200 |
| Message-ID | <uehFF-14m-25@gated-at.bofh.it> (permalink) |
| References | <uehFE-14m-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
As Boqun 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 it with modifying comment.
<- direction to visit
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh (h: history)
^^ ^
|| start from here
|previous entry
current entry
Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
kernel/locking/lockdep.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 1ae4258..f0e6649 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;
@@ -5030,11 +5030,11 @@ static void commit_xhlocks(struct cross_lock *xlock)
/*
* 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
+ * 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;
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] Fix a bug in crossrelease Byungchul Park <byungchul.park@lge.com> - 2017-08-14 09:10 +0200
[PATCH 1/2] lockdep: Add a comment about crossrelease_hist_end() in lockdep_sys_exit() Byungchul Park <byungchul.park@lge.com> - 2017-08-14 09:10 +0200
[tip:locking/core] locking/lockdep: Add a comment about crossrelease_hist_end() in lockdep_sys_exit() tip-bot for Byungchul Park <tipbot@zytor.com> - 2017-08-14 13:50 +0200
[PATCH 2/2] lockdep: Fix the rollback and overwrite detection in crossrelease Byungchul Park <byungchul.park@lge.com> - 2017-08-14 09:10 +0200
[tip:locking/core] locking/lockdep: Fix the rollback and overwrite detection logic in crossrelease tip-bot for Byungchul Park <tipbot@zytor.com> - 2017-08-14 14:00 +0200
csiph-web