Commit b3eebe3d authored by Monk Liu's avatar Monk Liu Committed by Alex Deucher

drm/amd/scheduler:introduce guilty pointer member

this member will be used later, it will points to
the real var inside of context and CS_SUBMIT & gpu schdduler
can decide if skip a job depends on context->guilty or *entity->guilty
Signed-off-by: default avatarMonk Liu <Monk.Liu@amd.com>
Reviewed-by: default avatarChunming Zhou <David1.Zhou@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 95aa9b1d
...@@ -90,7 +90,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, ...@@ -90,7 +90,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev,
continue; continue;
r = amd_sched_entity_init(&ring->sched, &ctx->rings[i].entity, r = amd_sched_entity_init(&ring->sched, &ctx->rings[i].entity,
rq, amdgpu_sched_jobs); rq, amdgpu_sched_jobs, NULL);
if (r) if (r)
goto failed; goto failed;
} }
......
...@@ -110,7 +110,7 @@ static int amdgpu_ttm_global_init(struct amdgpu_device *adev) ...@@ -110,7 +110,7 @@ static int amdgpu_ttm_global_init(struct amdgpu_device *adev)
ring = adev->mman.buffer_funcs_ring; ring = adev->mman.buffer_funcs_ring;
rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_KERNEL]; rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_KERNEL];
r = amd_sched_entity_init(&ring->sched, &adev->mman.entity, r = amd_sched_entity_init(&ring->sched, &adev->mman.entity,
rq, amdgpu_sched_jobs); rq, amdgpu_sched_jobs, NULL);
if (r) { if (r) {
DRM_ERROR("Failed setting up TTM BO move run queue.\n"); DRM_ERROR("Failed setting up TTM BO move run queue.\n");
goto error_entity; goto error_entity;
......
...@@ -232,7 +232,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) ...@@ -232,7 +232,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
ring = &adev->uvd.ring; ring = &adev->uvd.ring;
rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL]; rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL];
r = amd_sched_entity_init(&ring->sched, &adev->uvd.entity, r = amd_sched_entity_init(&ring->sched, &adev->uvd.entity,
rq, amdgpu_sched_jobs); rq, amdgpu_sched_jobs, NULL);
if (r != 0) { if (r != 0) {
DRM_ERROR("Failed setting up UVD run queue.\n"); DRM_ERROR("Failed setting up UVD run queue.\n");
return r; return r;
......
...@@ -176,7 +176,7 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size) ...@@ -176,7 +176,7 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
ring = &adev->vce.ring[0]; ring = &adev->vce.ring[0];
rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL]; rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL];
r = amd_sched_entity_init(&ring->sched, &adev->vce.entity, r = amd_sched_entity_init(&ring->sched, &adev->vce.entity,
rq, amdgpu_sched_jobs); rq, amdgpu_sched_jobs, NULL);
if (r != 0) { if (r != 0) {
DRM_ERROR("Failed setting up VCE run queue.\n"); DRM_ERROR("Failed setting up VCE run queue.\n");
return r; return r;
......
...@@ -106,7 +106,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) ...@@ -106,7 +106,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
ring = &adev->vcn.ring_dec; ring = &adev->vcn.ring_dec;
rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL]; rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL];
r = amd_sched_entity_init(&ring->sched, &adev->vcn.entity_dec, r = amd_sched_entity_init(&ring->sched, &adev->vcn.entity_dec,
rq, amdgpu_sched_jobs); rq, amdgpu_sched_jobs, NULL);
if (r != 0) { if (r != 0) {
DRM_ERROR("Failed setting up VCN dec run queue.\n"); DRM_ERROR("Failed setting up VCN dec run queue.\n");
return r; return r;
...@@ -115,7 +115,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) ...@@ -115,7 +115,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
ring = &adev->vcn.ring_enc[0]; ring = &adev->vcn.ring_enc[0];
rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL]; rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL];
r = amd_sched_entity_init(&ring->sched, &adev->vcn.entity_enc, r = amd_sched_entity_init(&ring->sched, &adev->vcn.entity_enc,
rq, amdgpu_sched_jobs); rq, amdgpu_sched_jobs, NULL);
if (r != 0) { if (r != 0) {
DRM_ERROR("Failed setting up VCN enc run queue.\n"); DRM_ERROR("Failed setting up VCN enc run queue.\n");
return r; return r;
......
...@@ -2637,7 +2637,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, ...@@ -2637,7 +2637,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
ring = adev->vm_manager.vm_pte_rings[ring_instance]; ring = adev->vm_manager.vm_pte_rings[ring_instance];
rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_KERNEL]; rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_KERNEL];
r = amd_sched_entity_init(&ring->sched, &vm->entity, r = amd_sched_entity_init(&ring->sched, &vm->entity,
rq, amdgpu_sched_jobs); rq, amdgpu_sched_jobs, NULL);
if (r) if (r)
return r; return r;
......
...@@ -416,7 +416,7 @@ static int uvd_v6_0_sw_init(void *handle) ...@@ -416,7 +416,7 @@ static int uvd_v6_0_sw_init(void *handle)
ring = &adev->uvd.ring_enc[0]; ring = &adev->uvd.ring_enc[0];
rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL]; rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL];
r = amd_sched_entity_init(&ring->sched, &adev->uvd.entity_enc, r = amd_sched_entity_init(&ring->sched, &adev->uvd.entity_enc,
rq, amdgpu_sched_jobs); rq, amdgpu_sched_jobs, NULL);
if (r) { if (r) {
DRM_ERROR("Failed setting up UVD ENC run queue.\n"); DRM_ERROR("Failed setting up UVD ENC run queue.\n");
return r; return r;
......
...@@ -418,7 +418,7 @@ static int uvd_v7_0_sw_init(void *handle) ...@@ -418,7 +418,7 @@ static int uvd_v7_0_sw_init(void *handle)
ring = &adev->uvd.ring_enc[0]; ring = &adev->uvd.ring_enc[0];
rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL]; rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL];
r = amd_sched_entity_init(&ring->sched, &adev->uvd.entity_enc, r = amd_sched_entity_init(&ring->sched, &adev->uvd.entity_enc,
rq, amdgpu_sched_jobs); rq, amdgpu_sched_jobs, NULL);
if (r) { if (r) {
DRM_ERROR("Failed setting up UVD ENC run queue.\n"); DRM_ERROR("Failed setting up UVD ENC run queue.\n");
return r; return r;
......
...@@ -121,7 +121,7 @@ amd_sched_rq_select_entity(struct amd_sched_rq *rq) ...@@ -121,7 +121,7 @@ amd_sched_rq_select_entity(struct amd_sched_rq *rq)
int amd_sched_entity_init(struct amd_gpu_scheduler *sched, int amd_sched_entity_init(struct amd_gpu_scheduler *sched,
struct amd_sched_entity *entity, struct amd_sched_entity *entity,
struct amd_sched_rq *rq, struct amd_sched_rq *rq,
uint32_t jobs) uint32_t jobs, atomic_t *guilty)
{ {
int r; int r;
...@@ -132,6 +132,7 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched, ...@@ -132,6 +132,7 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched,
INIT_LIST_HEAD(&entity->list); INIT_LIST_HEAD(&entity->list);
entity->rq = rq; entity->rq = rq;
entity->sched = sched; entity->sched = sched;
entity->guilty = guilty;
spin_lock_init(&entity->rq_lock); spin_lock_init(&entity->rq_lock);
spin_lock_init(&entity->queue_lock); spin_lock_init(&entity->queue_lock);
......
...@@ -63,6 +63,7 @@ struct amd_sched_entity { ...@@ -63,6 +63,7 @@ struct amd_sched_entity {
struct dma_fence *dependency; struct dma_fence *dependency;
struct dma_fence_cb cb; struct dma_fence_cb cb;
atomic_t *guilty; /* points to ctx's guilty */
}; };
/** /**
...@@ -155,7 +156,7 @@ void amd_sched_fini(struct amd_gpu_scheduler *sched); ...@@ -155,7 +156,7 @@ void amd_sched_fini(struct amd_gpu_scheduler *sched);
int amd_sched_entity_init(struct amd_gpu_scheduler *sched, int amd_sched_entity_init(struct amd_gpu_scheduler *sched,
struct amd_sched_entity *entity, struct amd_sched_entity *entity,
struct amd_sched_rq *rq, struct amd_sched_rq *rq,
uint32_t jobs); uint32_t jobs, atomic_t* guilty);
void amd_sched_entity_fini(struct amd_gpu_scheduler *sched, void amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
struct amd_sched_entity *entity); struct amd_sched_entity *entity);
void amd_sched_entity_push_job(struct amd_sched_job *sched_job); void amd_sched_entity_push_job(struct amd_sched_job *sched_job);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment