]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
rmlock: Add a required compiler membar to the rlock slow path
authorMark Johnston <markj@FreeBSD.org>
Wed, 24 Feb 2021 02:15:50 +0000 (21:15 -0500)
committerMark Johnston <markj@FreeBSD.org>
Wed, 3 Mar 2021 01:16:54 +0000 (20:16 -0500)
commit20f9e2a723f5f560d6219e28f36dd3b8f8561b3a
tree10dc55b76f843bb58c4ef5f1d30562f6c02c0bdd
parent945184b92f654e50692a42e58b477f9c473b948d
rmlock: Add a required compiler membar to the rlock slow path

The tracker flags need to be loaded only after the tracker is removed
from its per-CPU queue.  Otherwise, readers may fail to synchronize with
pending writers attempting to propagate priority to active readers, and
readers and writers deadlock on each other.  This was observed in a
stable/12-based armv7 kernel where the compiler had reordered the load
of rmp_flags to before the stores updating the queue.

Approved by: re (gjb)
Reviewed by: rlibby, scottl
Discussed with: kib
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D28821

(cherry picked from commit 1d44514fcd68809cfd493a7352ace29ddad443d6)
(cherry picked from commit c29d3ecdc8b3903d812c0467319ced6f85872d0e)
sys/kern/kern_rmlock.c