diff options
author | Christian König <christian.koenig@amd.com> | 2018-08-01 10:22:39 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-08-27 12:10:00 -0400 |
commit | 7febe4bfd5d477eba17f70d4879cb81e9787118e (patch) | |
tree | 7c07b3718b09b1eabfe07b116147e3bb201b57c5 | |
parent | bf9b1d9dc7e99bb1395deb0ed0df3999ea527de3 (diff) |
drm/scheduler: fix setting the priorty for entities (v2)
Since we now deal with multiple rq we need to update all of them, not
just the current one.
v2: Trivial: Removed unused variable (Alex)
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/scheduler/gpu_scheduler.c | 36 | ||||
-rw-r--r-- | include/drm/gpu_scheduler.h | 5 |
3 files changed, 26 insertions, 19 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index df6965761046..02d563cfb4a7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -394,7 +394,6 @@ void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx, | |||
394 | { | 394 | { |
395 | int i; | 395 | int i; |
396 | struct amdgpu_device *adev = ctx->adev; | 396 | struct amdgpu_device *adev = ctx->adev; |
397 | struct drm_sched_rq *rq; | ||
398 | struct drm_sched_entity *entity; | 397 | struct drm_sched_entity *entity; |
399 | struct amdgpu_ring *ring; | 398 | struct amdgpu_ring *ring; |
400 | enum drm_sched_priority ctx_prio; | 399 | enum drm_sched_priority ctx_prio; |
@@ -407,12 +406,11 @@ void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx, | |||
407 | for (i = 0; i < adev->num_rings; i++) { | 406 | for (i = 0; i < adev->num_rings; i++) { |
408 | ring = adev->rings[i]; | 407 | ring = adev->rings[i]; |
409 | entity = &ctx->rings[i].entity; | 408 | entity = &ctx->rings[i].entity; |
410 | rq = &ring->sched.sched_rq[ctx_prio]; | ||
411 | 409 | ||
412 | if (ring->funcs->type == AMDGPU_RING_TYPE_KIQ) | 410 | if (ring->funcs->type == AMDGPU_RING_TYPE_KIQ) |
413 | continue; | 411 | continue; |
414 | 412 | ||
415 | drm_sched_entity_set_rq(entity, rq); | 413 | drm_sched_entity_set_priority(entity, ctx_prio); |
416 | } | 414 | } |
417 | } | 415 | } |
418 | 416 | ||
diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c index 08fa5b65acaf..695a9643f046 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c | |||
@@ -416,29 +416,39 @@ static void drm_sched_entity_clear_dep(struct dma_fence *f, struct dma_fence_cb | |||
416 | } | 416 | } |
417 | 417 | ||
418 | /** | 418 | /** |
419 | * drm_sched_entity_set_rq - Sets the run queue for an entity | 419 | * drm_sched_entity_set_rq_priority - helper for drm_sched_entity_set_priority |
420 | */ | ||
421 | static void drm_sched_entity_set_rq_priority(struct drm_sched_rq **rq, | ||
422 | enum drm_sched_priority priority) | ||
423 | { | ||
424 | *rq = &(*rq)->sched->sched_rq[priority]; | ||
425 | } | ||
426 | |||
427 | /** | ||
428 | * drm_sched_entity_set_priority - Sets priority of the entity | ||
420 | * | 429 | * |
421 | * @entity: scheduler entity | 430 | * @entity: scheduler entity |
422 | * @rq: scheduler run queue | 431 | * @priority: scheduler priority |
423 | * | 432 | * |
424 | * Sets the run queue for an entity and removes the entity from the previous | 433 | * Update the priority of runqueus used for the entity. |
425 | * run queue in which was present. | ||
426 | */ | 434 | */ |
427 | void drm_sched_entity_set_rq(struct drm_sched_entity *entity, | 435 | void drm_sched_entity_set_priority(struct drm_sched_entity *entity, |
428 | struct drm_sched_rq *rq) | 436 | enum drm_sched_priority priority) |
429 | { | 437 | { |
430 | if (entity->rq == rq) | 438 | unsigned int i; |
431 | return; | ||
432 | |||
433 | BUG_ON(!rq); | ||
434 | 439 | ||
435 | spin_lock(&entity->rq_lock); | 440 | spin_lock(&entity->rq_lock); |
441 | |||
442 | for (i = 0; i < entity->num_rq_list; ++i) | ||
443 | drm_sched_entity_set_rq_priority(&entity->rq_list[i], priority); | ||
444 | |||
436 | drm_sched_rq_remove_entity(entity->rq, entity); | 445 | drm_sched_rq_remove_entity(entity->rq, entity); |
437 | entity->rq = rq; | 446 | drm_sched_entity_set_rq_priority(&entity->rq, priority); |
438 | drm_sched_rq_add_entity(rq, entity); | 447 | drm_sched_rq_add_entity(entity->rq, entity); |
448 | |||
439 | spin_unlock(&entity->rq_lock); | 449 | spin_unlock(&entity->rq_lock); |
440 | } | 450 | } |
441 | EXPORT_SYMBOL(drm_sched_entity_set_rq); | 451 | EXPORT_SYMBOL(drm_sched_entity_set_priority); |
442 | 452 | ||
443 | /** | 453 | /** |
444 | * drm_sched_dependency_optimized | 454 | * drm_sched_dependency_optimized |
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 0c4cfe689d4c..22c0f88f7d8f 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h | |||
@@ -298,9 +298,8 @@ void drm_sched_entity_fini(struct drm_sched_entity *entity); | |||
298 | void drm_sched_entity_destroy(struct drm_sched_entity *entity); | 298 | void drm_sched_entity_destroy(struct drm_sched_entity *entity); |
299 | void drm_sched_entity_push_job(struct drm_sched_job *sched_job, | 299 | void drm_sched_entity_push_job(struct drm_sched_job *sched_job, |
300 | struct drm_sched_entity *entity); | 300 | struct drm_sched_entity *entity); |
301 | void drm_sched_entity_set_rq(struct drm_sched_entity *entity, | 301 | void drm_sched_entity_set_priority(struct drm_sched_entity *entity, |
302 | struct drm_sched_rq *rq); | 302 | enum drm_sched_priority priority); |
303 | |||
304 | struct drm_sched_fence *drm_sched_fence_create( | 303 | struct drm_sched_fence *drm_sched_fence_create( |
305 | struct drm_sched_entity *s_entity, void *owner); | 304 | struct drm_sched_entity *s_entity, void *owner); |
306 | void drm_sched_fence_scheduled(struct drm_sched_fence *fence); | 305 | void drm_sched_fence_scheduled(struct drm_sched_fence *fence); |