diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-10-04 00:01:00 +0300 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-10-04 15:43:43 +0300 |
commit | 3dda22d3dcd1fc39e7867b2c5f5fc8fa79fdefcc (patch) | |
tree | f7074121eac9203209c3de91008807438b44719f /drivers/gpu/drm/lima/lima_device.c | |
parent | 4ee92c7149da9cb1991684628a9e47166a5e26f6 (diff) | |
download | linux-3dda22d3dcd1fc39e7867b2c5f5fc8fa79fdefcc.tar.xz |
drm/mm: Use clear_bit_unlock() for releasing the drm_mm_node()
A few callers need to serialise the destruction of their drm_mm_node and
ensure it is removed from the drm_mm before freeing. However, to be
completely sure that any access from another thread is complete before
we free the struct, we require the RELEASE semantics of
clear_bit_unlock().
This allows the conditional locking such as
Thread A Thread B
mutex_lock(mm_lock); if (drm_mm_node_allocated(node)) {
drm_mm_node_remove(node); mutex_lock(mm_lock);
mutex_unlock(mm_lock); if (drm_mm_node_allocated(node))
drm_mm_node_remove(node);
mutex_unlock(mm_lock);
}
kfree(node);
to serialise correctly without any lingering accesses from A to the
freed node. Allocation / insertion of the node is assumed never to race
with removal or eviction scanning.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191003210100.22250-5-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/lima/lima_device.c')
0 files changed, 0 insertions, 0 deletions