diff options
author | Jerome Glisse <jglisse@redhat.com> | 2012-12-17 11:04:32 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2012-12-19 17:44:05 -0500 |
commit | 5f8f635edd8ad5a6416bff4c5ff486500357f473 (patch) | |
tree | 272f2097b857340ba94a0356c4da29dc1dfcedfc /drivers/gpu/drm/radeon/radeon_device.c | |
parent | 76903b96adbfbb38b049765add21e02e44c387a5 (diff) |
drm/radeon: avoid deadlock in pm path when waiting for fence
radeon_fence_wait_empty_locked should not trigger GPU reset as no
place where it's call from would benefit from such thing and it
actually lead to a kernel deadlock in case the reset is triggered
from pm codepath. Instead force ring completion in place where it
makes sense or return early in others.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_device.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index e81d6cab9959..a6617b53a9c6 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1164,6 +1164,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) | |||
1164 | struct drm_crtc *crtc; | 1164 | struct drm_crtc *crtc; |
1165 | struct drm_connector *connector; | 1165 | struct drm_connector *connector; |
1166 | int i, r; | 1166 | int i, r; |
1167 | bool force_completion = false; | ||
1167 | 1168 | ||
1168 | if (dev == NULL || dev->dev_private == NULL) { | 1169 | if (dev == NULL || dev->dev_private == NULL) { |
1169 | return -ENODEV; | 1170 | return -ENODEV; |
@@ -1206,8 +1207,16 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) | |||
1206 | 1207 | ||
1207 | mutex_lock(&rdev->ring_lock); | 1208 | mutex_lock(&rdev->ring_lock); |
1208 | /* wait for gpu to finish processing current batch */ | 1209 | /* wait for gpu to finish processing current batch */ |
1209 | for (i = 0; i < RADEON_NUM_RINGS; i++) | 1210 | for (i = 0; i < RADEON_NUM_RINGS; i++) { |
1210 | radeon_fence_wait_empty_locked(rdev, i); | 1211 | r = radeon_fence_wait_empty_locked(rdev, i); |
1212 | if (r) { | ||
1213 | /* delay GPU reset to resume */ | ||
1214 | force_completion = true; | ||
1215 | } | ||
1216 | } | ||
1217 | if (force_completion) { | ||
1218 | radeon_fence_driver_force_completion(rdev); | ||
1219 | } | ||
1211 | mutex_unlock(&rdev->ring_lock); | 1220 | mutex_unlock(&rdev->ring_lock); |
1212 | 1221 | ||
1213 | radeon_save_bios_scratch_regs(rdev); | 1222 | radeon_save_bios_scratch_regs(rdev); |