diff options
author | Christian König <christian.koenig@amd.com> | 2016-03-15 08:40:17 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-03-16 17:58:52 -0400 |
commit | b44135351a3a5cfc60f5b6729445311c2d5e141c (patch) | |
tree | 68a14217f9170f07369383df32bfcefda8dcfae3 /drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | |
parent | ca08e04d5642c429ec891fa17bf379be988dea6b (diff) |
drm/amdgpu: RCU protected amdgpu_fence_release
Fences must be freed RCU protected, otherwise the reservation_object_*_rcu()
functions can run into problems.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index d8bbe85c22a2..ec73ab1c177d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | |||
@@ -638,12 +638,33 @@ static bool amdgpu_fence_enable_signaling(struct fence *f) | |||
638 | return true; | 638 | return true; |
639 | } | 639 | } |
640 | 640 | ||
641 | static void amdgpu_fence_release(struct fence *f) | 641 | /** |
642 | * amdgpu_fence_free - free up the fence memory | ||
643 | * | ||
644 | * @rcu: RCU callback head | ||
645 | * | ||
646 | * Free up the fence memory after the RCU grace period. | ||
647 | */ | ||
648 | static void amdgpu_fence_free(struct rcu_head *rcu) | ||
642 | { | 649 | { |
650 | struct fence *f = container_of(rcu, struct fence, rcu); | ||
643 | struct amdgpu_fence *fence = to_amdgpu_fence(f); | 651 | struct amdgpu_fence *fence = to_amdgpu_fence(f); |
644 | kmem_cache_free(amdgpu_fence_slab, fence); | 652 | kmem_cache_free(amdgpu_fence_slab, fence); |
645 | } | 653 | } |
646 | 654 | ||
655 | /** | ||
656 | * amdgpu_fence_release - callback that fence can be freed | ||
657 | * | ||
658 | * @fence: fence | ||
659 | * | ||
660 | * This function is called when the reference count becomes zero. | ||
661 | * It just RCU schedules freeing up the fence. | ||
662 | */ | ||
663 | static void amdgpu_fence_release(struct fence *f) | ||
664 | { | ||
665 | call_rcu(&f->rcu, amdgpu_fence_free); | ||
666 | } | ||
667 | |||
647 | static const struct fence_ops amdgpu_fence_ops = { | 668 | static const struct fence_ops amdgpu_fence_ops = { |
648 | .get_driver_name = amdgpu_fence_get_driver_name, | 669 | .get_driver_name = amdgpu_fence_get_driver_name, |
649 | .get_timeline_name = amdgpu_fence_get_timeline_name, | 670 | .get_timeline_name = amdgpu_fence_get_timeline_name, |