[PATCH] drm/msm: Remove unused global fault counter

Rob Clark rob.clark at oss.qualcomm.com
Tue Jul 15 00:31:26 UTC 2025


On Mon, Jul 14, 2025 at 4:08 PM Maíra Canal <mcanal at igalia.com> wrote:
>
> The global fault counter is no longer used since commit 12578c075f89
> ("drm/msm/gpu: Skip retired submits in recover worker"). Additionally,
> with commit eab7766c79fd ("drm/msm: Remove vram carveout support"), all
> supported devices now have a defined virtual memory address space, which
> eliminates the need for a global fault counter.

Hmm, I think commit 12578c075f89 ("drm/msm/gpu: Skip retired submits
in recover worker") was wrong, now that you point it out.  We could
still have situations where we get a fault after the faulting process
has ended.  In that case get_pid_task() would return NULL.

BR,
-R

>
> Hence, remove the global faults counter. While here, s/unusuable/unusable.
>
> Signed-off-by: Maíra Canal <mcanal at igalia.com>
> ---
>  drivers/gpu/drm/msm/adreno/adreno_gpu.c |  5 +----
>  drivers/gpu/drm/msm/msm_gpu.c           | 23 +++++++++++------------
>  drivers/gpu/drm/msm/msm_gpu.h           |  6 ------
>  3 files changed, 12 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index f1230465bf0d..5bb00b9c998a 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -416,10 +416,7 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_context *ctx,
>                 *value = 0;
>                 return 0;
>         case MSM_PARAM_FAULTS:
> -               if (vm)
> -                       *value = gpu->global_faults + to_msm_vm(vm)->faults;
> -               else
> -                       *value = gpu->global_faults;
> +               *value = vm ? to_msm_vm(vm)->faults : 0;
>                 return 0;
>         case MSM_PARAM_SUSPENDS:
>                 *value = gpu->suspend_count;
> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> index c317b25a8162..3d5a76d2901c 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.c
> +++ b/drivers/gpu/drm/msm/msm_gpu.c
> @@ -463,6 +463,7 @@ static void recover_worker(struct kthread_work *work)
>         struct drm_device *dev = gpu->dev;
>         struct msm_drm_private *priv = dev->dev_private;
>         struct msm_gem_submit *submit;
> +       struct msm_gem_vm *vm;
>         struct msm_ringbuffer *cur_ring = gpu->funcs->active_ring(gpu);
>         char *comm = NULL, *cmd = NULL;
>         int i;
> @@ -482,20 +483,18 @@ static void recover_worker(struct kthread_work *work)
>
>         /* Increment the fault counts */
>         submit->queue->faults++;
> -       if (submit->vm) {
> -               struct msm_gem_vm *vm = to_msm_vm(submit->vm);
>
> -               vm->faults++;
> +       vm = to_msm_vm(submit->vm);
> +       vm->faults++;
>
> -               /*
> -                * If userspace has opted-in to VM_BIND (and therefore userspace
> -                * management of the VM), faults mark the VM as unusuable.  This
> -                * matches vulkan expectations (vulkan is the main target for
> -                * VM_BIND)
> -                */
> -               if (!vm->managed)
> -                       msm_gem_vm_unusable(submit->vm);
> -       }
> +       /*
> +        * If userspace has opted-in to VM_BIND (and therefore userspace
> +        * management of the VM), faults mark the VM as unusable. This
> +        * matches vulkan expectations (vulkan is the main target for
> +        * VM_BIND)
> +        */
> +       if (!vm->managed)
> +               msm_gem_vm_unusable(submit->vm);
>
>         get_comm_cmdline(submit, &comm, &cmd);
>
> diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
> index b2a96544f92a..88d8ddef616b 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.h
> +++ b/drivers/gpu/drm/msm/msm_gpu.h
> @@ -226,12 +226,6 @@ struct msm_gpu {
>         /* does gpu need hw_init? */
>         bool needs_hw_init;
>
> -       /**
> -        * global_faults: number of GPU hangs not attributed to a particular
> -        * address space
> -        */
> -       int global_faults;
> -
>         void __iomem *mmio;
>         int irq;
>
> --
> 2.50.0
>


More information about the dri-devel mailing list