HomeFreeBSD

Remove waiters check from the inline rw wunlock routine.

Description

Remove waiters check from the inline rw wunlock routine.

This is a direct commit to stable/10.

r310979 is a merge of depessimisation of locking primitives.
The important part was getting rid of an attempt to grab the lock in the
slow path immediately after the fast path failed. In addition to that
temporary checks were added before all atomic ops. They have no impact on
semantic nor correctness, they only avoid an atomic operation which is
likely to fail.

After the addition of atomic_fcmpset and further changes said checks
became pessimal and got removed. This may get merged to stable/10.

Reports started showing up about a crash in all branches having extra
checks. The codepath is:
.. -> vm_map_delete -> __rw_wunlock_hard -> turnstile_broadcast

The kernel crashed trying to wake up nonexistent waiters. The lock value
as found in the vmcore matches the panicking thread, so in particular
there was no waiters bit set. The bit can only be cleared by the current
owner.

A debug patch was provided, which reportedly had a side effect of getting
rid of the issue.

Also one of the reporters said that reverting the patch which adds the
extra checks makes the crash go away.

It was also reported that head with the fcmpset changes (explicit checks
removed) also stops crashing.

Finally, one user tested crashing stable/10 variant with just the rw
wunlock check removed.

The common case in all but one reports was an Intel Atom cpu. Claiming
a cpu bug at this point is bold and I'm going to refrain from it, but
right now apart from cpu-specific optimisation made by the compiler on
custom kernel compiles I don't see how this can be a software bug.

This will have to be investigated more.

Meanwhile, restore rw wunlock to pre-r310979 state.

PR: 213903

Details

Provenance
mjgAuthored on
Parents
rS320884: DIRDEPS_BUILD: Connect more libraries.
Branches
Unknown
Tags
Unknown