[Nouveau] [PATCH] drm: fix issue by messing up runpm usage_counter

Karol Herbst nouveau at karolherbst.de
Sat Nov 7 01:42:08 PST 2015


I have the issue when loading nouveau with runpm=0 set, that further nouveau
loads without runpm set or runpm=1 don't put the card into sleep state.

This is caused by calling pm_runtime_get_sync in drm_device.unload when the
usage_counter isn't 0. pm_runtime_get_sync always increases the suage_counter
and so the usage_counter gets increased allthough runpm=0 is set, meaning
nouveau leaves the device with a +1 usage_counter after unload.

This patch fixes that allowing me to load nouveau later with runpm=1 so, that
the device is put into sleep state.

---
 drm/nouveau/nouveau_drm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drm/nouveau/nouveau_drm.c b/drm/nouveau/nouveau_drm.c
index 5b1746b..2aaf9fe 100644
--- a/drm/nouveau/nouveau_drm.c
+++ b/drm/nouveau/nouveau_drm.c
@@ -481,7 +481,8 @@ nouveau_drm_unload(struct drm_device *dev)
 {
 	struct nouveau_drm *drm = nouveau_drm(dev);
 
-	pm_runtime_get_sync(dev->dev);
+	if (atomic_read(&dev->dev->power.usage_count) == 0)
+		pm_runtime_get_sync(dev->dev);
 	nouveau_fbcon_fini(dev);
 	nouveau_accel_fini(drm);
 	nouveau_hwmon_fini(dev);
-- 
2.6.3



More information about the Nouveau mailing list