Re: [PATCH v7 3/6] drm/sched: Convert the GPU scheduler to variable number of run-queues

2023-10-26 Thread Luben Tuikov
Also note that there were no complaints from "kernel test robot 
"
when I posted my patch (this patch), but there is now, which further shows
that there's unwarranted changes. Just follow the steps I outlined below,
and we should all be good.

Thanks!

Regards,
Luben

On 2023-10-26 05:36, Luben Tuikov wrote:
> Hi,
> 
> On 2023-10-26 02:33, kernel test robot wrote:
>> Hi Matthew,
>>
>> kernel test robot noticed the following build warnings:
>>
>> [auto build test WARNING on 201c8a7bd1f3f415920a2df4b8a8817e973f42fe]
>>
>> url:
>> https://github.com/intel-lab-lkp/linux/commits/Matthew-Brost/drm-sched-Add-drm_sched_wqueue_-helpers/20231026-121313
>> base:   201c8a7bd1f3f415920a2df4b8a8817e973f42fe
>> patch link:
>> https://lore.kernel.org/r/20231026041236.1273694-4-matthew.brost%40intel.com
>> patch subject: [PATCH v7 3/6] drm/sched: Convert the GPU scheduler to 
>> variable number of run-queues
>> config: m68k-allyesconfig 
>> (https://download.01.org/0day-ci/archive/20231026/202310261439.3rbateob-...@intel.com/config)
>> compiler: m68k-linux-gcc (GCC) 13.2.0
>> reproduce (this is a W=1 build): 
>> (https://download.01.org/0day-ci/archive/20231026/202310261439.3rbateob-...@intel.com/reproduce)
>>
>> If you fix the issue in a separate patch/commit (i.e. not just a new version 
>> of
>> the same patch/commit), kindly add following tags
>> | Reported-by: kernel test robot 
>> | Closes: 
>> https://lore.kernel.org/oe-kbuild-all/202310261439.3rbateob-...@intel.com/
>>
>> All warnings (new ones prefixed by >>):
>>
>>drivers/gpu/drm/etnaviv/etnaviv_sched.c: In function 'etnaviv_sched_init':
 drivers/gpu/drm/etnaviv/etnaviv_sched.c:138:30: warning: passing argument 
 3 of 'drm_sched_init' makes pointer from integer without a cast 
 [-Wint-conversion]
>>  138 |  DRM_SCHED_PRIORITY_COUNT, NULL,
>>  |  ^~~~
>>  |  |
>>  |  int
>>In file included from drivers/gpu/drm/etnaviv/etnaviv_drv.h:20,
>> from drivers/gpu/drm/etnaviv/etnaviv_sched.c:8:
>>include/drm/gpu_scheduler.h:530:45: note: expected 'struct 
>> workqueue_struct *' but argument is of type 'int'
>>  530 |struct workqueue_struct *submit_wq,
>>  |~^
>>In file included from include/uapi/linux/posix_types.h:5,
>> from include/uapi/linux/types.h:14,
>> from include/linux/types.h:6,
>> from include/linux/kasan-checks.h:5,
>> from include/asm-generic/rwonce.h:26,
>> from ./arch/m68k/include/generated/asm/rwonce.h:1,
>> from include/linux/compiler.h:246,
>> from include/linux/build_bug.h:5,
>> from include/linux/init.h:5,
>> from include/linux/moduleparam.h:5,
>> from drivers/gpu/drm/etnaviv/etnaviv_sched.c:6:
> 
> The reason for this compilation failure is that this patch is completely 
> mangled and nothing like the patch I posted.
> 
> My patch is: 
> https://lore.kernel.org/all/20231023032251.164775-1-luben.tui...@amd.com/
> 
> Save it raw to your disk from this link: 
> https://lore.kernel.org/all/20231023032251.164775-1-luben.tui...@amd.com/raw
> 
> And apply it with "git am " on top of your clean tree, e.g. 
> drm-misc-next. THEN, after that,
> apply your patches.
> 
> It should then compile without any problems.
> 
> Just looking at the first hunk in my patch:
> 
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 2b8356699f235d..251995a90bbe69 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -2280,6 +2280,7 @@ static int amdgpu_device_init_schedulers(struct 
>> amdgpu_device *adev)
>> }
>>  
>> r = drm_sched_init(>sched, _sched_ops,
>> +  DRM_SCHED_PRIORITY_COUNT,
>>ring->num_hw_submission, 0,
>>timeout, adev->reset_domain->wq,
>>ring->sched_score, ring->name,
> 
> While this looks like this in the version you posted of my patch:
> 
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index b54c4d771104..94d073bfbd13 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -2280,6 +2280,7 @@ static int amdgpu_device_init_schedulers(struct 
>> amdgpu_device *adev)
>>  }
>>  
>>  r = drm_sched_init(>sched, _sched_ops, NULL,
>> +   DRM_SCHED_PRIORITY_COUNT,
>> 

Re: [PATCH v7 3/6] drm/sched: Convert the GPU scheduler to variable number of run-queues

2023-10-26 Thread Luben Tuikov
Hi,

On 2023-10-26 02:33, kernel test robot wrote:
> Hi Matthew,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on 201c8a7bd1f3f415920a2df4b8a8817e973f42fe]
> 
> url:
> https://github.com/intel-lab-lkp/linux/commits/Matthew-Brost/drm-sched-Add-drm_sched_wqueue_-helpers/20231026-121313
> base:   201c8a7bd1f3f415920a2df4b8a8817e973f42fe
> patch link:
> https://lore.kernel.org/r/20231026041236.1273694-4-matthew.brost%40intel.com
> patch subject: [PATCH v7 3/6] drm/sched: Convert the GPU scheduler to 
> variable number of run-queues
> config: m68k-allyesconfig 
> (https://download.01.org/0day-ci/archive/20231026/202310261439.3rbateob-...@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): 
> (https://download.01.org/0day-ci/archive/20231026/202310261439.3rbateob-...@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version 
> of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot 
> | Closes: 
> https://lore.kernel.org/oe-kbuild-all/202310261439.3rbateob-...@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>drivers/gpu/drm/etnaviv/etnaviv_sched.c: In function 'etnaviv_sched_init':
>>> drivers/gpu/drm/etnaviv/etnaviv_sched.c:138:30: warning: passing argument 3 
>>> of 'drm_sched_init' makes pointer from integer without a cast 
>>> [-Wint-conversion]
>  138 |  DRM_SCHED_PRIORITY_COUNT, NULL,
>  |  ^~~~
>  |  |
>  |  int
>In file included from drivers/gpu/drm/etnaviv/etnaviv_drv.h:20,
> from drivers/gpu/drm/etnaviv/etnaviv_sched.c:8:
>include/drm/gpu_scheduler.h:530:45: note: expected 'struct 
> workqueue_struct *' but argument is of type 'int'
>  530 |struct workqueue_struct *submit_wq,
>  |~^
>In file included from include/uapi/linux/posix_types.h:5,
> from include/uapi/linux/types.h:14,
> from include/linux/types.h:6,
> from include/linux/kasan-checks.h:5,
> from include/asm-generic/rwonce.h:26,
> from ./arch/m68k/include/generated/asm/rwonce.h:1,
> from include/linux/compiler.h:246,
> from include/linux/build_bug.h:5,
> from include/linux/init.h:5,
> from include/linux/moduleparam.h:5,
> from drivers/gpu/drm/etnaviv/etnaviv_sched.c:6:

The reason for this compilation failure is that this patch is completely 
mangled and nothing like the patch I posted.

My patch is: 
https://lore.kernel.org/all/20231023032251.164775-1-luben.tui...@amd.com/

Save it raw to your disk from this link: 
https://lore.kernel.org/all/20231023032251.164775-1-luben.tui...@amd.com/raw

And apply it with "git am " on top of your clean tree, e.g. 
drm-misc-next. THEN, after that,
apply your patches.

It should then compile without any problems.

Just looking at the first hunk in my patch:

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 2b8356699f235d..251995a90bbe69 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2280,6 +2280,7 @@ static int amdgpu_device_init_schedulers(struct 
> amdgpu_device *adev)
> }
>  
> r = drm_sched_init(>sched, _sched_ops,
> +  DRM_SCHED_PRIORITY_COUNT,
>ring->num_hw_submission, 0,
>timeout, adev->reset_domain->wq,
>ring->sched_score, ring->name,

While this looks like this in the version you posted of my patch:

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index b54c4d771104..94d073bfbd13 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2280,6 +2280,7 @@ static int amdgpu_device_init_schedulers(struct 
> amdgpu_device *adev)
>   }
>  
>   r = drm_sched_init(>sched, _sched_ops, NULL,
> +DRM_SCHED_PRIORITY_COUNT,
>  ring->num_hw_submission, 0,
>  timeout, adev->reset_domain->wq,
>  ring->sched_score, ring->name,

What's that "NULL" doing as the 3rd argument???

And the rest is similarly mangled as well.

Please apply my patch AS IS, no local changes, and then apply your patches on 
top. That should ensure compilation is correct for all,
and a more precise review can be had.

FWIW, we 

Re: [PATCH v7 3/6] drm/sched: Convert the GPU scheduler to variable number of run-queues

2023-10-26 Thread kernel test robot
Hi Matthew,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 201c8a7bd1f3f415920a2df4b8a8817e973f42fe]

url:
https://github.com/intel-lab-lkp/linux/commits/Matthew-Brost/drm-sched-Add-drm_sched_wqueue_-helpers/20231026-121313
base:   201c8a7bd1f3f415920a2df4b8a8817e973f42fe
patch link:
https://lore.kernel.org/r/20231026041236.1273694-4-matthew.brost%40intel.com
patch subject: [PATCH v7 3/6] drm/sched: Convert the GPU scheduler to variable 
number of run-queues
config: m68k-allyesconfig 
(https://download.01.org/0day-ci/archive/20231026/202310261439.3rbateob-...@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20231026/202310261439.3rbateob-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202310261439.3rbateob-...@intel.com/

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/etnaviv/etnaviv_sched.c: In function 'etnaviv_sched_init':
>> drivers/gpu/drm/etnaviv/etnaviv_sched.c:138:30: warning: passing argument 3 
>> of 'drm_sched_init' makes pointer from integer without a cast 
>> [-Wint-conversion]
 138 |  DRM_SCHED_PRIORITY_COUNT, NULL,
 |  ^~~~
 |  |
 |  int
   In file included from drivers/gpu/drm/etnaviv/etnaviv_drv.h:20,
from drivers/gpu/drm/etnaviv/etnaviv_sched.c:8:
   include/drm/gpu_scheduler.h:530:45: note: expected 'struct workqueue_struct 
*' but argument is of type 'int'
 530 |struct workqueue_struct *submit_wq,
 |~^
   In file included from include/uapi/linux/posix_types.h:5,
from include/uapi/linux/types.h:14,
from include/linux/types.h:6,
from include/linux/kasan-checks.h:5,
from include/asm-generic/rwonce.h:26,
from ./arch/m68k/include/generated/asm/rwonce.h:1,
from include/linux/compiler.h:246,
from include/linux/build_bug.h:5,
from include/linux/init.h:5,
from include/linux/moduleparam.h:5,
from drivers/gpu/drm/etnaviv/etnaviv_sched.c:6:
>> include/linux/stddef.h:8:14: warning: passing argument 4 of 'drm_sched_init' 
>> makes integer from pointer without a cast [-Wint-conversion]
   8 | #define NULL ((void *)0)
 |  ^~~
 |  |
 |  void *
   drivers/gpu/drm/etnaviv/etnaviv_sched.c:138:56: note: in expansion of macro 
'NULL'
 138 |  DRM_SCHED_PRIORITY_COUNT, NULL,
 |^~~~
   include/drm/gpu_scheduler.h:531:24: note: expected 'u32' {aka 'unsigned 
int'} but argument is of type 'void *'
 531 |u32 num_rqs, uint32_t hw_submission, unsigned 
hang_limit,
 |^~~
--
   drivers/gpu/drm/lima/lima_sched.c: In function 'lima_sched_pipe_init':
>> drivers/gpu/drm/lima/lima_sched.c:492:31: warning: passing argument 3 of 
>> 'drm_sched_init' makes pointer from integer without a cast [-Wint-conversion]
 492 |   DRM_SCHED_PRIORITY_COUNT, NULL, 1,
 |   ^~~~
 |   |
 |   int
   In file included from drivers/gpu/drm/lima/lima_sched.h:7,
from drivers/gpu/drm/lima/lima_device.h:12,
from drivers/gpu/drm/lima/lima_ctx.h:10,
from drivers/gpu/drm/lima/lima_drv.h:9,
from drivers/gpu/drm/lima/lima_sched.c:11:
   include/drm/gpu_scheduler.h:530:45: note: expected 'struct workqueue_struct 
*' but argument is of type 'int'
 530 |struct workqueue_struct *submit_wq,
 |~^
   In file included from include/uapi/linux/posix_types.h:5,
from include/uapi/linux/types.h:14,
from include/linux/types.h:6,
from include/linux/io.h:9,
from include/linux/iosys-map.h:10,
from drivers/gpu/drm/lima/lima_sched.c:4:
>> include/linux/stddef.h:8:14: warning: passing argument 4 of 'drm_sched_init' 
>> makes integer from pointer without a cast [-Wint-conversion]
   8 | #define NULL ((void *)0)
 |  ^~~
 |  |
 |  void *
   drivers/gpu/drm/lima/lima_sched.c:492:57: 

Re: [PATCH v7 3/6] drm/sched: Convert the GPU scheduler to variable number of run-queues

2023-10-25 Thread Luben Tuikov
On 2023-10-26 00:12, Matthew Brost wrote:
> From: Luben Tuikov 
> 
> The GPU scheduler has now a variable number of run-queues, which are set up at
> drm_sched_init() time. This way, each driver announces how many run-queues it
> requires (supports) per each GPU scheduler it creates. Note, that run-queues
> correspond to scheduler "priorities", thus if the number of run-queues is set
> to 1 at drm_sched_init(), then that scheduler supports a single run-queue,
> i.e. single "priority". If a driver further sets a single entity per
> run-queue, then this creates a 1-to-1 correspondence between a scheduler and
> a scheduled entity.
> 
> Cc: Lucas Stach 
> Cc: Russell King 
> Cc: Qiang Yu 
> Cc: Rob Clark 
> Cc: Abhinav Kumar 
> Cc: Dmitry Baryshkov 
> Cc: Danilo Krummrich 
> Cc: Matthew Brost 
> Cc: Boris Brezillon 
> Cc: Alex Deucher 
> Cc: Christian König 
> Cc: Emma Anholt 
> Cc: etna...@lists.freedesktop.org
> Cc: l...@lists.freedesktop.org
> Cc: linux-arm-...@vger.kernel.org
> Cc: freedr...@lists.freedesktop.org
> Cc: nouv...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Luben Tuikov 
> Signed-off-by: Matthew Brost 

Normally, you'd add your R-B.

You should add your S-O-B tag, if you've co-authored/contributed to the commit
or are the actual committer to drm-*, as "dim" requires it, but dim will tell 
you,
so generally, I don't do that unless the tool tells me to. :-) 

So here, feel free to R-B the patch instead of S-O-B, on a patch post.

Regards,
Luben

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c|  4 +-
>  drivers/gpu/drm/etnaviv/etnaviv_sched.c|  3 +-
>  drivers/gpu/drm/lima/lima_sched.c  |  3 +-
>  drivers/gpu/drm/msm/msm_ringbuffer.c   |  3 +-
>  drivers/gpu/drm/nouveau/nouveau_sched.c|  1 +
>  drivers/gpu/drm/panfrost/panfrost_job.c|  3 +-
>  drivers/gpu/drm/scheduler/sched_entity.c   | 18 +-
>  drivers/gpu/drm/scheduler/sched_main.c | 75 ++
>  drivers/gpu/drm/v3d/v3d_sched.c| 14 ++--
>  include/drm/gpu_scheduler.h|  9 ++-
>  11 files changed, 102 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index b54c4d771104..94d073bfbd13 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2280,6 +2280,7 @@ static int amdgpu_device_init_schedulers(struct 
> amdgpu_device *adev)
>   }
>  
>   r = drm_sched_init(>sched, _sched_ops, NULL,
> +DRM_SCHED_PRIORITY_COUNT,
>  ring->num_hw_submission, 0,
>  timeout, adev->reset_domain->wq,
>  ring->sched_score, ring->name,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index 78476bc75b4e..1f357198533f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -325,8 +325,8 @@ void amdgpu_job_stop_all_jobs_on_sched(struct 
> drm_gpu_scheduler *sched)
>   int i;
>  
>   /* Signal all jobs not yet scheduled */
> - for (i = DRM_SCHED_PRIORITY_COUNT - 1; i >= DRM_SCHED_PRIORITY_MIN; 
> i--) {
> - struct drm_sched_rq *rq = >sched_rq[i];
> + for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_MIN; i--) {
> + struct drm_sched_rq *rq = sched->sched_rq[i];
>   spin_lock(>lock);
>   list_for_each_entry(s_entity, >entities, list) {
>   while ((s_job = 
> to_drm_sched_job(spsc_queue_pop(_entity->job_queue {
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c 
> b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> index 618a804ddc34..396334984e4d 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> @@ -134,7 +134,8 @@ int etnaviv_sched_init(struct etnaviv_gpu *gpu)
>  {
>   int ret;
>  
> - ret = drm_sched_init(>sched, _sched_ops, NULL,
> + ret = drm_sched_init(>sched, _sched_ops,
> +  DRM_SCHED_PRIORITY_COUNT, NULL,
>etnaviv_hw_jobs_limit, etnaviv_job_hang_limit,
>msecs_to_jiffies(500), NULL, NULL,
>dev_name(gpu->dev), gpu->dev);
> diff --git a/drivers/gpu/drm/lima/lima_sched.c 
> b/drivers/gpu/drm/lima/lima_sched.c
> index 8d858aed0e56..23a6276f1332 100644
> --- a/drivers/gpu/drm/lima/lima_sched.c
> +++ b/drivers/gpu/drm/lima/lima_sched.c
> @@ -488,7 +488,8 @@ int lima_sched_pipe_init(struct lima_sched_pipe *pipe, 
> const char *name)
>  
>   INIT_WORK(>recover_work, lima_sched_recover_work);
>  
> - return drm_sched_init(>base, _sched_ops, NULL, 1,
> + return drm_sched_init(>base, _sched_ops,
> +   

[PATCH v7 3/6] drm/sched: Convert the GPU scheduler to variable number of run-queues

2023-10-25 Thread Matthew Brost
From: Luben Tuikov 

The GPU scheduler has now a variable number of run-queues, which are set up at
drm_sched_init() time. This way, each driver announces how many run-queues it
requires (supports) per each GPU scheduler it creates. Note, that run-queues
correspond to scheduler "priorities", thus if the number of run-queues is set
to 1 at drm_sched_init(), then that scheduler supports a single run-queue,
i.e. single "priority". If a driver further sets a single entity per
run-queue, then this creates a 1-to-1 correspondence between a scheduler and
a scheduled entity.

Cc: Lucas Stach 
Cc: Russell King 
Cc: Qiang Yu 
Cc: Rob Clark 
Cc: Abhinav Kumar 
Cc: Dmitry Baryshkov 
Cc: Danilo Krummrich 
Cc: Matthew Brost 
Cc: Boris Brezillon 
Cc: Alex Deucher 
Cc: Christian König 
Cc: Emma Anholt 
Cc: etna...@lists.freedesktop.org
Cc: l...@lists.freedesktop.org
Cc: linux-arm-...@vger.kernel.org
Cc: freedr...@lists.freedesktop.org
Cc: nouv...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Luben Tuikov 
Signed-off-by: Matthew Brost 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c|  4 +-
 drivers/gpu/drm/etnaviv/etnaviv_sched.c|  3 +-
 drivers/gpu/drm/lima/lima_sched.c  |  3 +-
 drivers/gpu/drm/msm/msm_ringbuffer.c   |  3 +-
 drivers/gpu/drm/nouveau/nouveau_sched.c|  1 +
 drivers/gpu/drm/panfrost/panfrost_job.c|  3 +-
 drivers/gpu/drm/scheduler/sched_entity.c   | 18 +-
 drivers/gpu/drm/scheduler/sched_main.c | 75 ++
 drivers/gpu/drm/v3d/v3d_sched.c| 14 ++--
 include/drm/gpu_scheduler.h|  9 ++-
 11 files changed, 102 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index b54c4d771104..94d073bfbd13 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2280,6 +2280,7 @@ static int amdgpu_device_init_schedulers(struct 
amdgpu_device *adev)
}
 
r = drm_sched_init(>sched, _sched_ops, NULL,
+  DRM_SCHED_PRIORITY_COUNT,
   ring->num_hw_submission, 0,
   timeout, adev->reset_domain->wq,
   ring->sched_score, ring->name,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index 78476bc75b4e..1f357198533f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -325,8 +325,8 @@ void amdgpu_job_stop_all_jobs_on_sched(struct 
drm_gpu_scheduler *sched)
int i;
 
/* Signal all jobs not yet scheduled */
-   for (i = DRM_SCHED_PRIORITY_COUNT - 1; i >= DRM_SCHED_PRIORITY_MIN; 
i--) {
-   struct drm_sched_rq *rq = >sched_rq[i];
+   for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_MIN; i--) {
+   struct drm_sched_rq *rq = sched->sched_rq[i];
spin_lock(>lock);
list_for_each_entry(s_entity, >entities, list) {
while ((s_job = 
to_drm_sched_job(spsc_queue_pop(_entity->job_queue {
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c 
b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
index 618a804ddc34..396334984e4d 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
@@ -134,7 +134,8 @@ int etnaviv_sched_init(struct etnaviv_gpu *gpu)
 {
int ret;
 
-   ret = drm_sched_init(>sched, _sched_ops, NULL,
+   ret = drm_sched_init(>sched, _sched_ops,
+DRM_SCHED_PRIORITY_COUNT, NULL,
 etnaviv_hw_jobs_limit, etnaviv_job_hang_limit,
 msecs_to_jiffies(500), NULL, NULL,
 dev_name(gpu->dev), gpu->dev);
diff --git a/drivers/gpu/drm/lima/lima_sched.c 
b/drivers/gpu/drm/lima/lima_sched.c
index 8d858aed0e56..23a6276f1332 100644
--- a/drivers/gpu/drm/lima/lima_sched.c
+++ b/drivers/gpu/drm/lima/lima_sched.c
@@ -488,7 +488,8 @@ int lima_sched_pipe_init(struct lima_sched_pipe *pipe, 
const char *name)
 
INIT_WORK(>recover_work, lima_sched_recover_work);
 
-   return drm_sched_init(>base, _sched_ops, NULL, 1,
+   return drm_sched_init(>base, _sched_ops,
+ DRM_SCHED_PRIORITY_COUNT, NULL, 1,
  lima_job_hang_limit,
  msecs_to_jiffies(timeout), NULL,
  NULL, name, pipe->ldev->dev);
diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c 
b/drivers/gpu/drm/msm/msm_ringbuffer.c
index 1097f8e93d6b..935154979fc2 100644
--- a/drivers/gpu/drm/msm/msm_ringbuffer.c
+++ b/drivers/gpu/drm/msm/msm_ringbuffer.c
@@ -94,7 +94,8 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu 
*gpu, int id,
 /* currently managing hangcheck ourselves: */