diff options
author | Oak Zeng <Oak.Zeng@amd.com> | 2019-06-14 19:27:58 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-06-17 11:01:41 -0500 |
commit | 38bb4226ffe51b033ecc6724c00ce0dd210db248 (patch) | |
tree | 38610c16fb416a296435ae6e2bffb1638ed2e240 /drivers/gpu/drm/amd/amdkfd | |
parent | 6a6ef5ee257eb178a5ada3b4327a9a208d3a4683 (diff) |
drm/amdkfd: Fix sdma queue allocate race condition
SDMA queue allocation requires the dqm lock as it modify
the global dqm members. Enclose it in the dqm_lock.
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Philip Yang <philip.yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd')
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index b75ec379425c..3528590ae90b 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1144,7 +1144,9 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, if (q->properties.type == KFD_QUEUE_TYPE_SDMA || q->properties.type == KFD_QUEUE_TYPE_SDMA_XGMI) { + dqm_lock(dqm); retval = allocate_sdma_queue(dqm, q); + dqm_unlock(dqm); if (retval) goto out; } @@ -1203,8 +1205,11 @@ out_deallocate_doorbell: deallocate_doorbell(qpd, q); out_deallocate_sdma_queue: if (q->properties.type == KFD_QUEUE_TYPE_SDMA || - q->properties.type == KFD_QUEUE_TYPE_SDMA_XGMI) + q->properties.type == KFD_QUEUE_TYPE_SDMA_XGMI) { + dqm_lock(dqm); deallocate_sdma_queue(dqm, q); + dqm_unlock(dqm); + } out: return retval; } |