mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-19 02:04:19 +08:00
drm/amdgpu: RCU protected amd_sched_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>
This commit is contained in:
parent
b44135351a
commit
189e0fb763
@ -84,12 +84,33 @@ static bool amd_sched_fence_enable_signaling(struct fence *f)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void amd_sched_fence_release(struct fence *f)
|
||||
/**
|
||||
* amd_sched_fence_free - free up the fence memory
|
||||
*
|
||||
* @rcu: RCU callback head
|
||||
*
|
||||
* Free up the fence memory after the RCU grace period.
|
||||
*/
|
||||
static void amd_sched_fence_free(struct rcu_head *rcu)
|
||||
{
|
||||
struct fence *f = container_of(rcu, struct fence, rcu);
|
||||
struct amd_sched_fence *fence = to_amd_sched_fence(f);
|
||||
kmem_cache_free(sched_fence_slab, fence);
|
||||
}
|
||||
|
||||
/**
|
||||
* amd_sched_fence_release - callback that fence can be freed
|
||||
*
|
||||
* @fence: fence
|
||||
*
|
||||
* This function is called when the reference count becomes zero.
|
||||
* It just RCU schedules freeing up the fence.
|
||||
*/
|
||||
static void amd_sched_fence_release(struct fence *f)
|
||||
{
|
||||
call_rcu(&f->rcu, amd_sched_fence_free);
|
||||
}
|
||||
|
||||
const struct fence_ops amd_sched_fence_ops = {
|
||||
.get_driver_name = amd_sched_fence_get_driver_name,
|
||||
.get_timeline_name = amd_sched_fence_get_timeline_name,
|
||||
|
Loading…
Reference in New Issue
Block a user