Re: [PATCH drm-misc-next 2/2] drm/nouveau: enable dynamic job-flow control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 14 Nov 2023 at 10:27, Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>
> Make use of the scheduler's credit limit and scheduler job's credit
> count to account for the actual size of a job, such that we fill up the
> ring efficiently.

For the two:

Reviewed-by: Dave Airlie <airlied@xxxxxxxxxx>

>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/nouveau/nouveau_abi16.c | 3 ++-
>  drivers/gpu/drm/nouveau/nouveau_drm.c   | 2 +-
>  drivers/gpu/drm/nouveau/nouveau_exec.c  | 4 +++-
>  drivers/gpu/drm/nouveau/nouveau_sched.c | 9 ++++-----
>  drivers/gpu/drm/nouveau/nouveau_sched.h | 3 ++-
>  drivers/gpu/drm/nouveau/nouveau_uvmm.c  | 4 +++-
>  6 files changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
> index f8e59cfb1d34..207945700c94 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
> @@ -316,7 +316,8 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
>         if (ret)
>                 goto done;
>
> -       ret = nouveau_sched_init(&chan->sched, drm, drm->sched_wq);
> +       ret = nouveau_sched_init(&chan->sched, drm, drm->sched_wq,
> +                                chan->chan->dma.ib_max);
>         if (ret)
>                 goto done;
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 7e5f19153829..6f6c31a9937b 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -320,7 +320,7 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
>          * locks which indirectly or directly are held for allocations
>          * elsewhere.
>          */
> -       ret = nouveau_sched_init(&cli->sched, drm, NULL);
> +       ret = nouveau_sched_init(&cli->sched, drm, NULL, 1);
>         if (ret)
>                 goto done;
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_exec.c b/drivers/gpu/drm/nouveau/nouveau_exec.c
> index 388831c53551..63c344f4f78e 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_exec.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_exec.c
> @@ -258,10 +258,12 @@ nouveau_exec_job_init(struct nouveau_exec_job **pjob,
>                 }
>         }
>
> +       args.file_priv = __args->file_priv;
>         job->chan = __args->chan;
>
>         args.sched = __args->sched;
> -       args.file_priv = __args->file_priv;
> +       /* Plus one to account for the HW fence. */
> +       args.credits = job->push.count + 1;
>
>         args.in_sync.count = __args->in_sync.count;
>         args.in_sync.s = __args->in_sync.s;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_sched.c b/drivers/gpu/drm/nouveau/nouveau_sched.c
> index faabd662b165..6406d6659361 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_sched.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_sched.c
> @@ -12,7 +12,6 @@
>  #include "nouveau_abi16.h"
>  #include "nouveau_sched.h"
>
> -#define NOUVEAU_SCHED_HW_SUBMISSIONS           1
>  #define NOUVEAU_SCHED_JOB_TIMEOUT_MS           10000
>
>  /* Starts at 0, since the DRM scheduler interprets those parameters as (initial)
> @@ -85,10 +84,10 @@ nouveau_job_init(struct nouveau_job *job,
>                         ret = -ENOMEM;
>                         goto err_free_objs;
>                 }
> -
>         }
>
> -       ret = drm_sched_job_init(&job->base, &sched->entity, 1, NULL);
> +       ret = drm_sched_job_init(&job->base, &sched->entity,
> +                                args->credits, NULL);
>         if (ret)
>                 goto err_free_chains;
>
> @@ -396,7 +395,7 @@ static const struct drm_sched_backend_ops nouveau_sched_ops = {
>
>  int
>  nouveau_sched_init(struct nouveau_sched *sched, struct nouveau_drm *drm,
> -                  struct workqueue_struct *wq)
> +                  struct workqueue_struct *wq, u32 credit_limit)
>  {
>         struct drm_gpu_scheduler *drm_sched = &sched->base;
>         struct drm_sched_entity *entity = &sched->entity;
> @@ -414,7 +413,7 @@ nouveau_sched_init(struct nouveau_sched *sched, struct nouveau_drm *drm,
>
>         ret = drm_sched_init(drm_sched, &nouveau_sched_ops, wq,
>                              NOUVEAU_SCHED_PRIORITY_COUNT,
> -                            NOUVEAU_SCHED_HW_SUBMISSIONS, 0, job_hang_limit,
> +                            credit_limit, 0, job_hang_limit,
>                              NULL, NULL, "nouveau_sched", drm->dev->dev);
>         if (ret)
>                 goto fail_wq;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_sched.h b/drivers/gpu/drm/nouveau/nouveau_sched.h
> index 026f33d9b70c..7ba8ffec135a 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_sched.h
> +++ b/drivers/gpu/drm/nouveau/nouveau_sched.h
> @@ -27,6 +27,7 @@ enum nouveau_job_state {
>  struct nouveau_job_args {
>         struct drm_file *file_priv;
>         struct nouveau_sched *sched;
> +       u32 credits;
>
>         enum dma_resv_usage resv_usage;
>         bool sync;
> @@ -112,7 +113,7 @@ struct nouveau_sched {
>  };
>
>  int nouveau_sched_init(struct nouveau_sched *sched, struct nouveau_drm *drm,
> -                      struct workqueue_struct *wq);
> +                      struct workqueue_struct *wq, u32 credit_limit);
>  void nouveau_sched_fini(struct nouveau_sched *sched);
>
>  #endif
> diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
> index c95186b34ea0..708cd5f43cb9 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
> @@ -1606,9 +1606,11 @@ nouveau_uvmm_bind_job_init(struct nouveau_uvmm_bind_job **pjob,
>
>         init_completion(&job->complete);
>
> -       args.sched = __args->sched;
>         args.file_priv = __args->file_priv;
>
> +       args.sched = __args->sched;
> +       args.credits = 1;
> +
>         args.in_sync.count = __args->in_sync.count;
>         args.in_sync.s = __args->in_sync.s;
>
> --
> 2.41.0
>



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux