]> git.baikalelectronics.ru Git - arm-tf.git/commit
T589: Fix insufficient ordering guarantees in bakery lock
authorRaghu Krishnamurthy <raghu.ncstate@icloud.com>
Sun, 26 Jan 2020 03:20:45 +0000 (19:20 -0800)
committerRaghu Krishnamurthy <raghu.ncstate@icloud.com>
Mon, 27 Jan 2020 17:31:31 +0000 (09:31 -0800)
commitc0018913b4e1139ffa575488a58530614ff490d1
treeb1da525f24d27b885c0405053cf69c5a3991c763
parent9054018bd5c12b16ef55ea41fcf8cdb15a24ae18
T589: Fix insufficient ordering guarantees in bakery lock

bakery_lock_get() uses DMB LD after lock acquisition and
bakery_lock_release() uses DMB ST before releasing the lock. This is
insufficient in both cases. With just DMB LD, stores in the critical
section can be reordered before the DMB LD which could mean writes in
the critical section completing before the lock has been acquired
successfully. Similarly, with just DMB ST, a load in the critical section
could be reordered after the the DMB ST. DMB is the least expensive
barrier that can provide the required ordering.

Signed-off-by: Raghu Krishnamurthy <raghu.ncstate@icloud.com>
Change-Id: Ieb74cbf5b76b09e1789331b71f37f7c660221b0e
lib/locks/bakery/bakery_lock_coherent.c
lib/locks/bakery/bakery_lock_normal.c