Skip to contentSkip to conversation

drm/radeon/kms/pm: bail early if nothing's changing

PATCH In review Alex Deucher 1 participant 2 messages Aug 13, 2010 – Aug 16, 2010

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

PATCH 1/1 drm/radeon/kms/pm: bail early if nothing's changing

If we aren't changing the power state, no need to take locks and schedule fences, etc.

There seem to be lock ordering issues in the CP and fence code in some cases; see bug 29140 below.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=29140
Possibly also:
https://bugzilla.kernel.org/show_bug.cgi?id=16581

---
 drivers/gpu/drm/radeon/radeon_pm.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_pm.c +5 -0
index a3d25f4..9a8031b 100644
@@ -226,6 +226,11 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
 {
 	int i;
 
+	/* no need to take locks, etc. if nothing's going to change */
+	if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) &&
+	    (rdev->pm.requested_power_state_index == rdev->pm.current_power_state_index))
+		return;
+
 	mutex_lock(&rdev->ddev->struct_mutex);
 	mutex_lock(&rdev->vram_mutex);
 	mutex_lock(&rdev->cp.mutex);
Signature · 1 line
1.7.1.1
#1 lore raw
Quoted 10 lines · Alex Deucher

If we aren't changing the power state, no need to take locks and schedule fences, etc.

There seem to be lock ordering issues in the CP and fence code in some cases; see bug 29140 below.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=29140
Possibly also:
https://bugzilla.kernel.org/show_bug.cgi?id=16581

Also fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=29384

Alex

Quoted 27 lines

---
 drivers/gpu/drm/radeon/radeon_pm.c |    5 +++++

 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_pm.c +5 -1
index a3d25f4..9a8031b 100644
@@ -226,6 +226,11 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
  {
        int i;
 
+       /* no need to take locks, etc. if nothing's going to change */
+       if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) &&
+           (rdev->pm.requested_power_state_index == rdev->pm.current_power_state_index))
+               return;
+
        mutex_lock(&rdev->ddev->struct_mutex);
        mutex_lock(&rdev->vram_mutex);
        mutex_lock(&rdev->cp.mutex);
--

1.7.1.1