mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
drm/radeon/kms: fix lock ordering in ring, ib handling
Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
01434b4bfb
commit
ca2af92311
1 changed files with 27 additions and 22 deletions
|
@ -219,24 +219,26 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
|
||||||
void radeon_ib_pool_fini(struct radeon_device *rdev)
|
void radeon_ib_pool_fini(struct radeon_device *rdev)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
struct radeon_bo *robj;
|
||||||
|
|
||||||
if (!rdev->ib_pool.ready) {
|
if (!rdev->ib_pool.ready) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mutex_lock(&rdev->ib_pool.mutex);
|
mutex_lock(&rdev->ib_pool.mutex);
|
||||||
radeon_ib_bogus_cleanup(rdev);
|
radeon_ib_bogus_cleanup(rdev);
|
||||||
|
robj = rdev->ib_pool.robj;
|
||||||
if (rdev->ib_pool.robj) {
|
|
||||||
r = radeon_bo_reserve(rdev->ib_pool.robj, false);
|
|
||||||
if (likely(r == 0)) {
|
|
||||||
radeon_bo_kunmap(rdev->ib_pool.robj);
|
|
||||||
radeon_bo_unpin(rdev->ib_pool.robj);
|
|
||||||
radeon_bo_unreserve(rdev->ib_pool.robj);
|
|
||||||
}
|
|
||||||
radeon_bo_unref(&rdev->ib_pool.robj);
|
|
||||||
rdev->ib_pool.robj = NULL;
|
rdev->ib_pool.robj = NULL;
|
||||||
}
|
|
||||||
mutex_unlock(&rdev->ib_pool.mutex);
|
mutex_unlock(&rdev->ib_pool.mutex);
|
||||||
|
|
||||||
|
if (robj) {
|
||||||
|
r = radeon_bo_reserve(robj, false);
|
||||||
|
if (likely(r == 0)) {
|
||||||
|
radeon_bo_kunmap(robj);
|
||||||
|
radeon_bo_unpin(robj);
|
||||||
|
radeon_bo_unreserve(robj);
|
||||||
|
}
|
||||||
|
radeon_bo_unref(&robj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -359,20 +361,23 @@ int radeon_ring_init(struct radeon_device *rdev, unsigned ring_size)
|
||||||
void radeon_ring_fini(struct radeon_device *rdev)
|
void radeon_ring_fini(struct radeon_device *rdev)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
struct radeon_bo *ring_obj;
|
||||||
|
|
||||||
mutex_lock(&rdev->cp.mutex);
|
mutex_lock(&rdev->cp.mutex);
|
||||||
if (rdev->cp.ring_obj) {
|
ring_obj = rdev->cp.ring_obj;
|
||||||
r = radeon_bo_reserve(rdev->cp.ring_obj, false);
|
|
||||||
if (likely(r == 0)) {
|
|
||||||
radeon_bo_kunmap(rdev->cp.ring_obj);
|
|
||||||
radeon_bo_unpin(rdev->cp.ring_obj);
|
|
||||||
radeon_bo_unreserve(rdev->cp.ring_obj);
|
|
||||||
}
|
|
||||||
radeon_bo_unref(&rdev->cp.ring_obj);
|
|
||||||
rdev->cp.ring = NULL;
|
rdev->cp.ring = NULL;
|
||||||
rdev->cp.ring_obj = NULL;
|
rdev->cp.ring_obj = NULL;
|
||||||
}
|
|
||||||
mutex_unlock(&rdev->cp.mutex);
|
mutex_unlock(&rdev->cp.mutex);
|
||||||
|
|
||||||
|
if (ring_obj) {
|
||||||
|
r = radeon_bo_reserve(ring_obj, false);
|
||||||
|
if (likely(r == 0)) {
|
||||||
|
radeon_bo_kunmap(ring_obj);
|
||||||
|
radeon_bo_unpin(ring_obj);
|
||||||
|
radeon_bo_unreserve(ring_obj);
|
||||||
|
}
|
||||||
|
radeon_bo_unref(&ring_obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue