Skip to contentSkip to conversation

drm/msm: Remove unused global fault counter

PATCH In review Maíra Canal 2 participants 2 messages Jul 14, 2025 – Jul 15, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm: Remove unused global fault counter

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.

---
 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(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.c +1 -4
index f1230465bf0d..5bb00b9c998a 100644
@@ -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;
drivers/gpu/drm/msm/msm_gpu.c +11 -12
index c317b25a8162..3d5a76d2901c 100644
@@ -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);
 
drivers/gpu/drm/msm/msm_gpu.h +0 -6
index b2a96544f92a..88d8ddef616b 100644
@@ -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;
 
Signature · 1 line
2.50.0
#1 lore raw
Quoted 6 lines · 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.

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

Quoted 89 lines

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

---
 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(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.c +1 -4
index f1230465bf0d..5bb00b9c998a 100644
@@ -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;
drivers/gpu/drm/msm/msm_gpu.c +11 -12
index c317b25a8162..3d5a76d2901c 100644
@@ -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);
 
drivers/gpu/drm/msm/msm_gpu.h +0 -7
index b2a96544f92a..88d8ddef616b 100644
@@ -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