Only check the blessings table for known LORs.
Previously we would check for blessings before marking a given lock pair as reversed, so each "reversed" lock acquisition would require a linear scan of the table. Instead, check the table after marking the pair as reversed but before generating a report. Reviewed by: jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21135
This commit is contained in:
parent
ef34be8beb
commit
8675f5f776
@ -1344,14 +1344,6 @@ witness_checkorder(struct lock_object *lock, int flags, const char *file,
|
||||
* is allowed or has already been yelled about.
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the lock order is blessed, just bail. We don't
|
||||
* look for other lock order violations though, which
|
||||
* may be a bug.
|
||||
*/
|
||||
if (blessed(w, w1))
|
||||
goto out;
|
||||
|
||||
/* Bail if this violation is known */
|
||||
if (w_rmatrix[w1->w_index][w->w_index] & WITNESS_REVERSAL)
|
||||
goto out;
|
||||
@ -1361,6 +1353,14 @@ witness_checkorder(struct lock_object *lock, int flags, const char *file,
|
||||
w_rmatrix[w->w_index][w1->w_index] |= WITNESS_REVERSAL;
|
||||
w->w_reversed = w1->w_reversed = 1;
|
||||
witness_increment_graph_generation();
|
||||
|
||||
/*
|
||||
* If the lock order is blessed, bail before logging
|
||||
* anything. We don't look for other lock order
|
||||
* violations though, which may be a bug.
|
||||
*/
|
||||
if (blessed(w, w1))
|
||||
goto out;
|
||||
mtx_unlock_spin(&w_mtx);
|
||||
|
||||
#ifdef WITNESS_NO_VNODE
|
||||
@ -2651,6 +2651,9 @@ sbuf_print_witness_badstacks(struct sbuf *sb, size_t *oldidx)
|
||||
}
|
||||
mtx_unlock_spin(&w_mtx);
|
||||
|
||||
if (blessed(tmp_w1, tmp_w2))
|
||||
continue;
|
||||
|
||||
sbuf_printf(sb,
|
||||
"\nLock order reversal between \"%s\"(%s) and \"%s\"(%s)!\n",
|
||||
tmp_w1->w_name, tmp_w1->w_class->lc_name,
|
||||
|
Loading…
Reference in New Issue
Block a user