Skip to content

Commit 38476bd

Browse files
amd-sukhatrialexdeucher
authored andcommitted
drm/amdgpu/userq: call dma_resv_wait_timeout without test for signalled
In function amdgpu_userq_gem_va_unmap_validate call dma_resv_wait_timeout directly. Also since we are waiting forever we should not be having any return value and hence no handling needed. Suggested-by: Christian König <christian.koenig@amd.com> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 4c86e12 commit 38476bd

3 files changed

Lines changed: 11 additions & 23 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,17 +1462,16 @@ int amdgpu_userq_start_sched_for_enforce_isolation(struct amdgpu_device *adev,
14621462
return ret;
14631463
}
14641464

1465-
int amdgpu_userq_gem_va_unmap_validate(struct amdgpu_device *adev,
1466-
struct amdgpu_bo_va_mapping *mapping,
1467-
uint64_t saddr)
1465+
void amdgpu_userq_gem_va_unmap_validate(struct amdgpu_device *adev,
1466+
struct amdgpu_bo_va_mapping *mapping,
1467+
uint64_t saddr)
14681468
{
14691469
u32 ip_mask = amdgpu_userq_get_supported_ip_mask(adev);
14701470
struct amdgpu_bo_va *bo_va = mapping->bo_va;
14711471
struct dma_resv *resv = bo_va->base.bo->tbo.base.resv;
1472-
int ret = 0;
14731472

14741473
if (!ip_mask)
1475-
return 0;
1474+
return;
14761475

14771476
dev_warn_once(adev->dev, "now unmapping a vital queue va:%llx\n", saddr);
14781477
/**
@@ -1483,14 +1482,8 @@ int amdgpu_userq_gem_va_unmap_validate(struct amdgpu_device *adev,
14831482
* unmap is only for one kind of userq VAs, so at this point suppose
14841483
* the eviction fence is always unsignaled.
14851484
*/
1486-
if (!dma_resv_test_signaled(resv, DMA_RESV_USAGE_BOOKKEEP)) {
1487-
ret = dma_resv_wait_timeout(resv, DMA_RESV_USAGE_BOOKKEEP, true,
1488-
MAX_SCHEDULE_TIMEOUT);
1489-
if (ret <= 0)
1490-
return -EBUSY;
1491-
}
1492-
1493-
return 0;
1485+
dma_resv_wait_timeout(resv, DMA_RESV_USAGE_BOOKKEEP,
1486+
false, MAX_SCHEDULE_TIMEOUT);
14941487
}
14951488

14961489
void amdgpu_userq_pre_reset(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void amdgpu_userq_start_hang_detect_work(struct amdgpu_usermode_queue *queue);
160160
int amdgpu_userq_input_va_validate(struct amdgpu_device *adev,
161161
struct amdgpu_usermode_queue *queue,
162162
u64 addr, u64 expected_size);
163-
int amdgpu_userq_gem_va_unmap_validate(struct amdgpu_device *adev,
164-
struct amdgpu_bo_va_mapping *mapping,
165-
uint64_t saddr);
163+
void amdgpu_userq_gem_va_unmap_validate(struct amdgpu_device *adev,
164+
struct amdgpu_bo_va_mapping *mapping,
165+
uint64_t saddr);
166166
#endif

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,6 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
19781978
struct amdgpu_bo_va_mapping *mapping;
19791979
struct amdgpu_vm *vm = bo_va->base.vm;
19801980
bool valid = true;
1981-
int r;
19821981

19831982
saddr /= AMDGPU_GPU_PAGE_SIZE;
19841983

@@ -2003,12 +2002,8 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
20032002
* during user requests GEM unmap IOCTL except for forcing the unmap
20042003
* from user space.
20052004
*/
2006-
if (unlikely(atomic_read(&bo_va->userq_va_mapped) > 0)) {
2007-
r = amdgpu_userq_gem_va_unmap_validate(adev, mapping, saddr);
2008-
if (unlikely(r == -EBUSY))
2009-
dev_warn_once(adev->dev,
2010-
"Attempt to unmap an active userq buffer\n");
2011-
}
2005+
if (unlikely(atomic_read(&bo_va->userq_va_mapped) > 0))
2006+
amdgpu_userq_gem_va_unmap_validate(adev, mapping, saddr);
20122007

20132008
list_del(&mapping->list);
20142009
amdgpu_vm_it_remove(mapping, &vm->va);

0 commit comments

Comments
 (0)