The IB tests run inside GPU recovery, which must not allocate memory with
reclaim. The direct IB pool and the job allocation use GFP_ATOMIC for
this reason.

amdgpu_vce_get_create_msg() and amdgpu_vce_get_destroy_msg() still pass
the VCE scheduler entity for direct submissions, so drm_sched_job_init()
allocates a scheduler fence with GFP_KERNEL that the direct submission
never uses.

The create message is always submitted directly, so don't pass the entity
there. The destroy message also goes through the scheduler when the
handles of a closed file are freed, so only pass the entity for those
scheduled submissions.

Signed-off-by: Prike Liang <[email protected]>
Cc: Leo Liu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index 3952af9ae115..dec3c6d9b6ba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -471,7 +471,7 @@ static int amdgpu_vce_get_create_msg(struct amdgpu_ring 
*ring, uint32_t handle,
        uint64_t addr;
        int i, r;
 
-       r = amdgpu_job_alloc_with_ib(ring->adev, &ring->adev->vce.entity,
+       r = amdgpu_job_alloc_with_ib(ring->adev, NULL,
                                     AMDGPU_FENCE_OWNER_UNDEFINED,
                                     ib_size_dw * 4, AMDGPU_IB_POOL_DIRECT,
                                     AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
@@ -562,7 +562,8 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring 
*ring, uint32_t handle,
        struct dma_fence *f = NULL;
        int i, r;
 
-       r = amdgpu_job_alloc_with_ib(ring->adev, &ring->adev->vce.entity,
+       r = amdgpu_job_alloc_with_ib(ring->adev,
+                                    direct ? NULL : &ring->adev->vce.entity,
                                     AMDGPU_FENCE_OWNER_UNDEFINED,
                                     ib_size_dw * 4,
                                     direct ? AMDGPU_IB_POOL_DIRECT :
-- 
2.34.1

Reply via email to