gpu: Avoid SharedImageBatchAccessManager deadlock
SharedImageBatchAccessManager has a lock, and SharedImageBackingEglImage has a lock. There are cases where one lock is acquired while trying to acquire the other, and the order is not guaranteed, leading to deadlock in under the right circumstances. In particular: * On one thread, SharedImageBatchAccessManager::EndBatchReadAccess calls SharedImageBackingEglImage::SetEndReadFence. This acquires the batch lock first and the backing lock second. * On another thread, SharedImageBackingEglImage::EndRead calls SharedImageBatchAccessManager::IsDoingBatchReads, which acquires the locks in the opposite order. If the same backing is being read on two threads and both managed to acquire the first lock, then this leads to a deadlock. Fix by not holding the backing lock when calling into SharedImageBatchAccessManager. Bug: 1043566,1046101 Change-Id: I6d6f8031443f41f775eb87287fdcebf28c4fc8e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078746Reviewed-by:Khushal <khushalsagar@chromium.org> Reviewed-by:
Peng Huang <penghuang@chromium.org> Commit-Queue: Khushal <khushalsagar@chromium.org> Commit-Queue: Bo <boliu@chromium.org> Auto-Submit: Bo <boliu@chromium.org> Cr-Commit-Position: refs/heads/master@{#745518}
Showing
Please register or sign in to comment