drm/sched: Fix entities with 0 rqs.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 30 Jan 2019 01:53:19 +0000 (02:53 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 15 Feb 2019 16:15:08 +0000 (11:15 -0500)
commit1decbf6bb0b4dc56c9da6c5e57b994ebfc2be3aa
tree1d357e57e9295e264591c03261b36dadaa36d0a8
parent7a5e0d9ab6d9564f5f82d7a16355118aadd25ef8
drm/sched: Fix entities with 0 rqs.

Some blocks in amdgpu can have 0 rqs.

Job creation already fails with -ENOENT when entity->rq is NULL,
so jobs cannot be pushed. Without a rq there is no scheduler to
pop jobs, and rq selection already does the right thing with a
list of length 0.

So the operations we need to fix are:
  - Creation, do not set rq to rq_list[0] if the list can have length 0.
  - Do not flush any jobs when there is no rq.
  - On entity destruction handle the rq = NULL case.
  - on set_priority, do not try to change the rq if it is NULL.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/scheduler/sched_entity.c