drm/amdgpu: give each kernel job a unique id
Subsystems (3)
PATCH 1/1 drm/amdgpu: give each kernel job a unique id
Userspace jobs have drm_file.client_id as a unique identifier as job's owners. For kernel jobs, we can allocate arbitrary values - the risk of overlap with userspace ids is small (given that it's a u64 value).
In the unlikely case the overlap happens, it'll only impact trace events.
Since this ID is traced in the gpu_scheduler trace events, this allows to determine the source of each job sent to the hardware.
To make grepping easier, the IDs are defined as they will appear in the trace output.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 19 +++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 28 +++++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 5 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 4 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 12 +++++---- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 6 +++-- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 6 +++-- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 ++- 19 files changed, 84 insertions(+), 41 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2 -1
@@ -1461,7 +1461,8 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring) owner = (void *)(unsigned long )atomic_inc_return (&counter); r =amdgpu_job_alloc_with_ib (ring->adev, &entity, owner, -64 ,0 , &job); +64 ,0 , &job, +AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER );if (r) goto err;
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1 -1
@@ -674,7 +674,7 @@ void amdgpu_gmc_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, r =amdgpu_job_alloc_with_ib (ring->adev, &adev->mman.high_pr,AMDGPU_FENCE_OWNER_UNDEFINED ,16 *4 ,AMDGPU_IB_POOL_IMMEDIATE , - &job); + &job,AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB );if (r) goto error_alloc;
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +3 -2
@@ -230,11 +230,12 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,int amdgpu_job_alloc_with_ib (struct amdgpu_device *adev,struct drm_sched_entity *entity,void *owner,size_t size,enum amdgpu_ib_pool_type pool_type, -struct amdgpu_job **job) +struct amdgpu_job **job,u64 k_job_id) {int r; - r =amdgpu_job_alloc (adev,NULL , entity, owner,1 , job,0 ); + r =amdgpu_job_alloc (adev,NULL , entity, owner,1 , job, + k_job_id);if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +18 -1
@@ -44,6 +44,22 @@struct amdgpu_fence ;enum amdgpu_ib_pool_type ; +/* Internal kernel job ids. (decreasing values, starting from U64_MAX). */ +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE (18446744073709551615ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_PDES (18446744073709551614ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_RANGE (18446744073709551613ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_PT_CLEAR (18446744073709551612ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER (18446744073709551611ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA (18446744073709551610ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_COPY_BUFFER (18446744073709551609ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEAR_ON_RELEASE (18446744073709551608ULL) +#define AMDGPU_KERNEL_JOB_ID_MOVE_BLIT (18446744073709551607ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_CLEAR_BUFFER (18446744073709551606ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER (18446744073709551605ULL) +#define AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB (18446744073709551604ULL) +#define AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP (18446744073709551603ULL) +#define AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST (18446744073709551602ULL) +struct amdgpu_job {struct drm_sched_job base;struct amdgpu_vm *vm;
@@ -95,7 +111,8 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,int amdgpu_job_alloc_with_ib (struct amdgpu_device *adev,struct drm_sched_entity *entity,void *owner,size_t size,enum amdgpu_ib_pool_type pool_type, -struct amdgpu_job **job); +struct amdgpu_job **job, +u64 k_job_id);void amdgpu_job_set_resources (struct amdgpu_job *job,struct amdgpu_bo *gds,struct amdgpu_bo *gws,struct amdgpu_bo *oa);void amdgpu_job_free_resources (struct amdgpu_job *job);
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +2 -1
@@ -194,7 +194,8 @@ static int amdgpu_jpeg_dec_set_reg(struct amdgpu_ring *ring, uint32_t handle,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -1
@@ -1315,7 +1315,8 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo)if (r) goto out; - r =amdgpu_fill_buffer (abo,0 , &bo->base._resv, &fence, true); + r =amdgpu_fill_buffer (abo,0 , &bo->base._resv, &fence, true, +AMDGPU_KERNEL_JOB_ID_CLEAR_ON_RELEASE );if (WARN_ON (r)) goto out;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +17 -11
@@ -226,7 +226,8 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, r =amdgpu_job_alloc_with_ib (adev, &adev->mman.high_pr,AMDGPU_FENCE_OWNER_UNDEFINED , num_dw *4 + num_bytes, -AMDGPU_IB_POOL_DELAYED , &job); +AMDGPU_IB_POOL_DELAYED , &job, +AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER );if (r)return r;
@@ -405,7 +406,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,struct dma_fence *wipe_fence =NULL ; r =amdgpu_fill_buffer (abo,0 ,NULL , &wipe_fence, - false); + false,AMDGPU_KERNEL_JOB_ID_MOVE_BLIT );if (r) { goto error; }else if (wipe_fence) {
@@ -1509,7 +1510,8 @@ static int amdgpu_ttm_access_memory_sdma(struct ttm_buffer_object *bo, r =amdgpu_job_alloc_with_ib (adev, &adev->mman.high_pr,AMDGPU_FENCE_OWNER_UNDEFINED , num_dw *4 ,AMDGPU_IB_POOL_DELAYED , - &job); + &job, +AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA );if (r) goto out;
@@ -2159,7 +2161,7 @@ static int amdgpu_ttm_prepare_job(struct amdgpu_device *adev,struct dma_resv *resv, bool vm_needs_flush, struct amdgpu_job **job, - bool delayed) + bool delayed, u64 k_job_id) { enum amdgpu_ib_pool_type pool = direct_submit ? AMDGPU_IB_POOL_DIRECT :
@@ -2169,7 +2171,7 @@ static int amdgpu_ttm_prepare_job(struct amdgpu_device *adev, &adev->mman.high_pr; r =amdgpu_job_alloc_with_ib (adev, entity,AMDGPU_FENCE_OWNER_UNDEFINED , - num_dw *4 , pool, job); + num_dw *4 , pool, job, k_job_id);if (r)return r;
@@ -2208,7 +2210,8 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, num_loops =DIV_ROUND_UP (byte_count, max_bytes); num_dw =ALIGN (num_loops * adev->mman.buffer_funcs->copy_num_dw,8 ); r =amdgpu_ttm_prepare_job (adev, direct_submit, num_dw, - resv, vm_needs_flush, &job, false); + resv, vm_needs_flush, &job, false, +AMDGPU_KERNEL_JOB_ID_TTM_COPY_BUFFER );if (r)return r;
@@ -2243,7 +2246,8 @@ static int amdgpu_ttm_fill_mem(struct amdgpu_ring *ring, uint32_t src_data, uint64_t dst_addr, uint32_t byte_count, struct dma_resv *resv, struct dma_fence **fence, - bool vm_needs_flush, bool delayed) + bool vm_needs_flush, bool delayed, + u64 k_job_id) { struct amdgpu_device *adev = ring->adev;unsigned int num_loops, num_dw;
@@ -2256,7 +2260,7 @@ static int amdgpu_ttm_fill_mem(struct amdgpu_ring *ring, uint32_t src_data, num_loops =DIV_ROUND_UP_ULL (byte_count, max_bytes); num_dw =ALIGN (num_loops * adev->mman.buffer_funcs->fill_num_dw,8 ); r =amdgpu_ttm_prepare_job (adev, false, num_dw, resv, vm_needs_flush, - &job, delayed); + &job, delayed, k_job_id);if (r)return r;
@@ -2326,7 +2330,8 @@ int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo, goto err; r =amdgpu_ttm_fill_mem (ring,0 , addr, size, resv, - &next, true, true); + &next, true, true, +AMDGPU_KERNEL_JOB_ID_TTM_CLEAR_BUFFER );if (r) goto err;
@@ -2345,7 +2350,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,uint32_t src_data, struct dma_resv *resv, struct dma_fence **f, - bool delayed) + bool delayed, + u64 k_job_id) { struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
@@ -2374,7 +2380,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, goto error; r =amdgpu_ttm_fill_mem (ring, src_data, to, cur_size, resv, - &next, true, delayed); + &next, true, delayed, k_job_id);if (r) goto error;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +2 -1
@@ -180,7 +180,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,uint32_t src_data, struct dma_resv *resv, struct dma_fence **fence, - bool delayed); + bool delayed, + u64 k_job_id);int amdgpu_ttm_alloc_gart (struct ttm_buffer_object *bo);void amdgpu_ttm_recover_gart (struct ttm_buffer_object *tbo);
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -1
@@ -1136,7 +1136,8 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo, r =amdgpu_job_alloc_with_ib (ring->adev, &adev->uvd.entity,AMDGPU_FENCE_OWNER_UNDEFINED ,64 , direct ?AMDGPU_IB_POOL_DIRECT : -AMDGPU_IB_POOL_DELAYED , &job); +AMDGPU_IB_POOL_DELAYED , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +3 -2
@@ -449,7 +449,7 @@ static int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, r =amdgpu_job_alloc_with_ib (ring->adev, &ring->adev->vce.entity,AMDGPU_FENCE_OWNER_UNDEFINED , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;
@@ -540,7 +540,8 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,AMDGPU_FENCE_OWNER_UNDEFINED , ib_size_dw *4 , direct ?AMDGPU_IB_POOL_DIRECT : - AMDGPU_IB_POOL_DELAYED, &job); +AMDGPU_IB_POOL_DELAYED , &job, + AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4 -4
@@ -600,7 +600,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL ,64 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r) goto err;
@@ -780,7 +780,7 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring, r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r) goto err;
@@ -910,7 +910,7 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;
@@ -977,7 +977,7 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -2
@@ -965,7 +965,8 @@ int amdgpu_vm_update_pdes(struct amdgpu_device *adev, params.vm = vm; params.immediate = immediate; - r = vm->update_funcs->prepare (¶ms,NULL ); + r = vm->update_funcs->prepare (¶ms,NULL , +AMDGPU_KERNEL_JOB_ID_VM_UPDATE_PDES );if (r) goto error;
@@ -1134,7 +1135,8 @@ int amdgpu_vm_update_range(struct amdgpu_device *adev, struct amdgpu_vm *vm,dma_fence_put (tmp); } - r = vm->update_funcs->prepare (¶ms, sync); + r = vm->update_funcs->prepare (¶ms, sync, +AMDGPU_KERNEL_JOB_ID_VM_UPDATE_RANGE );if (r) goto error_free;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1 -1
@@ -309,7 +309,7 @@ struct amdgpu_vm_update_params {struct amdgpu_vm_update_funcs {int (*map_table)(struct amdgpu_bo_vm *bo);int (*prepare)(struct amdgpu_vm_update_params *p, -struct amdgpu_sync *sync); +struct amdgpu_sync *sync,u64 k_job_id);int (*update)(struct amdgpu_vm_update_params *p,struct amdgpu_bo_vm *bo,uint64_t pe,uint64_t addr,unsigned count,uint32_t incr,uint64_t flags);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c +3 -1
@@ -40,12 +40,14 @@ static int amdgpu_vm_cpu_map_table(struct amdgpu_bo_vm *table)* * @p: see amdgpu_vm_update_params definition * @sync: sync obj with fences to wait on +* @k_job_id: the id for tracing/debug purposes * * Returns: * Negativ errno, 0 for success. */ static int amdgpu_vm_cpu_prepare (struct amdgpu_vm_update_params *p, -struct amdgpu_sync *sync) +struct amdgpu_sync *sync, +u64 k_job_id) {if (!sync)return 0 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +3 -1
@@ -26,6 +26,7 @@#include "amdgpu.h" #include "amdgpu_trace.h" #include "amdgpu_vm.h" +#include "amdgpu_job.h" /* * amdgpu_vm_pt_cursor - state for for_each_amdgpu_vm_pt
@@ -395,7 +396,8 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm, params.vm = vm; params.immediate = immediate; - r = vm->update_funcs->prepare (¶ms,NULL ); + r = vm->update_funcs->prepare (¶ms,NULL , +AMDGPU_KERNEL_JOB_ID_VM_PT_CLEAR );if (r) goto exit;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +7 -5
@@ -40,7 +40,7 @@ static int amdgpu_vm_sdma_map_table(struct amdgpu_bo_vm *table)/* Allocate a new job for @count PTE updates */ static int amdgpu_vm_sdma_alloc_job (struct amdgpu_vm_update_params *p, -unsigned int count) +unsigned int count,u64 k_job_id) {enum amdgpu_ib_pool_type pool = p->immediate ?AMDGPU_IB_POOL_IMMEDIATE :AMDGPU_IB_POOL_DELAYED ;
@@ -56,7 +56,7 @@ static int amdgpu_vm_sdma_alloc_job(struct amdgpu_vm_update_params *p, ndw =min (ndw,AMDGPU_VM_SDMA_MAX_NUM_DW ); r =amdgpu_job_alloc_with_ib (p->adev, entity,AMDGPU_FENCE_OWNER_VM , - ndw *4 , pool, &p->job); + ndw *4 , pool, &p->job, k_job_id);if (r)return r;
@@ -69,16 +69,17 @@ static int amdgpu_vm_sdma_alloc_job(struct amdgpu_vm_update_params *p,* * @p: see amdgpu_vm_update_params definition * @sync: amdgpu_sync object with fences to wait for +* @k_job_id: identifier of the job, for tracing purpose * * Returns: * Negativ errno, 0 for success. */ static int amdgpu_vm_sdma_prepare (struct amdgpu_vm_update_params *p, -struct amdgpu_sync *sync) +struct amdgpu_sync *sync,u64 k_job_id) {int r; - r =amdgpu_vm_sdma_alloc_job (p,0 ); + r =amdgpu_vm_sdma_alloc_job (p,0 , k_job_id);if (r)return r;
@@ -249,7 +250,8 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p,if (r)return r; - r =amdgpu_vm_sdma_alloc_job (p, count); + r =amdgpu_vm_sdma_alloc_job (p, count, +AMDGPU_KERNEL_JOB_ID_VM_UPDATE );if (r)return r; }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4 -2
@@ -217,7 +217,8 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handleint i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;
@@ -281,7 +282,8 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +4 -2
@@ -225,7 +225,8 @@ static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, u32 handle,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;
@@ -288,7 +289,8 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, u32 handle,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +2 -1
@@ -68,7 +68,8 @@ svm_migrate_gart_map(struct amdgpu_ring *ring, uint64_t npages,AMDGPU_FENCE_OWNER_UNDEFINED , num_dw *4 + num_bytes,AMDGPU_IB_POOL_DELAYED , - &job); + &job, + AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP);if (r)return r;
Signature · 1 line
2.43.0
Christian König
maintainerQuoted 95 lines · Pierre-Eric Pelloux-Prayer
Userspace jobs have drm_file.client_id as a unique identifier as job's owners. For kernel jobs, we can allocate arbitrary values - the risk of overlap with userspace ids is small (given that it's a u64 value).
In the unlikely case the overlap happens, it'll only impact trace events.Since this ID is traced in the
gpu_schedulertrace events, this allows to determine the source of each job sent to the hardware.To make grepping easier, the IDs are defined as they will appear in the trace output.
Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 19 +++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 28 +++++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 5 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 4 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 12 +++++---- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 6 +++-- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 6 +++-- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 ++- 19 files changed, 84 insertions(+), 41 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2
-1@@ -1461,7 +1461,8 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring) owner = (void *)(unsigned long )atomic_inc_return (&counter); r =amdgpu_job_alloc_with_ib (ring->adev, &entity, owner, -64 ,0 , &job); +64 ,0 , &job, +AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER );if (r) goto err;drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -674,7 +674,7 @@ void amdgpu_gmc_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, r =amdgpu_job_alloc_with_ib (ring->adev, &adev->mman.high_pr,AMDGPU_FENCE_OWNER_UNDEFINED ,16 *4 ,AMDGPU_IB_POOL_IMMEDIATE , - &job); + &job,AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB );if (r) goto error_alloc;drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +3
-2@@ -230,11 +230,12 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,int amdgpu_job_alloc_with_ib (struct amdgpu_device *adev,struct drm_sched_entity *entity,void *owner,size_t size,enum amdgpu_ib_pool_type pool_type, -struct amdgpu_job **job) +struct amdgpu_job **job,u64 k_job_id) {int r; - r =amdgpu_job_alloc (adev,NULL , entity, owner,1 , job,0 ); + r =amdgpu_job_alloc (adev,NULL , entity, owner,1 , job, + k_job_id);if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +5
-0@@ -44,6 +44,22 @@struct amdgpu_fence ;enum amdgpu_ib_pool_type ; +/* Internal kernel job ids. (decreasing values, starting from U64_MAX). */ +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE (18446744073709551615ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_PDES (18446744073709551614ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_RANGE (18446744073709551613ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_PT_CLEAR (18446744073709551612ULL)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h line 61
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +10
-0+#define AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER (18446744073709551611ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA (18446744073709551610ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_COPY_BUFFER (18446744073709551609ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEAR_ON_RELEASE (18446744073709551608ULL) +#define AMDGPU_KERNEL_JOB_ID_MOVE_BLIT (18446744073709551607ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_CLEAR_BUFFER (18446744073709551606ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER (18446744073709551605ULL) +#define AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB (18446744073709551604ULL) +#define AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP (18446744073709551603ULL) +#define AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST (18446744073709551602ULL)
Mhm, reiterating our internal discussion on the mailing list.
I think it would be nicer if we could use negative values for the kernel submissions and positive for userspace. But as discussed internally we would need to adjust the scheduler trace points for that once more.
@Philip and @Danilo any opinion on that?
Regards,
Christian.
Quoted 435 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +3
-1+struct amdgpu_job {struct drm_sched_job base;struct amdgpu_vm *vm;@@ -95,7 +111,8 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,int amdgpu_job_alloc_with_ib (struct amdgpu_device *adev,struct drm_sched_entity *entity,void *owner,size_t size,enum amdgpu_ib_pool_type pool_type, -struct amdgpu_job **job); +struct amdgpu_job **job, +u64 k_job_id);void amdgpu_job_set_resources (struct amdgpu_job *job,struct amdgpu_bo *gds,struct amdgpu_bo *gws,struct amdgpu_bo *oa);void amdgpu_job_free_resources (struct amdgpu_job *job);drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +2
-1@@ -194,7 +194,8 @@ static int amdgpu_jpeg_dec_set_reg(struct amdgpu_ring *ring, uint32_t handle,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-1@@ -1315,7 +1315,8 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo)if (r) goto out; - r =amdgpu_fill_buffer (abo,0 , &bo->base._resv, &fence, true); + r =amdgpu_fill_buffer (abo,0 , &bo->base._resv, &fence, true, +AMDGPU_KERNEL_JOB_ID_CLEAR_ON_RELEASE );if (WARN_ON (r)) goto out;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +17
-11@@ -226,7 +226,8 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, r =amdgpu_job_alloc_with_ib (adev, &adev->mman.high_pr,AMDGPU_FENCE_OWNER_UNDEFINED , num_dw *4 + num_bytes, -AMDGPU_IB_POOL_DELAYED , &job); +AMDGPU_IB_POOL_DELAYED , &job, +AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER );if (r)return r;@@ -405,7 +406,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,struct dma_fence *wipe_fence =NULL ; r =amdgpu_fill_buffer (abo,0 ,NULL , &wipe_fence, - false); + false,AMDGPU_KERNEL_JOB_ID_MOVE_BLIT );if (r) { goto error; }else if (wipe_fence) {@@ -1509,7 +1510,8 @@ static int amdgpu_ttm_access_memory_sdma(struct ttm_buffer_object *bo, r =amdgpu_job_alloc_with_ib (adev, &adev->mman.high_pr,AMDGPU_FENCE_OWNER_UNDEFINED , num_dw *4 ,AMDGPU_IB_POOL_DELAYED , - &job); + &job, +AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA );if (r) goto out;@@ -2159,7 +2161,7 @@ static int amdgpu_ttm_prepare_job(struct amdgpu_device *adev,struct dma_resv *resv, bool vm_needs_flush, struct amdgpu_job **job, - bool delayed) + bool delayed, u64 k_job_id) { enum amdgpu_ib_pool_type pool = direct_submit ? AMDGPU_IB_POOL_DIRECT :@@ -2169,7 +2171,7 @@ static int amdgpu_ttm_prepare_job(struct amdgpu_device *adev, &adev->mman.high_pr; r =amdgpu_job_alloc_with_ib (adev, entity,AMDGPU_FENCE_OWNER_UNDEFINED , - num_dw *4 , pool, job); + num_dw *4 , pool, job, k_job_id);if (r)return r;@@ -2208,7 +2210,8 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, num_loops =DIV_ROUND_UP (byte_count, max_bytes); num_dw =ALIGN (num_loops * adev->mman.buffer_funcs->copy_num_dw,8 ); r =amdgpu_ttm_prepare_job (adev, direct_submit, num_dw, - resv, vm_needs_flush, &job, false); + resv, vm_needs_flush, &job, false, +AMDGPU_KERNEL_JOB_ID_TTM_COPY_BUFFER );if (r)return r;@@ -2243,7 +2246,8 @@ static int amdgpu_ttm_fill_mem(struct amdgpu_ring *ring, uint32_t src_data, uint64_t dst_addr, uint32_t byte_count, struct dma_resv *resv, struct dma_fence **fence, - bool vm_needs_flush, bool delayed) + bool vm_needs_flush, bool delayed, + u64 k_job_id) { struct amdgpu_device *adev = ring->adev;unsigned int num_loops, num_dw;@@ -2256,7 +2260,7 @@ static int amdgpu_ttm_fill_mem(struct amdgpu_ring *ring, uint32_t src_data, num_loops =DIV_ROUND_UP_ULL (byte_count, max_bytes); num_dw =ALIGN (num_loops * adev->mman.buffer_funcs->fill_num_dw,8 ); r =amdgpu_ttm_prepare_job (adev, false, num_dw, resv, vm_needs_flush, - &job, delayed); + &job, delayed, k_job_id);if (r)return r;@@ -2326,7 +2330,8 @@ int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo, goto err; r =amdgpu_ttm_fill_mem (ring,0 , addr, size, resv, - &next, true, true); + &next, true, true, +AMDGPU_KERNEL_JOB_ID_TTM_CLEAR_BUFFER );if (r) goto err;@@ -2345,7 +2350,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,uint32_t src_data, struct dma_resv *resv, struct dma_fence **f, - bool delayed) + bool delayed, + u64 k_job_id) { struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;@@ -2374,7 +2380,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, goto error; r =amdgpu_ttm_fill_mem (ring, src_data, to, cur_size, resv, - &next, true, delayed); + &next, true, delayed, k_job_id);if (r) goto error;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +2
-1@@ -180,7 +180,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,uint32_t src_data, struct dma_resv *resv, struct dma_fence **fence, - bool delayed); + bool delayed, + u64 k_job_id);int amdgpu_ttm_alloc_gart (struct ttm_buffer_object *bo);void amdgpu_ttm_recover_gart (struct ttm_buffer_object *tbo);drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2
-1@@ -1136,7 +1136,8 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo, r =amdgpu_job_alloc_with_ib (ring->adev, &adev->uvd.entity,AMDGPU_FENCE_OWNER_UNDEFINED ,64 , direct ?AMDGPU_IB_POOL_DIRECT : -AMDGPU_IB_POOL_DELAYED , &job); +AMDGPU_IB_POOL_DELAYED , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +3
-2@@ -449,7 +449,7 @@ static int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, r =amdgpu_job_alloc_with_ib (ring->adev, &ring->adev->vce.entity,AMDGPU_FENCE_OWNER_UNDEFINED , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;@@ -540,7 +540,8 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,AMDGPU_FENCE_OWNER_UNDEFINED , ib_size_dw *4 , direct ?AMDGPU_IB_POOL_DIRECT : - AMDGPU_IB_POOL_DELAYED, &job); +AMDGPU_IB_POOL_DELAYED , &job, + AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4
-4@@ -600,7 +600,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL ,64 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r) goto err;@@ -780,7 +780,7 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring, r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r) goto err;@@ -910,7 +910,7 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;@@ -977,7 +977,7 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4
-2@@ -965,7 +965,8 @@ int amdgpu_vm_update_pdes(struct amdgpu_device *adev, params.vm = vm; params.immediate = immediate; - r = vm->update_funcs->prepare (¶ms,NULL ); + r = vm->update_funcs->prepare (¶ms,NULL , +AMDGPU_KERNEL_JOB_ID_VM_UPDATE_PDES );if (r) goto error;@@ -1134,7 +1135,8 @@ int amdgpu_vm_update_range(struct amdgpu_device *adev, struct amdgpu_vm *vm,dma_fence_put (tmp); } - r = vm->update_funcs->prepare (¶ms, sync); + r = vm->update_funcs->prepare (¶ms, sync, +AMDGPU_KERNEL_JOB_ID_VM_UPDATE_RANGE );if (r) goto error_free;drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1
-1@@ -309,7 +309,7 @@ struct amdgpu_vm_update_params {struct amdgpu_vm_update_funcs {int (*map_table)(struct amdgpu_bo_vm *bo);int (*prepare)(struct amdgpu_vm_update_params *p, -struct amdgpu_sync *sync); +struct amdgpu_sync *sync,u64 k_job_id);int (*update)(struct amdgpu_vm_update_params *p,struct amdgpu_bo_vm *bo,uint64_t pe,uint64_t addr,unsigned count,uint32_t incr,uint64_t flags);drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c +3
-1@@ -40,12 +40,14 @@ static int amdgpu_vm_cpu_map_table(struct amdgpu_bo_vm *table)* * @p: see amdgpu_vm_update_params definition * @sync: sync obj with fences to wait on +* @k_job_id: the id for tracing/debug purposes * * Returns: * Negativ errno, 0 for success. */ static int amdgpu_vm_cpu_prepare (struct amdgpu_vm_update_params *p, -struct amdgpu_sync *sync) +struct amdgpu_sync *sync, +u64 k_job_id) {if (!sync)return 0 ;drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +3
-1@@ -26,6 +26,7 @@#include "amdgpu.h" #include "amdgpu_trace.h" #include "amdgpu_vm.h" +#include "amdgpu_job.h" /* * amdgpu_vm_pt_cursor - state for for_each_amdgpu_vm_pt @@ -395,7 +396,8 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm, params.vm = vm; params.immediate = immediate; - r = vm->update_funcs->prepare (¶ms,NULL ); + r = vm->update_funcs->prepare (¶ms,NULL , +AMDGPU_KERNEL_JOB_ID_VM_PT_CLEAR );if (r) goto exit;drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +7
-5@@ -40,7 +40,7 @@ static int amdgpu_vm_sdma_map_table(struct amdgpu_bo_vm *table)/* Allocate a new job for @count PTE updates */ static int amdgpu_vm_sdma_alloc_job (struct amdgpu_vm_update_params *p, -unsigned int count) +unsigned int count,u64 k_job_id) {enum amdgpu_ib_pool_type pool = p->immediate ?AMDGPU_IB_POOL_IMMEDIATE :AMDGPU_IB_POOL_DELAYED ;@@ -56,7 +56,7 @@ static int amdgpu_vm_sdma_alloc_job(struct amdgpu_vm_update_params *p, ndw =min (ndw,AMDGPU_VM_SDMA_MAX_NUM_DW ); r =amdgpu_job_alloc_with_ib (p->adev, entity,AMDGPU_FENCE_OWNER_VM , - ndw *4 , pool, &p->job); + ndw *4 , pool, &p->job, k_job_id);if (r)return r;@@ -69,16 +69,17 @@ static int amdgpu_vm_sdma_alloc_job(struct amdgpu_vm_update_params *p,* * @p: see amdgpu_vm_update_params definition * @sync: amdgpu_sync object with fences to wait for +* @k_job_id: identifier of the job, for tracing purpose * * Returns: * Negativ errno, 0 for success. */ static int amdgpu_vm_sdma_prepare (struct amdgpu_vm_update_params *p, -struct amdgpu_sync *sync) +struct amdgpu_sync *sync,u64 k_job_id) {int r; - r =amdgpu_vm_sdma_alloc_job (p,0 ); + r =amdgpu_vm_sdma_alloc_job (p,0 , k_job_id);if (r)return r;@@ -249,7 +250,8 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p,if (r)return r; - r =amdgpu_vm_sdma_alloc_job (p, count); + r =amdgpu_vm_sdma_alloc_job (p, count, +AMDGPU_KERNEL_JOB_ID_VM_UPDATE );if (r)return r; }drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4
-2@@ -217,7 +217,8 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handleint i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;@@ -281,7 +282,8 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +4
-2@@ -225,7 +225,8 @@ static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, u32 handle,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;@@ -288,7 +289,8 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, u32 handle,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +2
-1@@ -68,7 +68,8 @@ svm_migrate_gart_map(struct amdgpu_ring *ring, uint64_t npages,AMDGPU_FENCE_OWNER_UNDEFINED , num_dw *4 + num_bytes,AMDGPU_IB_POOL_DELAYED , - &job); + &job, + AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP);if (r)return r;
(Cc: dri-devel)
Quoted 8 lines · Christian König
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +0
-0@@ -44,6 +44,22 @@struct amdgpu_fence ;enum amdgpu_ib_pool_type ;
Quoted 15 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +5
-0+/* Internal kernel job ids. (decreasing values, starting from U64_MAX). */ +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE (18446744073709551615ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_PDES (18446744073709551614ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_RANGE (18446744073709551613ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_PT_CLEAR (18446744073709551612ULL)drivers/gpu/drm/amd/amdgpu/amdgpu_job.h line 61
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +10
-0+#define AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER (18446744073709551611ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA (18446744073709551610ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_COPY_BUFFER (18446744073709551609ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEAR_ON_RELEASE (18446744073709551608ULL) +#define AMDGPU_KERNEL_JOB_ID_MOVE_BLIT (18446744073709551607ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_CLEAR_BUFFER (18446744073709551606ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER (18446744073709551605ULL) +#define AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB (18446744073709551604ULL) +#define AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP (18446744073709551603ULL) +#define AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST (18446744073709551602ULL)
Why not
(U64_MAX - {1, 2, ...})?Quoted 5 lines
Mhm, reiterating our internal discussion on the mailing list.
I think it would be nicer if we could use negative values for the kernel submissions and positive for userspace. But as discussed internally we would need to adjust the scheduler trace points for that once more.
@Philip and @Danilo any opinion on that?
Both, the U64_MAX and the positive-negative approach, are a bit hacky. I wonder why we need client_id to be a u64, wouldn't a u32 not be enough?
Anyways, if client_id remains to be a u64, we could add a global DRM constant instead, e.g.
#define DRM_CLIENT_ID_MAX 0x0fffffffffffffff #define DRM_KERNEL_ID_BASE (DRM_CLIENT_ID_MAX + 1)
And in drm_file_alloc() fail if we're out of IDs.
I think this would be much cleaner.
Christian König
maintainerQuoted 29 lines · Danilo Krummrich
(Cc: dri-devel)
Quoted 8 lines · Christian König
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +0
-0@@ -44,6 +44,22 @@struct amdgpu_fence ;enum amdgpu_ib_pool_type ;Quoted 15 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +5
-0+/* Internal kernel job ids. (decreasing values, starting from U64_MAX). */ +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE (18446744073709551615ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_PDES (18446744073709551614ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_RANGE (18446744073709551613ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_PT_CLEAR (18446744073709551612ULL)drivers/gpu/drm/amd/amdgpu/amdgpu_job.h line 61
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +10
-0+#define AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER (18446744073709551611ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA (18446744073709551610ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_COPY_BUFFER (18446744073709551609ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEAR_ON_RELEASE (18446744073709551608ULL) +#define AMDGPU_KERNEL_JOB_ID_MOVE_BLIT (18446744073709551607ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_CLEAR_BUFFER (18446744073709551606ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER (18446744073709551605ULL) +#define AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB (18446744073709551604ULL) +#define AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP (18446744073709551603ULL) +#define AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST (18446744073709551602ULL)Why not
Quoted 1 line
(U64_MAX - {1, 2, ...})?That's what Pierre came up with as well, but I thought that this is ugly because it makes it hard to match the numbers from the trace back to something in the code.
Quoted 8 lines
Quoted 5 lines
Mhm, reiterating our internal discussion on the mailing list.
I think it would be nicer if we could use negative values for the kernel submissions and positive for userspace. But as discussed internally we would need to adjust the scheduler trace points for that once more.
@Philip and @Danilo any opinion on that?
Both, the
U64_MAXand the positive-negative approach, are a bit hacky. I wonder why we needclient_idto be a u64, wouldn't a u32 not be enough?
That can trivially overflow on long running boxes.
Quoted 7 lines
Anyways, if
client_idremains to be a u64, we could add a global DRM constant instead, e.g.#define DRM_CLIENT_ID_MAX 0x0fffffffffffffff #define DRM_KERNEL_ID_BASE (DRM_CLIENT_ID_MAX + 1)And in
drm_file_alloc()fail if we're out of IDs.
Mhm, I wouldn't mind printing the client id as hex and then always setting the highest bit for kernel submissions.
But when we keep printing them as base 10 it kind of becomes unreadable.
Christian.
Quoted 2 lines
I think this would be much cleaner.
Quoted 36 lines · Christian König
Quoted 29 lines · Danilo Krummrich
(Cc: dri-devel)
Quoted 8 lines · Christian König
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +0
-0@@ -44,6 +44,22 @@struct amdgpu_fence ;enum amdgpu_ib_pool_type ;Quoted 15 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +5
-0+/* Internal kernel job ids. (decreasing values, starting from U64_MAX). */ +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE (18446744073709551615ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_PDES (18446744073709551614ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_RANGE (18446744073709551613ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_PT_CLEAR (18446744073709551612ULL)drivers/gpu/drm/amd/amdgpu/amdgpu_job.h line 61
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +10
-0+#define AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER (18446744073709551611ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA (18446744073709551610ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_COPY_BUFFER (18446744073709551609ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEAR_ON_RELEASE (18446744073709551608ULL) +#define AMDGPU_KERNEL_JOB_ID_MOVE_BLIT (18446744073709551607ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_CLEAR_BUFFER (18446744073709551606ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER (18446744073709551605ULL) +#define AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB (18446744073709551604ULL) +#define AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP (18446744073709551603ULL) +#define AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST (18446744073709551602ULL)Why not
Quoted 1 line
(U64_MAX - {1, 2, ...})?That's what Pierre came up with as well, but I thought that this is ugly because it makes it hard to match the numbers from the trace back to something in the code.
Quoted 2 lines
Quoted 2 lines
Mhm, reiterating our internal discussion on the mailing list.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I think it would be nicer if we could use negative values for the kernel submissions and positive for userspace. But as discussed internally we would need to adjust the scheduler trace points for that once more.
@Philip and @Danilo any opinion on that?
Both, the
U64_MAXand the positive-negative approach, are a bit hacky. I wonder why we needclient_idto be a u64, wouldn't a u32 not be enough?That can trivially overflow on long running boxes.
I don't know if "trivially" is the word of choice given that the number is 4,294,967,295.
But I did indeed miss that this is a for ever increasing atomic. Why is it an atomic? Why is it not an IDA?
Quoted 17 lines
Quoted 7 lines
Anyways, if
client_idremains to be a u64, we could add a global DRM constant instead, e.g.#define DRM_CLIENT_ID_MAX 0x0fffffffffffffff #define DRM_KERNEL_ID_BASE (DRM_CLIENT_ID_MAX + 1)And in
drm_file_alloc()fail if we're out of IDs.Mhm, I wouldn't mind printing the client id as hex and then always setting the highest bit for kernel submissions.
But when we keep printing them as base 10 it kind of becomes unreadable.
Christian.
Quoted 2 lines
I think this would be much cleaner.
Christian König
maintainerQuoted 9 lines · Danilo Krummrich
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
Mhm, reiterating our internal discussion on the mailing list.
I think it would be nicer if we could use negative values for the kernel submissions and positive for userspace. But as discussed internally we would need to adjust the scheduler trace points for that once more.
@Philip and @Danilo any opinion on that?
Both, the
U64_MAXand the positive-negative approach, are a bit hacky. I wonder why we needclient_idto be a u64, wouldn't a u32 not be enough?
Quoted 7 lines
Quoted 1 line
That can trivially overflow on long running boxes.
I don't know if "trivially" is the word of choice given that the number is 4,294,967,295.
But I did indeed miss that this is a for ever increasing atomic. Why is it an atomic? Why is it not an IDA?
Well IDA has some extra overhead compared to an ever increasing atomic, additional to that it might not be the best choice to re-use numbers for clients in a trace log.
On the other hand using smaller numbers is usually nicer for manual inspection.
Regards,
Christian.
Quoted 12 lines · Christian König
Quoted 11 lines · Danilo Krummrich
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
Mhm, reiterating our internal discussion on the mailing list.
I think it would be nicer if we could use negative values for the kernel submissions and positive for userspace. But as discussed internally we would need to adjust the scheduler trace points for that once more.
@Philip and @Danilo any opinion on that?
Both, the
U64_MAXand the positive-negative approach, are a bit hacky. I wonder why we needclient_idto be a u64, wouldn't a u32 not be enough?That can trivially overflow on long running boxes.
Quoted 7 lines
Quoted 5 lines
I don't know if "trivially" is the word of choice given that the number is 4,294,967,295.
But I did indeed miss that this is a for ever increasing atomic. Why is it an atomic? Why is it not an IDA?
Well IDA has some extra overhead compared to an ever increasing atomic, additional to that it might not be the best choice to re-use numbers for clients in a trace log.
I think the overhead is not relevant at all, this is called from drm_file_alloc(). The only path I can see where this is called is drm_client_init(), which isn't high frequent stuff at all, is it?
It seems to me that we should probably use IDA here.
Quoted 1 line
On the other hand using smaller numbers is usually nicer for manual inspection.
Another option is to just add an interface to get a kernel client_id from the same atomic / IDA.
Hi,
Le 13/06/2025 à 01:48, Danilo Krummrich a écrit :
Quoted 19 lines · Christian König
Quoted 18 lines · Danilo Krummrich
Quoted 16 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
Mhm, reiterating our internal discussion on the mailing list.
I think it would be nicer if we could use negative values for the kernel submissions and positive for userspace. But as discussed internally we would need to adjust the scheduler trace points for that once more.
@Philip and @Danilo any opinion on that?
Both, the
U64_MAXand the positive-negative approach, are a bit hacky. I wonder why we needclient_idto be a u64, wouldn't a u32 not be enough?That can trivially overflow on long running boxes.
I don't know if "trivially" is the word of choice given that the number is 4,294,967,295.
But I did indeed miss that this is a for ever increasing atomic. Why is it an atomic? Why is it not an IDA?
Quoted 9 lines
Quoted 1 line
Well IDA has some extra overhead compared to an ever increasing atomic, additional to that it might not be the best choice to re-use numbers for clients in a trace log.
I think the overhead is not relevant at all, this is called from
drm_file_alloc(). The only path I can see where this is called isdrm_client_init(), which isn't high frequent stuff at all, is it?It seems to me that we should probably use IDA here.
Quoted 1 line
On the other hand using smaller numbers is usually nicer for manual inspection.
Re-using IDs might bring confusion in the trace logs, for instance when tracing lots of short lived processes.
Quoted 3 lines
Another option is to just add an interface to get a kernel
client_idfrom the same atomic / IDA.
Honestly I don't really see the problem with the current patch: using the last N ids for the kernel jobs requires no other changes and works fine.
https://gitlab.freedesktop.org/drm/amd/-/issues/4260 has a screenshot of the UMR tool using these ids.
If the theoretical overlap with client drm id is a concern, adding code to drm_file_alloc() to not use the last 0xff ids would be easy.
btw maybe other drivers also use kernel jobs with the same semantics, in which case we might want to move the special IDs definition to a shared place.
Thanks,
Pierre-Eric
Quoted 2 lines · Pierre-Eric Pelloux-Prayer
If the theoretical overlap with client drm id is a concern, adding code to
drm_file_alloc()to not use the last0xffids would be easy.
Not the theoretical overlap is not of any concern for me. What I dislike is drivers silently relying on DRM API internals.
Quoted 3 lines
btw maybe other drivers also use kernel jobs with the same semantics, in which case we might want to move the special IDs definition to a shared place.
Exactly, if kernel IDs are a thing we agree makes sense, we should provide a common API to properly obtain a kernel ID, regardless of whether it's an atomic or IDA.
Christian König
maintainerQuoted 16 lines · Danilo Krummrich
Quoted 15 lines · Christian König
Quoted 14 lines · Danilo Krummrich
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
Mhm, reiterating our internal discussion on the mailing list.
I think it would be nicer if we could use negative values for the kernel submissions and positive for userspace. But as discussed internally we would need to adjust the scheduler trace points for that once more.
@Philip and @Danilo any opinion on that?
Both, the
U64_MAXand the positive-negative approach, are a bit hacky. I wonder why we needclient_idto be a u64, wouldn't a u32 not be enough?That can trivially overflow on long running boxes.
I don't know if "trivially" is the word of choice given that the number is 4,294,967,295.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
But I did indeed miss that this is a for ever increasing atomic. Why is it an atomic? Why is it not an IDA?
Well IDA has some extra overhead compared to an ever increasing atomic, additional to that it might not be the best choice to re-use numbers for clients in a trace log.
I think the overhead is not relevant at all, this is called from
drm_file_alloc(). The only path I can see where this is called isdrm_client_init(), which isn't high frequent stuff at all, is it?
I don't think so. But we should really use ida_alloc_cyclic to make sure that numbers are not re-used so quickly.
Quoted 7 lines
It seems to me that we should probably use IDA here.
Quoted 1 line
On the other hand using smaller numbers is usually nicer for manual inspection.
Another option is to just add an interface to get a kernel
client_idfrom the same atomic / IDA.
That won't give us fixed numbers for in kernel clients.
Regards,
Christian.
Quoted 32 lines · Christian König
Quoted 31 lines · Danilo Krummrich
Quoted 29 lines · Christian König
Quoted 17 lines · Danilo Krummrich
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Mhm, reiterating our internal discussion on the mailing list.
I think it would be nicer if we could use negative values for the kernel submissions and positive for userspace. But as discussed internally we would need to adjust the scheduler trace points for that once more.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
@Philip and @Danilo any opinion on that?
Both, the
U64_MAXand the positive-negative approach, are a bit hacky. I wonder
why we needclient_idto be a u64, wouldn't a u32 not be enough?That can trivially overflow on long running boxes.
Quoted 7 lines
I don't know if "trivially" is the word of choice given that the number is
4,294,967,295.But I did indeed miss that this is a for ever increasing atomic. Why is it an
atomic? Why is it not an IDA?Well IDA has some extra overhead compared to an ever increasing atomic, additional to that it might not be the best choice to re- use numbers for clients in a trace log.
Quoted 6 lines
Quoted 3 lines
I think the overhead is not relevant at all, this is called from
drm_file_alloc(). The only path I can see where this is called isdrm_client_init(), which isn't high frequent stuff at all, is it?I don't think so. But we should really use
ida_alloc_cyclicto make sure that numbers are not re-used so quickly.
Shouldn't the xarray be used nowadays for ID allocation? I think idr_alloc_cyclic() (ida_alloc_cyclic() doesn't exist) is just a wrapper around the xarray anyways.
P.
Quoted 15 lines
Quoted 10 lines
It seems to me that we should probably use IDA here.
Quoted 2 lines
On the other hand using smaller numbers is usually nicer for manual inspection.
Another option is to just add an interface to get a kernel
client_idfrom the
same atomic / IDA.That won't give us fixed numbers for in kernel clients.
Regards,
Christian.
Quoted 3 lines · Philipp Stanner
Shouldn't the xarray be used nowadays for ID allocation? I think
idr_alloc_cyclic()(ida_alloc_cyclic()doesn't exist) is just a wrapper around the xarray anyways.
Yes, IDR is basically xarray under the hood. But, a raw xarray (or IDR) is unnecessary overhead, since we don't need to store pointers.
While IDA also uses xarray under the hood, it does perform some tricks to provide only ID numbers, but much more efficiently.
Given that there's no ida_alloc_cyclic(), the atomic is probably fine, even though, ida_alloc_cyclic() doesn't sound like a bad idea to add in general.
But maybe it's difficult due to some of the optimization tricks IDA performs.
I think we should stick to the atomic for now, but add a proper API to reserve kernel IDs.
Quoted 4 lines · Christian König
Quoted 2 lines
Another option is to just add an interface to get a kernel
client_idfrom the same atomic / IDA.That won't give us fixed numbers for in kernel clients.
That's fine, then let's come up with an API that reserves fixed numbers.
My main concern is that drivers silently rely on DRM API internals, i.e. that client_id is an u64 atomic, etc.
Le 13/06/2025 à 10:35, Danilo Krummrich a écrit :
Quoted 10 lines · Christian König
Quoted 4 lines
Quoted 2 lines
Another option is to just add an interface to get a kernel
client_idfrom the same atomic / IDA.That won't give us fixed numbers for in kernel clients.
That's fine, then let's come up with an API that reserves fixed numbers.
My main concern is that drivers silently rely on DRM API internals, i.e. that
client_idis an u64 atomic, etc.
Let me express the need then: an id that is printed in gpu_scheduler_trace events and this id needs to be mappable by a userspace tool to a semantic.
The current solution implements this need using:
* fixed ids which are u64 numbers because drm client id are u64.
* hard-coded mapping in the tool between these ids and their meaning ("u64_max - 1" interpreted as "vm_update" and so on).
It doesn't depend on how drm internally manage these ids.
Adding an API to reserve fixed numbers would work but:
* if the fixed numbers are chosen by the driver ("drm_reserve_id(u64_max -1)"), I don't see the benefit over the current patch
* if the fixed numbers are allocated by drm (drm_reserve_id("vm_update") -> u64), it would then require a way to expose them to userspace (through /sys/kernel/debug/dri/x/clients?)
Thanks,
Pierre-Eric
Quoted 20 lines · Pierre-Eric Pelloux-Prayer
Le 13/06/2025 à 10:35, Danilo Krummrich a écrit :
Quoted 10 lines · Christian König
Quoted 4 lines
Quoted 2 lines
Another option is to just add an interface to get a kernel
client_idfrom the same atomic / IDA.That won't give us fixed numbers for in kernel clients.
That's fine, then let's come up with an API that reserves fixed numbers.
My main concern is that drivers silently rely on DRM API internals, i.e. that
client_idis an u64 atomic, etc.Let me express the need then: an id that is printed in
gpu_scheduler_traceevents and this id needs to be mappable by a userspace tool to a semantic.The current solution implements this need using:
* fixed ids which are u64 numbers because drm client id are u64.
* hard-coded mapping in the tool between these ids and their meaning ("u64_max- 1" interpreted as "vm_update" and so on).
Quoted 8 lines
It doesn't depend on how drm internally manage these ids.
Adding an API to reserve fixed numbers would work but:
* if the fixed numbers are chosen by the driver ("drm_reserve_id(u64_max -1)"), I don't see the benefit over the current patch
* if the fixed numbers are allocated by drm (drm_reserve_id("vm_update")-> u64), it would then require a way to expose them to userspace (through/sys/kernel/debug/dri/x/clients?)
Yeah, both is possible, I'm fine with either.
The benefit is that this way it becomes an official API, which can (and must) be considered should there ever be a change on drm_file::client_id.
If someone would patch drm_file::client_id to start allocating IDs from high to low, your corresponding driver code would silently break, because it relies on an implementation detail of something that is not an official API.
Yes, I know that this exact case won't happen, but I guess you get the idea. :-)
Quoted 13 lines
Quoted 10 lines
Adding an API to reserve fixed numbers would work but:
* if the fixed numbers are chosen by the driver ("drm_reserve_id(u64_max -1)"), I don't see the benefit over the current patch
* if the fixed numbers are allocated by drm (drm_reserve_id("vm_update")-> u64), it would then require a way to expose them to userspace (through/sys/kernel/debug/dri/x/clients?)Yeah, both is possible, I'm fine with either.
Quoted 8 lines
The benefit is that this way it becomes an official API, which can (and must) be considered should there ever be a change on
drm_file::client_id.If someone would patch
drm_file::client_idto start allocating IDs from high to low, your corresponding driver code would silently break, because it relies on an implementation detail of something that is not an official API.Yes, I know that this exact case won't happen, but I guess you get the idea. :-)
After looking a bit more into this, I came to the conclusion that IMO the 2 above options aren't great:
* the first adds a function that expose the possibility of reserving an id so we'll have to keep track of such reserved ids for a benefit that is limited at best
* the second option is nicer on the surface because it doesn't make the tools dependent on hard-coded kernel ids. But it also requires quite a bit of changes and memory usage allocations.
Honestly I'm wondering if adding a comment to drm_file_alloc like this would be enough;
/* Get a unique identifier for fdinfo.
* The highest ids may be used by drivers for tracing purposes. Overlapping is
* unlikely to occur, and if it does the impact will be limited to tracing. */
file->client_id = atomic64_inc_return(&ident);
What do you think?
Pierre-Eric
Le 18/06/2025 à 11:18, Pierre-Eric Pelloux-Prayer a écrit :
Quoted 28 lines
Quoted 13 lines
Quoted 10 lines
Adding an API to reserve fixed numbers would work but:
* if the fixed numbers are chosen by the driver ("drm_reserve_id(u64_max -1)"), I don't see the benefit over the current patch
* if the fixed numbers are allocated by drm (drm_reserve_id("vm_update")-> u64), it would then require a way to expose them to userspace (through/sys/kernel/debug/dri/x/clients?)Yeah, both is possible, I'm fine with either.
Quoted 8 lines
The benefit is that this way it becomes an official API, which can (and must) be considered should there ever be a change on
drm_file::client_id.If someone would patch
drm_file::client_idto start allocating IDs from high to low, your corresponding driver code would silently break, because it relies on an implementation detail of something that is not an official API.Yes, I know that this exact case won't happen, but I guess you get the idea. :-)
After looking a bit more into this, I came to the conclusion that IMO the 2 above options aren't great:
* the first adds a function that expose the possibility of reserving an id so we'll have to keep track of such reserved ids for a benefit that is limited at best
* the second option is nicer on the surface because it doesn't make the tools dependent on hard- coded kernel ids. But it also requires quite a bit of changes and memory usage allocations.Honestly I'm wondering if adding a comment to
drm_file_alloclike this would be enough;
Quoted 8 lines
/* Get a unique identifier for fdinfo.
* The highest ids may be used by drivers for tracing purposes. Overlapping is
* unlikely to occur, and if it does the impact will be limited to tracing. */
file->client_id=atomic64_inc_return(&ident);What do you think?
ping?
btw, I don't think that adding a comment to drm_file is even useful.
What the original patch does is passing opaque ids to a function that expects client_id (drm_sched_job_init).
These opaque ids could have any values, they won't interfere with fdinfo statistics nor the driver inner working - they're just for tracing purpose.
Pierre-Eric
Quoted 3 lines
Pierre-Eric
Quoted 44 lines · Pierre-Eric Pelloux-Prayer
Le 18/06/2025 à 11:18, Pierre-Eric Pelloux-Prayer a écrit :
Quoted 32 lines
Quoted 13 lines
Quoted 10 lines
Adding an API to reserve fixed numbers would work but:
* if the fixed numbers are chosen by the driver ("drm_reserve_id(u64_max -1)"), I don't see the benefit over the current patch
* if the fixed numbers are allocated by drm (drm_reserve_id("vm_update")-> u64), it would then require a way to expose them to userspace (through/sys/kernel/debug/dri/x/clients?)Yeah, both is possible, I'm fine with either.
Quoted 8 lines
The benefit is that this way it becomes an official API, which can (and must) be considered should there ever be a change on
drm_file::client_id.If someone would patch
drm_file::client_idto start allocating IDs from high to low, your corresponding driver code would silently break, because it relies on an implementation detail of something that is not an official API.Yes, I know that this exact case won't happen, but I guess you get the idea. :-)
After looking a bit more into this, I came to the conclusion that IMO the 2 above options aren't great:
* the first adds a function that expose the possibility of reserving an
id so we'll have to keep track of such reserved ids for a benefit that
is limited at best
* the second option is nicer on the surface because it doesn't make the
tools dependent on hard- coded kernel ids. But it also requires quite a
bit of changes and memory usage allocations.Honestly I'm wondering if adding a comment to
drm_file_alloclike this would be enough;Quoted 8 lines
/* Get a unique identifier for fdinfo.
* The highest ids may be used by drivers for tracing purposes. Overlapping is
* unlikely to occur, and if it does the impact will be limited to tracing. */
file->client_id=atomic64_inc_return(&ident);What do you think?
Quoted 8 lines
ping?
btw, I don't think that adding a comment to
drm_fileis even useful.What the original patch does is passing opaque ids to a function that expects
client_id(drm_sched_job_init).
These opaque ids could have any values, they won't interfere with fdinfo statistics nor the driver inner working - they're just for tracing purpose.
I mean, you're right, you can definitely do that, it's entirely up to the driver what to pass as a debug cookie to drm_sched_job_init().
I'm just saying that you're completely on your own if the implementation of file->client_id would change (which admittedly is unlikely). In such a case you'd have to accept that potentially a change silently breaks your driver and that people are free to ignore this fact.
In this case it's probably not that big a deal, but still I like to create some awareness that this class of solutions (i.e. rely on how generic infrastructure works internally) is usually not a good idea at all, since it's error prone and is giving maintainers a hard time.
Quoted 8 lines · Pierre-Eric Pelloux-Prayer
Userspace jobs have drm_file.client_id as a unique identifier as job's owners. For kernel jobs, we can allocate arbitrary values - the risk of overlap with userspace ids is small (given that it's a u64 value).
In the unlikely case the overlap happens, it'll only impact trace events.
Quoted 7 lines
Since this ID is traced in the
gpu_schedulertrace events, this allows to determine the source of each job sent to the hardware.To make grepping easier, the IDs are defined as they will appear in the trace output.
Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>
After reviewing this thread, I don't see any functional impact for these debug values if they did happen to overlap with values coming from read UMD clients. At worst the tracing tools might get confused, but I think that would be easy to fix. Seems reasonable to land this.
Quoted 529 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 19 +++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 28 +++++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 5 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 4 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 12 +++++---- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 6 +++-- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 6 +++-- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 ++- 19 files changed, 84 insertions(+), 41 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2
-1@@ -1461,7 +1461,8 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring) owner = (void *)(unsigned long )atomic_inc_return (&counter); r =amdgpu_job_alloc_with_ib (ring->adev, &entity, owner, -64 ,0 , &job); +64 ,0 , &job, +AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER );if (r) goto err;drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -674,7 +674,7 @@ void amdgpu_gmc_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, r =amdgpu_job_alloc_with_ib (ring->adev, &adev->mman.high_pr,AMDGPU_FENCE_OWNER_UNDEFINED ,16 *4 ,AMDGPU_IB_POOL_IMMEDIATE , - &job); + &job,AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB );if (r) goto error_alloc;drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +3
-2@@ -230,11 +230,12 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,int amdgpu_job_alloc_with_ib (struct amdgpu_device *adev,struct drm_sched_entity *entity,void *owner,size_t size,enum amdgpu_ib_pool_type pool_type, -struct amdgpu_job **job) +struct amdgpu_job **job,u64 k_job_id) {int r; - r =amdgpu_job_alloc (adev,NULL , entity, owner,1 , job,0 ); + r =amdgpu_job_alloc (adev,NULL , entity, owner,1 , job, + k_job_id);if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +18
-1@@ -44,6 +44,22 @@struct amdgpu_fence ;enum amdgpu_ib_pool_type ; +/* Internal kernel job ids. (decreasing values, starting from U64_MAX). */ +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE (18446744073709551615ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_PDES (18446744073709551614ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_UPDATE_RANGE (18446744073709551613ULL) +#define AMDGPU_KERNEL_JOB_ID_VM_PT_CLEAR (18446744073709551612ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER (18446744073709551611ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA (18446744073709551610ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_COPY_BUFFER (18446744073709551609ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEAR_ON_RELEASE (18446744073709551608ULL) +#define AMDGPU_KERNEL_JOB_ID_MOVE_BLIT (18446744073709551607ULL) +#define AMDGPU_KERNEL_JOB_ID_TTM_CLEAR_BUFFER (18446744073709551606ULL) +#define AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER (18446744073709551605ULL) +#define AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB (18446744073709551604ULL) +#define AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP (18446744073709551603ULL) +#define AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST (18446744073709551602ULL) +struct amdgpu_job {struct drm_sched_job base;struct amdgpu_vm *vm;@@ -95,7 +111,8 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,int amdgpu_job_alloc_with_ib (struct amdgpu_device *adev,struct drm_sched_entity *entity,void *owner,size_t size,enum amdgpu_ib_pool_type pool_type, -struct amdgpu_job **job); +struct amdgpu_job **job, +u64 k_job_id);void amdgpu_job_set_resources (struct amdgpu_job *job,struct amdgpu_bo *gds,struct amdgpu_bo *gws,struct amdgpu_bo *oa);void amdgpu_job_free_resources (struct amdgpu_job *job);drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +2
-1@@ -194,7 +194,8 @@ static int amdgpu_jpeg_dec_set_reg(struct amdgpu_ring *ring, uint32_t handle,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-1@@ -1315,7 +1315,8 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo)if (r) goto out; - r =amdgpu_fill_buffer (abo,0 , &bo->base._resv, &fence, true); + r =amdgpu_fill_buffer (abo,0 , &bo->base._resv, &fence, true, +AMDGPU_KERNEL_JOB_ID_CLEAR_ON_RELEASE );if (WARN_ON (r)) goto out;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +17
-11@@ -226,7 +226,8 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, r =amdgpu_job_alloc_with_ib (adev, &adev->mman.high_pr,AMDGPU_FENCE_OWNER_UNDEFINED , num_dw *4 + num_bytes, -AMDGPU_IB_POOL_DELAYED , &job); +AMDGPU_IB_POOL_DELAYED , &job, +AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER );if (r)return r;@@ -405,7 +406,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,struct dma_fence *wipe_fence =NULL ; r =amdgpu_fill_buffer (abo,0 ,NULL , &wipe_fence, - false); + false,AMDGPU_KERNEL_JOB_ID_MOVE_BLIT );if (r) { goto error; }else if (wipe_fence) {@@ -1509,7 +1510,8 @@ static int amdgpu_ttm_access_memory_sdma(struct ttm_buffer_object *bo, r =amdgpu_job_alloc_with_ib (adev, &adev->mman.high_pr,AMDGPU_FENCE_OWNER_UNDEFINED , num_dw *4 ,AMDGPU_IB_POOL_DELAYED , - &job); + &job, +AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA );if (r) goto out;@@ -2159,7 +2161,7 @@ static int amdgpu_ttm_prepare_job(struct amdgpu_device *adev,struct dma_resv *resv, bool vm_needs_flush, struct amdgpu_job **job, - bool delayed) + bool delayed, u64 k_job_id) { enum amdgpu_ib_pool_type pool = direct_submit ? AMDGPU_IB_POOL_DIRECT :@@ -2169,7 +2171,7 @@ static int amdgpu_ttm_prepare_job(struct amdgpu_device *adev, &adev->mman.high_pr; r =amdgpu_job_alloc_with_ib (adev, entity,AMDGPU_FENCE_OWNER_UNDEFINED , - num_dw *4 , pool, job); + num_dw *4 , pool, job, k_job_id);if (r)return r;@@ -2208,7 +2210,8 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, num_loops =DIV_ROUND_UP (byte_count, max_bytes); num_dw =ALIGN (num_loops * adev->mman.buffer_funcs->copy_num_dw,8 ); r =amdgpu_ttm_prepare_job (adev, direct_submit, num_dw, - resv, vm_needs_flush, &job, false); + resv, vm_needs_flush, &job, false, +AMDGPU_KERNEL_JOB_ID_TTM_COPY_BUFFER );if (r)return r;@@ -2243,7 +2246,8 @@ static int amdgpu_ttm_fill_mem(struct amdgpu_ring *ring, uint32_t src_data, uint64_t dst_addr, uint32_t byte_count, struct dma_resv *resv, struct dma_fence **fence, - bool vm_needs_flush, bool delayed) + bool vm_needs_flush, bool delayed, + u64 k_job_id) { struct amdgpu_device *adev = ring->adev;unsigned int num_loops, num_dw;@@ -2256,7 +2260,7 @@ static int amdgpu_ttm_fill_mem(struct amdgpu_ring *ring, uint32_t src_data, num_loops =DIV_ROUND_UP_ULL (byte_count, max_bytes); num_dw =ALIGN (num_loops * adev->mman.buffer_funcs->fill_num_dw,8 ); r =amdgpu_ttm_prepare_job (adev, false, num_dw, resv, vm_needs_flush, - &job, delayed); + &job, delayed, k_job_id);if (r)return r;@@ -2326,7 +2330,8 @@ int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo, goto err; r =amdgpu_ttm_fill_mem (ring,0 , addr, size, resv, - &next, true, true); + &next, true, true, +AMDGPU_KERNEL_JOB_ID_TTM_CLEAR_BUFFER );if (r) goto err;@@ -2345,7 +2350,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,uint32_t src_data, struct dma_resv *resv, struct dma_fence **f, - bool delayed) + bool delayed, + u64 k_job_id) { struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;@@ -2374,7 +2380,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, goto error; r =amdgpu_ttm_fill_mem (ring, src_data, to, cur_size, resv, - &next, true, delayed); + &next, true, delayed, k_job_id);if (r) goto error;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +2
-1@@ -180,7 +180,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,uint32_t src_data, struct dma_resv *resv, struct dma_fence **fence, - bool delayed); + bool delayed, + u64 k_job_id);int amdgpu_ttm_alloc_gart (struct ttm_buffer_object *bo);void amdgpu_ttm_recover_gart (struct ttm_buffer_object *tbo);drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2
-1@@ -1136,7 +1136,8 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo, r =amdgpu_job_alloc_with_ib (ring->adev, &adev->uvd.entity,AMDGPU_FENCE_OWNER_UNDEFINED ,64 , direct ?AMDGPU_IB_POOL_DIRECT : -AMDGPU_IB_POOL_DELAYED , &job); +AMDGPU_IB_POOL_DELAYED , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +3
-2@@ -449,7 +449,7 @@ static int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, r =amdgpu_job_alloc_with_ib (ring->adev, &ring->adev->vce.entity,AMDGPU_FENCE_OWNER_UNDEFINED , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;@@ -540,7 +540,8 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,AMDGPU_FENCE_OWNER_UNDEFINED , ib_size_dw *4 , direct ?AMDGPU_IB_POOL_DIRECT : - AMDGPU_IB_POOL_DELAYED, &job); +AMDGPU_IB_POOL_DELAYED , &job, + AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4
-4@@ -600,7 +600,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL ,64 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r) goto err;@@ -780,7 +780,7 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring, r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r) goto err;@@ -910,7 +910,7 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;@@ -977,7 +977,7 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 ,AMDGPU_IB_POOL_DIRECT , - &job); + &job,AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4
-2@@ -965,7 +965,8 @@ int amdgpu_vm_update_pdes(struct amdgpu_device *adev, params.vm = vm; params.immediate = immediate; - r = vm->update_funcs->prepare (¶ms,NULL ); + r = vm->update_funcs->prepare (¶ms,NULL , +AMDGPU_KERNEL_JOB_ID_VM_UPDATE_PDES );if (r) goto error;@@ -1134,7 +1135,8 @@ int amdgpu_vm_update_range(struct amdgpu_device *adev, struct amdgpu_vm *vm,dma_fence_put (tmp); } - r = vm->update_funcs->prepare (¶ms, sync); + r = vm->update_funcs->prepare (¶ms, sync, +AMDGPU_KERNEL_JOB_ID_VM_UPDATE_RANGE );if (r) goto error_free;drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1
-1@@ -309,7 +309,7 @@ struct amdgpu_vm_update_params {struct amdgpu_vm_update_funcs {int (*map_table)(struct amdgpu_bo_vm *bo);int (*prepare)(struct amdgpu_vm_update_params *p, -struct amdgpu_sync *sync); +struct amdgpu_sync *sync,u64 k_job_id);int (*update)(struct amdgpu_vm_update_params *p,struct amdgpu_bo_vm *bo,uint64_t pe,uint64_t addr,unsigned count,uint32_t incr,uint64_t flags);drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c +3
-1@@ -40,12 +40,14 @@ static int amdgpu_vm_cpu_map_table(struct amdgpu_bo_vm *table)* * @p: see amdgpu_vm_update_params definition * @sync: sync obj with fences to wait on +* @k_job_id: the id for tracing/debug purposes * * Returns: * Negativ errno, 0 for success. */ static int amdgpu_vm_cpu_prepare (struct amdgpu_vm_update_params *p, -struct amdgpu_sync *sync) +struct amdgpu_sync *sync, +u64 k_job_id) {if (!sync)return 0 ;drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +3
-1@@ -26,6 +26,7 @@#include "amdgpu.h" #include "amdgpu_trace.h" #include "amdgpu_vm.h" +#include "amdgpu_job.h" /* * amdgpu_vm_pt_cursor - state for for_each_amdgpu_vm_pt @@ -395,7 +396,8 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm, params.vm = vm; params.immediate = immediate; - r = vm->update_funcs->prepare (¶ms,NULL ); + r = vm->update_funcs->prepare (¶ms,NULL , +AMDGPU_KERNEL_JOB_ID_VM_PT_CLEAR );if (r) goto exit;drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +7
-5@@ -40,7 +40,7 @@ static int amdgpu_vm_sdma_map_table(struct amdgpu_bo_vm *table)/* Allocate a new job for @count PTE updates */ static int amdgpu_vm_sdma_alloc_job (struct amdgpu_vm_update_params *p, -unsigned int count) +unsigned int count,u64 k_job_id) {enum amdgpu_ib_pool_type pool = p->immediate ?AMDGPU_IB_POOL_IMMEDIATE :AMDGPU_IB_POOL_DELAYED ;@@ -56,7 +56,7 @@ static int amdgpu_vm_sdma_alloc_job(struct amdgpu_vm_update_params *p, ndw =min (ndw,AMDGPU_VM_SDMA_MAX_NUM_DW ); r =amdgpu_job_alloc_with_ib (p->adev, entity,AMDGPU_FENCE_OWNER_VM , - ndw *4 , pool, &p->job); + ndw *4 , pool, &p->job, k_job_id);if (r)return r;@@ -69,16 +69,17 @@ static int amdgpu_vm_sdma_alloc_job(struct amdgpu_vm_update_params *p,* * @p: see amdgpu_vm_update_params definition * @sync: amdgpu_sync object with fences to wait for +* @k_job_id: identifier of the job, for tracing purpose * * Returns: * Negativ errno, 0 for success. */ static int amdgpu_vm_sdma_prepare (struct amdgpu_vm_update_params *p, -struct amdgpu_sync *sync) +struct amdgpu_sync *sync,u64 k_job_id) {int r; - r =amdgpu_vm_sdma_alloc_job (p,0 ); + r =amdgpu_vm_sdma_alloc_job (p,0 , k_job_id);if (r)return r;@@ -249,7 +250,8 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p,if (r)return r; - r =amdgpu_vm_sdma_alloc_job (p, count); + r =amdgpu_vm_sdma_alloc_job (p, count, +AMDGPU_KERNEL_JOB_ID_VM_UPDATE );if (r)return r; }drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4
-2@@ -217,7 +217,8 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handleint i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;@@ -281,7 +282,8 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +4
-2@@ -225,7 +225,8 @@ static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, u32 handle,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;@@ -288,7 +289,8 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, u32 handle,int i, r; r =amdgpu_job_alloc_with_ib (ring->adev,NULL ,NULL , ib_size_dw *4 , -AMDGPU_IB_POOL_DIRECT , &job); +AMDGPU_IB_POOL_DIRECT , &job, +AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST );if (r)return r;drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +2
-2@@ -68,7 +68,8 @@ svm_migrate_gart_map(struct amdgpu_ring *ring, uint64_t npages,AMDGPU_FENCE_OWNER_UNDEFINED , num_dw *4 + num_bytes,AMDGPU_IB_POOL_DELAYED , - &job); + &job, + AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP);if (r)return r; --2.43.0