[Bug 195262] [lor] Possibly two LORs: entropy harvest mutex and scrlock, and entropy harvest mutex and sleepq chain

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Nov 21 22:26:26 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195262

Xin LI <delphij at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jhb at FreeBSD.org,
                   |                            |markm at FreeBSD.org

--- Comment #3 from Xin LI <delphij at FreeBSD.org> ---
I think these are false positives.

harvest_mtx is a spinning mutex that is only acquired in random_harvestq.c, and
it's already done quite carefully.

The problem is raised when calling msleep_spin_sbt(), which in turn tries to
acquire sleepq chain lock (sys/kern/subr_sleepqueue.c).  In witness, the
"blessed" order is sleepq chain and then entropy harvest mutex, this is not
right (the system does not poke with entropy harvesting when manipulating
sleepq chain), so you see the second LOR warning.

When it tries to print the LOR warning, the code eventually calls printf()
which in turn would go to syscons(4) where scrlock is acquired.  The defined
lock order wants scrlock be acquired before harvest_mtx and therefore you would
see the first LOR warning.

Could you please try the attached patch and see if it solves the problem?  What
it does is to move entropy mutex slightly higher, allowing it to be held before
acquiring sleepq chain lock.  This would eliminate the (false) LOR warning and
make the first LOR go away at the same time.

Adding jhb@ and markm@ for review.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list