Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit d088bbd7 authored by Jeremy Gebben's avatar Jeremy Gebben
Browse files

msm: kgsl: fix device->mutex recursions



kgsl_mutex_lock() is a workaround for complicated locking related
to invalidating the iommu TLB during kgsl_mmu_map() and
kgsl_mmu_unmap().  But it worked around this problem by adding
the possibility of lock recursion, which risks many other problems.

The locking here was complicated because global memory regions,
like the ringbuffer were often mapped and unmapped with the
device mutex held, whereas userspace (or other non-global)
memory regions were mapped and unmapped with the device->mutex
NOT held.

However, there is no reason to invalidate the TLB for global
mappings. These mappings are only mapped or unmapped when
creating or destroying pagetables. And when this happens,
the pagetable being (un)mapped is NOT the active pagetable.
Additionally, the global mappings are supposed to be the
same in every pagetable, so there's no point in invalidating
their TLB entries at any point. When a pagetable becomes
active or inactive, the TLB will still be flushed by
the setstate code.

Addtionally, there were some places where userspace
buffers could get unmapped with the device mutex held,
which would deadlock on the device mutex. Fix these
by making sure that kgsl_mem_entry_put() is called
with the mutex open.

Change-Id: I17864bbcf8829d661d0709bd66feb4acaa3f134c
Signed-off-by: default avatarJeremy Gebben <jgebben@codeaurora.org>
parent 57b7c01b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment