Skip to contentSkip to conversation

Patch "drm/vc4: Use runtime autosuspend to avoid thrashing V3D power state." has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Mar 22, 2017

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

drm/vc4: Use runtime autosuspend to avoid thrashing V3D power state.

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drm-vc4-use-runtime-autosuspend-to-avoid-thrashing-v3d-power-state.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 3a62234680d86efa0239665ed8a0e908f1aef147 Mon Sep 17 00:00:00 2001

From: Eric Anholt <[email protected]>
Date: Fri, 4 Nov 2016 15:58:38 -0700
Subject: drm/vc4: Use runtime autosuspend to avoid thrashing V3D power state.

From: Eric Anholt <[email protected]>

commit 3a62234680d86efa0239665ed8a0e908f1aef147 upstream.

The pm_runtime_put() we were using immediately released power on the device, which meant that we were generally turning the device off and on once per frame. In many profiles I've looked at, that added up to about 1% of CPU time, but this could get worse in the case of frequent rendering and readback (as may happen in X rendering). By keeping the device on until we've been idle for a couple of frames, we drop the overhead of runtime PM down to sub-.1%.

---
 drivers/gpu/drm/vc4/vc4_drv.c |    9 ++++++---
 drivers/gpu/drm/vc4/vc4_gem.c |    6 ++++--
 drivers/gpu/drm/vc4/vc4_v3d.c |    2 ++
 3 files changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/vc4/vc4_drv.c +6 -3
@@ -61,21 +61,24 @@ static int vc4_get_param_ioctl(struct dr
 		if (ret < 0)
 			return ret;
 		args->value = V3D_READ(V3D_IDENT0);
-		pm_runtime_put(&vc4->v3d->pdev->dev);
+		pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev);
+		pm_runtime_put_autosuspend(&vc4->v3d->pdev->dev);
 		break;
 	case DRM_VC4_PARAM_V3D_IDENT1:
 		ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev);
 		if (ret < 0)
 			return ret;
 		args->value = V3D_READ(V3D_IDENT1);
-		pm_runtime_put(&vc4->v3d->pdev->dev);
+		pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev);
+		pm_runtime_put_autosuspend(&vc4->v3d->pdev->dev);
 		break;
 	case DRM_VC4_PARAM_V3D_IDENT2:
 		ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev);
 		if (ret < 0)
 			return ret;
 		args->value = V3D_READ(V3D_IDENT2);
-		pm_runtime_put(&vc4->v3d->pdev->dev);
+		pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev);
+		pm_runtime_put_autosuspend(&vc4->v3d->pdev->dev);
 		break;
 	case DRM_VC4_PARAM_SUPPORTS_BRANCHES:
 		args->value = true;
drivers/gpu/drm/vc4/vc4_gem.c +4 -2
@@ -711,8 +711,10 @@ vc4_complete_exec(struct drm_device *dev
 	}
 
 	mutex_lock(&vc4->power_lock);
-	if (--vc4->power_refcount == 0)
-		pm_runtime_put(&vc4->v3d->pdev->dev);
+	if (--vc4->power_refcount == 0) {
+		pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev);
+		pm_runtime_put_autosuspend(&vc4->v3d->pdev->dev);
+	}
 	mutex_unlock(&vc4->power_lock);
 
 	kfree(exec);
drivers/gpu/drm/vc4/vc4_v3d.c +2 -0
@@ -222,6 +222,8 @@ static int vc4_v3d_bind(struct device *d
 		return ret;
 	}
 
+	pm_runtime_use_autosuspend(dev);
+	pm_runtime_set_autosuspend_delay(dev, 40); /* a little over 2 frames. */
 	pm_runtime_enable(dev);
 
 	return 0;

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/drm-vc4-fix-termination-of-the-initial-scan-for-branch-targets.patch queue-4.9/drm-vc4-use-runtime-autosuspend-to-avoid-thrashing-v3d-power-state.patch