linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/msm: Remove unused global fault counter
@ 2025-07-14 23:08 Maíra Canal
  2025-07-15  0:31 ` Rob Clark
  0 siblings, 1 reply; 2+ messages in thread
From: Maíra Canal @ 2025-07-14 23:08 UTC (permalink / raw)
  To: Rob Clark, Sean Paul, Konrad Dybcio, Dmitry Baryshkov
  Cc: dri-devel, linux-arm-msm, freedreno, kernel-dev, Maíra Canal

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.

Hence, remove the global faults counter. While here, s/unusuable/unusable.

Signed-off-by: Maíra Canal <mcanal@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/msm: Remove unused global fault counter
  2025-07-14 23:08 [PATCH] drm/msm: Remove unused global fault counter Maíra Canal
@ 2025-07-15  0:31 ` Rob Clark
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Clark @ 2025-07-15  0:31 UTC (permalink / raw)
  To: Maíra Canal
  Cc: Sean Paul, Konrad Dybcio, Dmitry Baryshkov, dri-devel,
	linux-arm-msm, freedreno, kernel-dev

On Mon, Jul 14, 2025 at 4:08 PM Maíra Canal <mcanal@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@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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-15  0:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 23:08 [PATCH] drm/msm: Remove unused global fault counter Maíra Canal
2025-07-15  0:31 ` Rob Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).